@skillyo/embed 0.1.0 → 0.2.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.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ 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.
6
+
3
7
  ## 0.1.0
4
8
 
5
9
  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,7 @@ 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 (Settings › API keys › Create key › Website key) with the skill ticked and your sites listed: your domain and any preview address. Website keys are by invitation for now: email hello@skillyo.ai to ask for one.
24
24
 
25
25
  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
26
 
@@ -82,6 +82,7 @@ const skill = useRef<SkillyoSkillHandle>(null);
82
82
  | `onReady` | `() => void` | The skill is on screen |
83
83
  | `onRunStarted` | `() => void` | The visitor pressed Run |
84
84
  | `onRunComplete` | `({ runId, status }) => void` | `status`: `succeeded`, `failed` or `cancelled` |
85
+ | `onNextStepClick` | `({ runId, url }) => void` | The visitor clicked the call to action set on the skill, after a result |
85
86
  | `onError` | `({ code }) => void` | The skill could not load - see the codes below |
86
87
  | `onResize` | `({ height }) => void` | The skill's content height |
87
88
 
@@ -98,6 +99,7 @@ const skill = mount(document.querySelector("#pricing-help"), {
98
99
  });
99
100
 
100
101
  skill.on("run:completed", ({ runId, status }) => {});
102
+ skill.on("next-step:clicked", ({ runId, url }) => {});
101
103
  skill.open();
102
104
  skill.destroy(); // when your view goes away
103
105
  ```
@@ -106,7 +108,7 @@ skill.destroy(); // when your view goes away
106
108
 
107
109
  | Code | Means | Fix |
108
110
  |---|---|---|
109
- | `origin_not_allowed` | This address isn't on the key's sites | Add it on the key, including preview addresses and localhost |
111
+ | `origin_not_allowed` | This address isn't on the key's sites | Add it on the key, including preview addresses |
110
112
  | `skill_not_allowed` | The key can't run this skill | Tick the skill on the key, and check its name |
111
113
  | `key_invalid` | The key doesn't exist or was revoked | Copy the key again from its page in Skillyo |
112
114
  | `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.0",
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",