@akropolys/kiku 2.2.28 → 2.2.30

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/EMBED.md CHANGED
@@ -1,11 +1,11 @@
1
- # Plain HTML embed
1
+ # JavaScript embed
2
2
 
3
- Build with `pnpm --filter @akropolys/kiku build`. Host `dist/kiku.js`, `dist/styles.css`, and the entire
4
- `dist/embed` directory together, preserving their relative paths. Serve JavaScript
5
- with the correct MIME type and allow CORS when hosting assets on another origin.
3
+ Add Kiku to any website with the published CDN script before your closing
4
+ `</body>` tag. The same embed works with JavaScript frameworks, plain HTML, and
5
+ HTMX. The loader fetches its stylesheet and embed module automatically.
6
6
 
7
7
  ```html
8
- <script src="/kiku/kiku.js" data-site-id="YOUR_SITE_ID"
8
+ <script src="https://cdn.akropolys.cloud/kiku/2.2.29/kiku.js" data-site-id="YOUR_SITE_ID"
9
9
  data-api-token="YOUR_PUBLIC_BROWSER_TOKEN" defer></script>
10
10
  ```
11
11
 
@@ -32,7 +32,32 @@ await Kiku.ingest({
32
32
 
33
33
  `Kiku.ingest()` accepts one entity, an array, or signed ingestion records and
34
34
  returns the API response. Supply data explicitly; the embed does not guess a
35
- website's schema. Every catalogue record requires its source record's stable top-level `id`. `fields.url` is optional but recommended when a webpage is available; Kiku can show and save records without one. A supplied URL is kept in saved history. URLs, names and signatures do not replace IDs. Existing server records must also include an ID.
35
+ website's schema. Every catalogue record requires its source record's stable top-level `id`. `fields.url` is optional but recommended when a webpage is available; Kiku can show and save records without one. A supplied URL is kept in saved history. URLs, names and signatures do not replace IDs. Normal ingestion sends one record and works on every plan. An unsigned array uses the batch endpoint and requires Growth, Pro or Business. Signing is optional unless the site requires it in Shell; it is independent of normal versus batch ingestion.
36
+
37
+ For a useful minimal record, send `{ id: 'chair-123', title: 'Linen lounge chair' }`.
38
+ Add facts in `fields`. Use `image` for a cover and `images` for an ordered gallery
39
+ of URLs or `{ url, alt?, caption? }` objects. Each record owns its own photos.
40
+ Prefer absolute HTTPS image URLs; without a record webpage, use absolute URLs.
41
+ The first gallery image is the cover unless `image` overrides it. Re-ingest the
42
+ same ID to update the record or use `images: []` to clear its gallery.
43
+
44
+ Reuse loaded data instead of fetching it again just for ingestion. Await
45
+ `Kiku.ready` after automatic setup and catch errors from `Kiku.ingest`. An await
46
+ inside an async callback does not block browser rendering. If the embed is
47
+ loaded dynamically, wait for its script load before accessing `window.Kiku`.
48
+ The embed does not accept the ingestion client's `batchSize` parameter.
49
+
50
+ Update a record using the same ID and the full attributes/gallery to retain.
51
+ Avoid per-view timestamps or counters in catalogue fields; repeated changes can
52
+ use re-index allowance. Use live data for rapidly changing values when appropriate.
53
+ Listing pages can publish loaded arrays with batch access. Call ingestion from
54
+ your existing data-loading or refresh callback whenever fresh records arrive;
55
+ the embed does not watch API requests automatically. Once indexed, updates are
56
+ shared by every visitor using the same site ID, regardless of who triggered them.
57
+ A browser can publish a complete catalogue array, including items not rendered
58
+ on the page, without visits to each item's page. A paginated result covers only
59
+ its supplied records. Ingestion does not fetch other API pages or refresh stale
60
+ cached source data; full coverage does not require a server-side import.
36
61
 
37
62
  After login, call `Kiku.updateIdentity({ shopperId, userProof })` with a proof
38
63
  issued by your server. On logout pass `{}`. `Kiku.destroy()` removes the widget
@@ -41,4 +66,18 @@ exposes `Kiku.ready`. Repeated script tags or mount calls reuse the same widget.
41
66
 
42
67
  For a restrictive CSP, permit the script origin, existing API/voice endpoints,
43
68
  and the styles/fonts already needed by Kiku. Voice still requires HTTPS and
44
- microphone permission. No production embed URL has been published yet.
69
+ microphone permission.
70
+
71
+ ## CDN files and self-hosting
72
+
73
+ - [Loader](https://cdn.akropolys.cloud/kiku/2.2.29/kiku.js)
74
+ - [Stylesheet](https://cdn.akropolys.cloud/kiku/2.2.29/styles.css)
75
+ - [Embed module](https://cdn.akropolys.cloud/kiku/2.2.29/embed/embed.js)
76
+
77
+ To self-host, install `@akropolys/kiku@2.2.29` and copy `dist/kiku.js`,
78
+ `dist/styles.css`, and the entire `dist/embed` directory to your server. Preserve
79
+ their relative paths and use your hosted loader URL in the script tag. Serve
80
+ JavaScript with the correct MIME type and allow CORS across origins.
81
+
82
+ When building from this repository, run `pnpm --filter @akropolys/kiku build`
83
+ to generate those files.
package/README.md CHANGED
@@ -1,16 +1,34 @@
1
1
  # @akropolys/kiku
2
2
 
3
- Chat, search, voice, and photo input for your website. Kiku connects visitors to your content and the API actions you configure in Akropolys.
3
+ Chat, search, voice, and photo input for your website. Kiku connects visitors to your content and the API actions you configure in Akropolys. For React and Next.js, use the React package below. For other websites, use the CDN embed; it also works in React when you prefer a script integration.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@akropolys/kiku?color=orange)](https://www.npmjs.com/package/@akropolys/kiku) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![TypeScript](https://img.shields.io/badge/types-included-blue)](https://www.typescriptlang.org/)
6
6
 
7
+ ## JavaScript embed
8
+
9
+ Add Kiku to any website with the published CDN script:
10
+
11
+ ```html
12
+ <script
13
+ src="https://cdn.akropolys.cloud/kiku/2.2.29/kiku.js"
14
+ data-site-id="YOUR_SITE_ID"
15
+ data-api-token="YOUR_PUBLIC_BROWSER_TOKEN"
16
+ data-label="Ask Kiku"
17
+ defer
18
+ ></script>
19
+ ```
20
+
21
+ The embed includes its own React runtime, styles, and mounting. Your website needs no React installation or provider, including when it uses React or Next.js. See the [embed guide](https://github.com/akropolys/sdk/blob/HEAD/packages/kiku/EMBED.md) for configuration, ingestion, and self-hosting.
22
+
7
23
  ## Install
8
24
 
25
+ Recommended for React and Next.js apps:
26
+
9
27
  ```bash
10
- npm install @akropolys/kiku @akropolys/sdk
28
+ npm install @akropolys/kiku@2.2.29 @akropolys/sdk@2.0.2
11
29
  ```
12
30
 
13
- Requires React and React DOM 17 or later. For websites without React, use the [script embed](https://github.com/akropolys/sdk/blob/HEAD/packages/kiku/EMBED.md).
31
+ This package integration requires React and React DOM 17 or later.
14
32
 
15
33
  ## React and Next.js
16
34
 
@@ -73,7 +91,7 @@ Both components use `AkropolysProvider` from `@akropolys/sdk`.
73
91
 
74
92
  ## Your content and actions
75
93
 
76
- Give each catalogue record a stable top-level `id`. A webpage link in `fields.url` is optional; Kiku can show and save records without one. See the [SDK ingestion guide](https://github.com/akropolys/sdk/blob/HEAD/packages/sdk/README.md#batch-ingestion-on-your-server).
94
+ Give each catalogue record a stable top-level `id`. A webpage link in `fields.url` is optional; Kiku can show and save records without one. See the [SDK ingestion guide](https://github.com/akropolys/sdk/blob/HEAD/packages/sdk/README.md#batch-ingestion-client).
77
95
 
78
96
  Configure action endpoints, HTTP methods, and request fields in Shell. Kiku collects the required values and presents the result returned by your backend. Your endpoint validates the request and performs the operation. See the [site actions guide](https://github.com/akropolys/sdk/blob/HEAD/packages/sdk/README.md#site-actions).
79
97
 
@@ -81,7 +99,7 @@ Configure action endpoints, HTTP methods, and request fields in Shell. Kiku coll
81
99
 
82
100
  - [Akropolys](https://akropolys.cloud)
83
101
  - [Source code](https://github.com/akropolys/sdk)
84
- - [Plain HTML embed guide](https://github.com/akropolys/sdk/blob/HEAD/packages/kiku/EMBED.md)
102
+ - [JavaScript embed guide](https://github.com/akropolys/sdk/blob/HEAD/packages/kiku/EMBED.md)
85
103
  - [Headless SDK](https://www.npmjs.com/package/@akropolys/sdk)
86
104
 
87
105
  ## License