@skillyo/embed 0.1.0 → 0.2.1

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.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.1
4
+
5
+ The README only: how to get a website key (any account, from the skill's Embed on a website, On your credits), how sites are matched, and what changing `inputs` does. No code changes.
6
+
7
+ ## 0.2.0
8
+
9
+ The `next-step:clicked` event and the `onNextStepClick` prop: the visitor clicked the call to action set on the skill, after a result, with the run's id and the address it opens. Nothing else changes.
10
+
3
11
  ## 0.1.0
4
12
 
5
13
  First release: `SkillyoSkill`, `SkillyoProvider` and `SkillyoSkillHandle` for React and Next.js; `mount()` for everything else; the `ready`, `resize`, `run:started`, `run:completed` and `error` events. Built against Skillyo's loader API version 1.
package/README.md CHANGED
@@ -20,7 +20,17 @@ export function PricingHelp() {
20
20
  }
21
21
  ```
22
22
 
23
- You need a **website key** from Skillyo (Settings › API keys › Create key › Website key) with the skill ticked and your sites listed: your domain, any preview address, and `http://localhost:3000` for local work. Website keys are by invitation for now: email hello@skillyo.ai to ask for one.
23
+ You need a **website key** from Skillyo. Any Skillyo account can make one:
24
+
25
+ 1. Open the skill in Skillyo and choose **⋯ › Embed on a website**.
26
+ 2. Choose **On your credits**. (A **Free** embed has no key: it is a link to the skill page to put in a frame, and this package can't use it.)
27
+ 3. Under **Where is it going?** choose **React or Next.js**, give your app's address, and press **Get the code**. The code has your key in it.
28
+
29
+ Afterwards the key's settings are under **Settings › Embedded skills**. Add every address the skill will load on to its **Sites**:
30
+
31
+ - `acme.com` covers `www.acme.com` too.
32
+ - A local address needs its scheme and port, as you open it: `http://localhost:3000`. A plain `localhost` is read as `https://localhost`.
33
+ - `*.acme.com` covers one level below `acme.com`. A wildcard on a shared host such as `*.vercel.app` lets every site there load your skill, so for previews add the exact preview address instead.
24
34
 
25
35
  How the skill looks and opens - in the page, a button, a slide-over or a floating button, with your brand - is set on the key in Skillyo. Change it there and your app picks it up on the next page load, with no new release.
26
36
 
@@ -52,6 +62,8 @@ A **secret key** (`sko_live_…`) is different: it acts as you, and belongs only
52
62
  />
53
63
  ```
54
64
 
65
+ **About `inputs`.** The keys are the skill's input ids, not the labels on its form. The visitor sees the values and can change them before running. When `inputs` changes, the skill is drawn again with the new values, which clears anything the visitor has typed into its form, so pass values once they are settled (for example when your own form is submitted), not on every keystroke. A field the key itself prefills in Skillyo takes the key's value and is hidden.
66
+
55
67
  Several skills on one site? Set the key once:
56
68
 
57
69
  ```tsx
@@ -76,17 +88,20 @@ const skill = useRef<SkillyoSkillHandle>(null);
76
88
  |---|---|---|
77
89
  | `publicKey` | `string` | The website key. Optional inside `SkillyoProvider` |
78
90
  | `skill` | `string` | Required. The skill's name as it appears in its address |
79
- | `inputs` | `Record<string, string \| number \| boolean>` | Fields to fill in, by input id. Visible and editable by the visitor |
91
+ | `inputs` | `Record<string, string \| number \| boolean>` | Fields to fill in, by input id. Visible and editable by the visitor. See below |
80
92
  | `autoHeight` | `boolean` | In the page only. Default `true`: grows to fit, never below the key's height |
81
93
  | `className`, `style` | | On the element the skill mounts into |
82
94
  | `onReady` | `() => void` | The skill is on screen |
83
95
  | `onRunStarted` | `() => void` | The visitor pressed Run |
84
96
  | `onRunComplete` | `({ runId, status }) => void` | `status`: `succeeded`, `failed` or `cancelled` |
97
+ | `onNextStepClick` | `({ runId, url }) => void` | The visitor clicked the call to action set on the skill, after a result |
85
98
  | `onError` | `({ code }) => void` | The skill could not load - see the codes below |
86
99
  | `onResize` | `({ height }) => void` | The skill's content height |
87
100
 
88
101
  **Next.js:** the component is a client component and can be used from a server component. Nothing loads during server rendering.
89
102
 
103
+ **TanStack Start and Lovable:** the same. On the server it renders an empty `div`, and the skill loads in the browser, so it works in Lovable's TanStack Start projects and in its older Vite ones.
104
+
90
105
  ## Any other framework
91
106
 
92
107
  ```js
@@ -98,6 +113,7 @@ const skill = mount(document.querySelector("#pricing-help"), {
98
113
  });
99
114
 
100
115
  skill.on("run:completed", ({ runId, status }) => {});
116
+ skill.on("next-step:clicked", ({ runId, url }) => {});
101
117
  skill.open();
102
118
  skill.destroy(); // when your view goes away
103
119
  ```
@@ -106,7 +122,7 @@ skill.destroy(); // when your view goes away
106
122
 
107
123
  | Code | Means | Fix |
108
124
  |---|---|---|
109
- | `origin_not_allowed` | This address isn't on the key's sites | Add it on the key, including preview addresses and localhost |
125
+ | `origin_not_allowed` | This address isn't on the key's sites | Add it on the key, including preview addresses |
110
126
  | `skill_not_allowed` | The key can't run this skill | Tick the skill on the key, and check its name |
111
127
  | `key_invalid` | The key doesn't exist or was revoked | Copy the key again from its page in Skillyo |
112
128
  | `key_paused` | The monthly budget is used up | Raise the budget, or wait for next month |
package/dist/index.cjs CHANGED
@@ -28,7 +28,7 @@ __export(src_exports, {
28
28
  module.exports = __toCommonJS(src_exports);
29
29
  var DEFAULT_ORIGIN = "https://app.skillyo.ai";
30
30
  var API_VERSION = 1;
31
- var EVENTS = ["ready", "resize", "run:started", "run:completed", "error"];
31
+ var EVENTS = ["ready", "resize", "run:started", "run:completed", "next-step:clicked", "error"];
32
32
  function existing() {
33
33
  const api = window.Skillyo;
34
34
  return api && typeof api.mount === "function" && api.apiVersion >= API_VERSION ? api : null;
package/dist/index.d.cts CHANGED
@@ -16,6 +16,11 @@ interface SkillyoEvents {
16
16
  runId: string | null;
17
17
  status: RunStatus;
18
18
  };
19
+ /** The visitor clicked the call to action set on the skill, after a result. */
20
+ 'next-step:clicked': {
21
+ runId: string | null;
22
+ url: string;
23
+ };
19
24
  /** The skill could not load. */
20
25
  error: {
21
26
  code: ErrorCode;
package/dist/index.d.ts CHANGED
@@ -16,6 +16,11 @@ interface SkillyoEvents {
16
16
  runId: string | null;
17
17
  status: RunStatus;
18
18
  };
19
+ /** The visitor clicked the call to action set on the skill, after a result. */
20
+ 'next-step:clicked': {
21
+ runId: string | null;
22
+ url: string;
23
+ };
19
24
  /** The skill could not load. */
20
25
  error: {
21
26
  code: ErrorCode;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
2
  var DEFAULT_ORIGIN = "https://app.skillyo.ai";
3
3
  var API_VERSION = 1;
4
- var EVENTS = ["ready", "resize", "run:started", "run:completed", "error"];
4
+ var EVENTS = ["ready", "resize", "run:started", "run:completed", "next-step:clicked", "error"];
5
5
  function existing() {
6
6
  const api = window.Skillyo;
7
7
  return api && typeof api.mount === "function" && api.apiVersion >= API_VERSION ? api : null;
package/dist/react.cjs CHANGED
@@ -63,6 +63,10 @@ var SkillyoSkill = (0, import_react.forwardRef)(function SkillyoSkill2(props, re
63
63
  var _a2, _b2;
64
64
  return (_b2 = (_a2 = latest.current).onRunComplete) == null ? void 0 : _b2.call(_a2, e);
65
65
  });
66
+ h.on("next-step:clicked", (e) => {
67
+ var _a2, _b2;
68
+ return (_b2 = (_a2 = latest.current).onNextStepClick) == null ? void 0 : _b2.call(_a2, e);
69
+ });
66
70
  h.on("error", (e) => {
67
71
  var _a2, _b2;
68
72
  return (_b2 = (_a2 = latest.current).onError) == null ? void 0 : _b2.call(_a2, e);
package/dist/react.d.cts CHANGED
@@ -28,6 +28,10 @@ interface SkillyoSkillProps {
28
28
  runId: string | null;
29
29
  status: RunStatus;
30
30
  }) => void;
31
+ onNextStepClick?: (click: {
32
+ runId: string | null;
33
+ url: string;
34
+ }) => void;
31
35
  onError?: (error: {
32
36
  code: ErrorCode;
33
37
  }) => void;
package/dist/react.d.ts CHANGED
@@ -28,6 +28,10 @@ interface SkillyoSkillProps {
28
28
  runId: string | null;
29
29
  status: RunStatus;
30
30
  }) => void;
31
+ onNextStepClick?: (click: {
32
+ runId: string | null;
33
+ url: string;
34
+ }) => void;
31
35
  onError?: (error: {
32
36
  code: ErrorCode;
33
37
  }) => void;
package/dist/react.js CHANGED
@@ -39,6 +39,10 @@ var SkillyoSkill = forwardRef(function SkillyoSkill2(props, ref) {
39
39
  var _a2, _b2;
40
40
  return (_b2 = (_a2 = latest.current).onRunComplete) == null ? void 0 : _b2.call(_a2, e);
41
41
  });
42
+ h.on("next-step:clicked", (e) => {
43
+ var _a2, _b2;
44
+ return (_b2 = (_a2 = latest.current).onNextStepClick) == null ? void 0 : _b2.call(_a2, e);
45
+ });
42
46
  h.on("error", (e) => {
43
47
  var _a2, _b2;
44
48
  return (_b2 = (_a2 = latest.current).onError) == null ? void 0 : _b2.call(_a2, e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skillyo/embed",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Put a Skillyo skill in your web app: a React component, or mount() for any framework.",
5
5
  "license": "MIT",
6
6
  "author": "Skillyo",