@guidelytech/svelte 0.0.0-stage → 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/README.md +34 -2
- package/dist/index.cjs +145 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +44 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/package.json +64 -3
package/README.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @guidelytech/svelte
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Svelte 4/5 stores, actions and context helpers for Guidely (wraps `@guidelytech/sdk-core`).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pnpm add @guidelytech/svelte
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```svelte
|
|
10
|
+
<script>
|
|
11
|
+
import { onMount } from "svelte";
|
|
12
|
+
import { createGuidely, guidely, activeGuide, guideTrigger } from "@guidelytech/svelte";
|
|
13
|
+
onMount(() => {
|
|
14
|
+
const client = createGuidely({ projectId: "pk_dev_…", apiUrl: "http://localhost:3000" });
|
|
15
|
+
return () => client.destroy();
|
|
16
|
+
});
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<button use:guideTrigger={"new-user-onboarding"}>Restart tour</button>
|
|
20
|
+
{#if $activeGuide}<p>Showing {$activeGuide.name}</p>{/if}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
| Export | Description |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `createGuidely(options)` | Creates the client (browser only; throws a helpful error on the server) and stores it in `guidely`. Returns the existing client when called twice with the same key. |
|
|
26
|
+
| `destroyGuidely()` | Destroys the client and clears the store. |
|
|
27
|
+
| `syncGuidelyUser(user \| null \| undefined)` | Idempotently mirrors your signed-in user: identifies when id/traits/account change, `reset()`s on `null` (sign-out), ignores `undefined` (still loading). Call from a `$effect` / `$:`; no-op on the server. |
|
|
28
|
+
| `guidely` | `Writable<GuidelyClient \| null>`. |
|
|
29
|
+
| `guidelyReady` | `Readable<boolean>`. |
|
|
30
|
+
| `activeGuide` | `Readable<PublishedGuide \| null>`. |
|
|
31
|
+
| `checklistProgress(idOrKey)` | `Readable<ChecklistProgressState>`. |
|
|
32
|
+
| `guideCompleted(idOrKey)` | `Readable<boolean>`. |
|
|
33
|
+
| `setGuidelyContext(client)` / `getGuidelyContext()` | Component context helpers (fall back to the store). |
|
|
34
|
+
| `use:guideTrigger={"guide-key"}` | Clicking the element starts the guide. |
|
|
35
|
+
| `use:guidelyTarget={"id"}` | Marks the element with `data-tour="id"` (no runtime behaviour). |
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
activeGuide: () => activeGuide,
|
|
24
|
+
checklistProgress: () => checklistProgress,
|
|
25
|
+
createGuidely: () => createGuidely,
|
|
26
|
+
destroyGuidely: () => destroyGuidely,
|
|
27
|
+
getGuidelyContext: () => getGuidelyContext,
|
|
28
|
+
guideCompleted: () => guideCompleted,
|
|
29
|
+
guideTrigger: () => guideTrigger,
|
|
30
|
+
guidely: () => guidely,
|
|
31
|
+
guidelyReady: () => guidelyReady,
|
|
32
|
+
guidelyTarget: () => guidelyTarget,
|
|
33
|
+
setGuidelyContext: () => setGuidelyContext,
|
|
34
|
+
syncGuidelyUser: () => syncGuidelyUser
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(index_exports);
|
|
37
|
+
var import_sdk_core = require("@guidelytech/sdk-core");
|
|
38
|
+
var import_svelte = require("svelte");
|
|
39
|
+
var import_store = require("svelte/store");
|
|
40
|
+
var guidely = (0, import_store.writable)(null);
|
|
41
|
+
function createGuidely(options) {
|
|
42
|
+
if (typeof window === "undefined") throw new Error("[Guidely] createGuidely() can only run in the browser. Call it inside onMount(), or use initGuidely() from @guidelytech/sveltekit.");
|
|
43
|
+
const existing = (0, import_store.get)(guidely);
|
|
44
|
+
if (existing && !existing.getState().destroyed && existing.options.projectId === options.projectId) return existing;
|
|
45
|
+
existing?.destroy();
|
|
46
|
+
const client = (0, import_sdk_core.createGuidely)(options);
|
|
47
|
+
guidely.set(client);
|
|
48
|
+
if (pendingUser !== void 0) applyUser(client, pendingUser);
|
|
49
|
+
pendingUser = void 0;
|
|
50
|
+
return client;
|
|
51
|
+
}
|
|
52
|
+
var appliedUser = /* @__PURE__ */ new WeakMap();
|
|
53
|
+
var pendingUser;
|
|
54
|
+
function syncGuidelyUser(user) {
|
|
55
|
+
if (typeof window === "undefined") return;
|
|
56
|
+
const client = (0, import_store.get)(guidely);
|
|
57
|
+
if (client) applyUser(client, user);
|
|
58
|
+
else pendingUser = user;
|
|
59
|
+
}
|
|
60
|
+
function applyUser(client, user) {
|
|
61
|
+
if (user === void 0) return;
|
|
62
|
+
const key = user ? JSON.stringify([String(user.id), user.traits ?? null, user.account ?? null]) : null;
|
|
63
|
+
if (appliedUser.has(client) && appliedUser.get(client) === key) return;
|
|
64
|
+
appliedUser.set(client, key);
|
|
65
|
+
if (user) void client.identify(user.id, user.traits, user.account);
|
|
66
|
+
else if (client.getState().user?.id) client.reset();
|
|
67
|
+
}
|
|
68
|
+
function destroyGuidely() {
|
|
69
|
+
(0, import_store.get)(guidely)?.destroy();
|
|
70
|
+
guidely.set(null);
|
|
71
|
+
}
|
|
72
|
+
var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("guidely");
|
|
73
|
+
function setGuidelyContext(client) {
|
|
74
|
+
(0, import_svelte.setContext)(CONTEXT_KEY, client);
|
|
75
|
+
}
|
|
76
|
+
function getGuidelyContext() {
|
|
77
|
+
return (0, import_svelte.getContext)(CONTEXT_KEY) ?? (0, import_store.get)(guidely);
|
|
78
|
+
}
|
|
79
|
+
function fromClient(initial, compute, events) {
|
|
80
|
+
return (0, import_store.readable)(initial, (set) => {
|
|
81
|
+
let offs = [];
|
|
82
|
+
const unsub = guidely.subscribe((client) => {
|
|
83
|
+
offs.forEach((off) => off());
|
|
84
|
+
offs = [];
|
|
85
|
+
if (!client) return set(initial);
|
|
86
|
+
const update = () => set(compute(client));
|
|
87
|
+
update();
|
|
88
|
+
offs = events.map((e) => client.on(e, update));
|
|
89
|
+
});
|
|
90
|
+
return () => {
|
|
91
|
+
offs.forEach((off) => off());
|
|
92
|
+
unsub();
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
var guidelyReady = fromClient(false, (c) => c.getState().ready, ["ready"]);
|
|
97
|
+
var activeGuide = fromClient(null, (c) => c.getActiveGuide(), ["ready", "guide:start", "guide:complete", "guide:dismiss", "guide:skip", "identify"]);
|
|
98
|
+
function checklistProgress(idOrKey) {
|
|
99
|
+
return fromClient({ completedTaskIds: [], completedAt: null, dismissedAt: null }, (c) => c.getChecklistProgress(idOrKey), ["ready", "identify", "checklist:task", "checklist:complete"]);
|
|
100
|
+
}
|
|
101
|
+
function guideCompleted(idOrKey) {
|
|
102
|
+
return (0, import_store.derived)(fromClient(false, (c) => c.isGuideCompleted(idOrKey), ["ready", "identify", "guide:complete"]), (v) => v);
|
|
103
|
+
}
|
|
104
|
+
function guideTrigger(node, key) {
|
|
105
|
+
let current = key;
|
|
106
|
+
const onClick = (e) => {
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
(0, import_store.get)(guidely)?.startGuide(current);
|
|
109
|
+
};
|
|
110
|
+
node.addEventListener("click", onClick);
|
|
111
|
+
node.setAttribute("data-guidely-trigger", current);
|
|
112
|
+
return {
|
|
113
|
+
update(next) {
|
|
114
|
+
current = next;
|
|
115
|
+
node.setAttribute("data-guidely-trigger", next);
|
|
116
|
+
},
|
|
117
|
+
destroy() {
|
|
118
|
+
node.removeEventListener("click", onClick);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function guidelyTarget(node, id) {
|
|
123
|
+
const apply = (v) => {
|
|
124
|
+
if (v) node.setAttribute("data-tour", v);
|
|
125
|
+
};
|
|
126
|
+
apply(id);
|
|
127
|
+
return { update: apply, destroy() {
|
|
128
|
+
} };
|
|
129
|
+
}
|
|
130
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
131
|
+
0 && (module.exports = {
|
|
132
|
+
activeGuide,
|
|
133
|
+
checklistProgress,
|
|
134
|
+
createGuidely,
|
|
135
|
+
destroyGuidely,
|
|
136
|
+
getGuidelyContext,
|
|
137
|
+
guideCompleted,
|
|
138
|
+
guideTrigger,
|
|
139
|
+
guidely,
|
|
140
|
+
guidelyReady,
|
|
141
|
+
guidelyTarget,
|
|
142
|
+
setGuidelyContext,
|
|
143
|
+
syncGuidelyUser
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createGuidely as createCore, type ChecklistProgressState, type GuidelyClient, type GuidelyOptions, type GuidelyUser, type PublishedGuide } from \"@guidelytech/sdk-core\";\nimport { getContext, setContext } from \"svelte\";\nimport { derived, get, readable, writable, type Readable } from \"svelte/store\";\n\nexport type { GuidelyClient, GuidelyOptions, GuidelyEvents, GuidelyUser, ChecklistProgressState, PublishedGuide } from \"@guidelytech/sdk-core\";\n\n/** The current client (null on the server and before `createGuidely`). */\nexport const guidely = writable<GuidelyClient | null>(null);\n\n/**\n * Creates the client and stores it in the `guidely` store. Browser-only: throws a helpful error\n * when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).\n */\nexport function createGuidely(options: GuidelyOptions): GuidelyClient {\n if (typeof window === \"undefined\") throw new Error(\"[Guidely] createGuidely() can only run in the browser. Call it inside onMount(), or use initGuidely() from @guidelytech/sveltekit.\");\n const existing = get(guidely);\n if (existing && !existing.getState().destroyed && existing.options.projectId === options.projectId) return existing;\n existing?.destroy();\n const client = createCore(options);\n guidely.set(client);\n if (pendingUser !== undefined) applyUser(client, pendingUser);\n pendingUser = undefined;\n return client;\n}\n\nconst appliedUser = new WeakMap<GuidelyClient, string | null>();\nlet pendingUser: GuidelyUser | null | undefined;\n\n/**\n * Keeps the Guidely user in step with your app's signed-in user. Idempotent: call it whenever your\n * user data may have changed (a `$effect` / `$:` on layout data). A user identifies (again only when\n * id, traits or account change); `null` resets a previously identified user, including one restored\n * from storage; `undefined` means \"not known yet\" and changes nothing. No-op on the server; called\n * before `createGuidely`, it is applied when the client is created.\n */\nexport function syncGuidelyUser(user: GuidelyUser | null | undefined): void {\n if (typeof window === \"undefined\") return;\n const client = get(guidely);\n if (client) applyUser(client, user);\n else pendingUser = user;\n}\n\nfunction applyUser(client: GuidelyClient, user: GuidelyUser | null | undefined): void {\n if (user === undefined) return;\n const key = user ? JSON.stringify([String(user.id), user.traits ?? null, user.account ?? null]) : null;\n if (appliedUser.has(client) && appliedUser.get(client) === key) return;\n appliedUser.set(client, key);\n if (user) void client.identify(user.id, user.traits, user.account);\n else if (client.getState().user?.id) client.reset();\n}\n\n/** Destroys the current client and clears the store. */\nexport function destroyGuidely(): void {\n get(guidely)?.destroy();\n guidely.set(null);\n}\n\nconst CONTEXT_KEY = Symbol.for(\"guidely\");\n\nexport function setGuidelyContext(client: GuidelyClient | null): void {\n setContext(CONTEXT_KEY, client);\n}\n\nexport function getGuidelyContext(): GuidelyClient | null {\n return (getContext(CONTEXT_KEY) as GuidelyClient | null | undefined) ?? get(guidely);\n}\n\nfunction fromClient<T>(initial: T, compute: (client: GuidelyClient) => T, events: Array<Parameters<GuidelyClient[\"on\"]>[0]>): Readable<T> {\n return readable<T>(initial, (set) => {\n let offs: Array<() => void> = [];\n const unsub = guidely.subscribe((client) => {\n offs.forEach((off) => off());\n offs = [];\n if (!client) return set(initial);\n const update = () => set(compute(client));\n update();\n offs = events.map((e) => client.on(e, update as never));\n });\n return () => {\n offs.forEach((off) => off());\n unsub();\n };\n });\n}\n\n/** True once the configuration has loaded. */\nexport const guidelyReady: Readable<boolean> = fromClient(false, (c) => c.getState().ready, [\"ready\"]);\n\n/** The guide currently showing (flows, modals, surveys), or null. */\nexport const activeGuide: Readable<PublishedGuide | null> = fromClient<PublishedGuide | null>(null, (c) => c.getActiveGuide(), [\"ready\", \"guide:start\", \"guide:complete\", \"guide:dismiss\", \"guide:skip\", \"identify\"]);\n\n/** Live checklist progress for a checklist guide (by id or key). */\nexport function checklistProgress(idOrKey: string): Readable<ChecklistProgressState> {\n return fromClient<ChecklistProgressState>({ completedTaskIds: [], completedAt: null, dismissedAt: null }, (c) => c.getChecklistProgress(idOrKey), [\"ready\", \"identify\", \"checklist:task\", \"checklist:complete\"]);\n}\n\n/** Is the given guide completed for the current user? */\nexport function guideCompleted(idOrKey: string): Readable<boolean> {\n return derived(fromClient<boolean>(false, (c) => c.isGuideCompleted(idOrKey), [\"ready\", \"identify\", \"guide:complete\"]), (v) => v);\n}\n\n/** `use:guideTrigger={\"guide-key\"}` — clicking the element starts the guide. */\nexport function guideTrigger(node: HTMLElement, key: string): { update(key: string): void; destroy(): void } {\n let current = key;\n const onClick = (e: Event) => {\n e.preventDefault();\n get(guidely)?.startGuide(current);\n };\n node.addEventListener(\"click\", onClick);\n node.setAttribute(\"data-guidely-trigger\", current);\n return {\n update(next: string) {\n current = next;\n node.setAttribute(\"data-guidely-trigger\", next);\n },\n destroy() {\n node.removeEventListener(\"click\", onClick);\n },\n };\n}\n\n/** `use:guidelyTarget={\"id\"}` — marks an element as a guide target (`data-tour`). No runtime behaviour. */\nexport function guidelyTarget(node: HTMLElement, id?: string): { update(id?: string): void; destroy(): void } {\n const apply = (v?: string) => {\n if (v) node.setAttribute(\"data-tour\", v);\n };\n apply(id);\n return { update: apply, destroy() {} };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAyJ;AACzJ,oBAAuC;AACvC,mBAAgE;AAKzD,IAAM,cAAU,uBAA+B,IAAI;AAMnD,SAAS,cAAc,SAAwC;AACpE,MAAI,OAAO,WAAW,YAAa,OAAM,IAAI,MAAM,oIAAoI;AACvL,QAAM,eAAW,kBAAI,OAAO;AAC5B,MAAI,YAAY,CAAC,SAAS,SAAS,EAAE,aAAa,SAAS,QAAQ,cAAc,QAAQ,UAAW,QAAO;AAC3G,YAAU,QAAQ;AAClB,QAAM,aAAS,gBAAAA,eAAW,OAAO;AACjC,UAAQ,IAAI,MAAM;AAClB,MAAI,gBAAgB,OAAW,WAAU,QAAQ,WAAW;AAC5D,gBAAc;AACd,SAAO;AACT;AAEA,IAAM,cAAc,oBAAI,QAAsC;AAC9D,IAAI;AASG,SAAS,gBAAgB,MAA4C;AAC1E,MAAI,OAAO,WAAW,YAAa;AACnC,QAAM,aAAS,kBAAI,OAAO;AAC1B,MAAI,OAAQ,WAAU,QAAQ,IAAI;AAAA,MAC7B,eAAc;A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AAO,CAAC,OAAO,CAAC;AAG9F,IAAM,cAA+C,WAAkC,MAAM,CAAC,MAAM,EAAE,eAAe,GAAG,CAAC,SAAS,eAAe,kBAAkB,iBAAiB,cAAc,UAAU,CAAC;AAG7M,SAAS,kBAAkB,SAAmD;AACnF,SAAO,WAAmC,EAAE,kBAAkB,CAAC,GAAG,aAAa,MAAM,aAAa,KAAK,GAAG,CAAC,MAAM,EAAE,qBAAqB,OAAO,GAAG,CAAC,SAAS,YAAY,kBAAkB,oBAAoB,CAAC;AACjN;AAGO,SAAS,eAAe,SAAoC;AACjE,aAAO,sBAAQ,WAAoB,OAAO,CAAC,MAAM,EAAE,iBAAiB,OAAO,GAAG,CAAC,SAAS,YAAY,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC;AAClI;AAGO,SAAS,aAAa,MAAmB,KAA6D;AAC3G,MAAI,UAAU;AACd,QAAM,UAAU,CAAC,MAAa;AAC5B,MAAE,eAAe;AACjB,0BAAI,OAAO,GAAG,WAAW,OAAO;AAAA,EAClC;AACA,OAAK,iBAAiB,SAAS,OAAO;AACtC,OAAK,aAAa,wBAAwB,OAAO;AACjD,SAAO;AAAA,IACL,OAAO,MAAc;AACnB,gBAAU;AACV,WAAK,aAAa,wBAAwB,IAAI;AAAA,IAChD;AAAA,IACA,UAAU;AACR,WAAK,oBAAoB,SAAS,OAAO;AAAA,IAC3C;AAAA,EACF;AACF;AAGO,SAAS,cAAc,MAAmB,IAA6D;AAC5G,QAAM,QAAQ,CAAC,MAAe;AAC5B,QAAI,EAAG,MAAK,aAAa,aAAa,CAAC;AAAA,EACzC;AACA,QAAM,EAAE;AACR,SAAO,EAAE,QAAQ,OAAO,UAAU;AAAA,EAAC,EAAE;AACvC;","names":["createCore"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as svelte_store from 'svelte/store';
|
|
2
|
+
import { Readable } from 'svelte/store';
|
|
3
|
+
import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient, GuidelyUser } from '@guidelytech/sdk-core';
|
|
4
|
+
export { ChecklistProgressState, GuidelyClient, GuidelyEvents, GuidelyOptions, GuidelyUser, PublishedGuide } from '@guidelytech/sdk-core';
|
|
5
|
+
|
|
6
|
+
/** The current client (null on the server and before `createGuidely`). */
|
|
7
|
+
declare const guidely: svelte_store.Writable<GuidelyClient | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates the client and stores it in the `guidely` store. Browser-only: throws a helpful error
|
|
10
|
+
* when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).
|
|
11
|
+
*/
|
|
12
|
+
declare function createGuidely(options: GuidelyOptions): GuidelyClient;
|
|
13
|
+
/**
|
|
14
|
+
* Keeps the Guidely user in step with your app's signed-in user. Idempotent: call it whenever your
|
|
15
|
+
* user data may have changed (a `$effect` / `$:` on layout data). A user identifies (again only when
|
|
16
|
+
* id, traits or account change); `null` resets a previously identified user, including one restored
|
|
17
|
+
* from storage; `undefined` means "not known yet" and changes nothing. No-op on the server; called
|
|
18
|
+
* before `createGuidely`, it is applied when the client is created.
|
|
19
|
+
*/
|
|
20
|
+
declare function syncGuidelyUser(user: GuidelyUser | null | undefined): void;
|
|
21
|
+
/** Destroys the current client and clears the store. */
|
|
22
|
+
declare function destroyGuidely(): void;
|
|
23
|
+
declare function setGuidelyContext(client: GuidelyClient | null): void;
|
|
24
|
+
declare function getGuidelyContext(): GuidelyClient | null;
|
|
25
|
+
/** True once the configuration has loaded. */
|
|
26
|
+
declare const guidelyReady: Readable<boolean>;
|
|
27
|
+
/** The guide currently showing (flows, modals, surveys), or null. */
|
|
28
|
+
declare const activeGuide: Readable<PublishedGuide | null>;
|
|
29
|
+
/** Live checklist progress for a checklist guide (by id or key). */
|
|
30
|
+
declare function checklistProgress(idOrKey: string): Readable<ChecklistProgressState>;
|
|
31
|
+
/** Is the given guide completed for the current user? */
|
|
32
|
+
declare function guideCompleted(idOrKey: string): Readable<boolean>;
|
|
33
|
+
/** `use:guideTrigger={"guide-key"}` — clicking the element starts the guide. */
|
|
34
|
+
declare function guideTrigger(node: HTMLElement, key: string): {
|
|
35
|
+
update(key: string): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
};
|
|
38
|
+
/** `use:guidelyTarget={"id"}` — marks an element as a guide target (`data-tour`). No runtime behaviour. */
|
|
39
|
+
declare function guidelyTarget(node: HTMLElement, id?: string): {
|
|
40
|
+
update(id?: string): void;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext, syncGuidelyUser };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as svelte_store from 'svelte/store';
|
|
2
|
+
import { Readable } from 'svelte/store';
|
|
3
|
+
import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient, GuidelyUser } from '@guidelytech/sdk-core';
|
|
4
|
+
export { ChecklistProgressState, GuidelyClient, GuidelyEvents, GuidelyOptions, GuidelyUser, PublishedGuide } from '@guidelytech/sdk-core';
|
|
5
|
+
|
|
6
|
+
/** The current client (null on the server and before `createGuidely`). */
|
|
7
|
+
declare const guidely: svelte_store.Writable<GuidelyClient | null>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates the client and stores it in the `guidely` store. Browser-only: throws a helpful error
|
|
10
|
+
* when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).
|
|
11
|
+
*/
|
|
12
|
+
declare function createGuidely(options: GuidelyOptions): GuidelyClient;
|
|
13
|
+
/**
|
|
14
|
+
* Keeps the Guidely user in step with your app's signed-in user. Idempotent: call it whenever your
|
|
15
|
+
* user data may have changed (a `$effect` / `$:` on layout data). A user identifies (again only when
|
|
16
|
+
* id, traits or account change); `null` resets a previously identified user, including one restored
|
|
17
|
+
* from storage; `undefined` means "not known yet" and changes nothing. No-op on the server; called
|
|
18
|
+
* before `createGuidely`, it is applied when the client is created.
|
|
19
|
+
*/
|
|
20
|
+
declare function syncGuidelyUser(user: GuidelyUser | null | undefined): void;
|
|
21
|
+
/** Destroys the current client and clears the store. */
|
|
22
|
+
declare function destroyGuidely(): void;
|
|
23
|
+
declare function setGuidelyContext(client: GuidelyClient | null): void;
|
|
24
|
+
declare function getGuidelyContext(): GuidelyClient | null;
|
|
25
|
+
/** True once the configuration has loaded. */
|
|
26
|
+
declare const guidelyReady: Readable<boolean>;
|
|
27
|
+
/** The guide currently showing (flows, modals, surveys), or null. */
|
|
28
|
+
declare const activeGuide: Readable<PublishedGuide | null>;
|
|
29
|
+
/** Live checklist progress for a checklist guide (by id or key). */
|
|
30
|
+
declare function checklistProgress(idOrKey: string): Readable<ChecklistProgressState>;
|
|
31
|
+
/** Is the given guide completed for the current user? */
|
|
32
|
+
declare function guideCompleted(idOrKey: string): Readable<boolean>;
|
|
33
|
+
/** `use:guideTrigger={"guide-key"}` — clicking the element starts the guide. */
|
|
34
|
+
declare function guideTrigger(node: HTMLElement, key: string): {
|
|
35
|
+
update(key: string): void;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
};
|
|
38
|
+
/** `use:guidelyTarget={"id"}` — marks an element as a guide target (`data-tour`). No runtime behaviour. */
|
|
39
|
+
declare function guidelyTarget(node: HTMLElement, id?: string): {
|
|
40
|
+
update(id?: string): void;
|
|
41
|
+
destroy(): void;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext, syncGuidelyUser };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { createGuidely as createCore } from "@guidelytech/sdk-core";
|
|
3
|
+
import { getContext, setContext } from "svelte";
|
|
4
|
+
import { derived, get, readable, writable } from "svelte/store";
|
|
5
|
+
var guidely = writable(null);
|
|
6
|
+
function createGuidely(options) {
|
|
7
|
+
if (typeof window === "undefined") throw new Error("[Guidely] createGuidely() can only run in the browser. Call it inside onMount(), or use initGuidely() from @guidelytech/sveltekit.");
|
|
8
|
+
const existing = get(guidely);
|
|
9
|
+
if (existing && !existing.getState().destroyed && existing.options.projectId === options.projectId) return existing;
|
|
10
|
+
existing?.destroy();
|
|
11
|
+
const client = createCore(options);
|
|
12
|
+
guidely.set(client);
|
|
13
|
+
if (pendingUser !== void 0) applyUser(client, pendingUser);
|
|
14
|
+
pendingUser = void 0;
|
|
15
|
+
return client;
|
|
16
|
+
}
|
|
17
|
+
var appliedUser = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
var pendingUser;
|
|
19
|
+
function syncGuidelyUser(user) {
|
|
20
|
+
if (typeof window === "undefined") return;
|
|
21
|
+
const client = get(guidely);
|
|
22
|
+
if (client) applyUser(client, user);
|
|
23
|
+
else pendingUser = user;
|
|
24
|
+
}
|
|
25
|
+
function applyUser(client, user) {
|
|
26
|
+
if (user === void 0) return;
|
|
27
|
+
const key = user ? JSON.stringify([String(user.id), user.traits ?? null, user.account ?? null]) : null;
|
|
28
|
+
if (appliedUser.has(client) && appliedUser.get(client) === key) return;
|
|
29
|
+
appliedUser.set(client, key);
|
|
30
|
+
if (user) void client.identify(user.id, user.traits, user.account);
|
|
31
|
+
else if (client.getState().user?.id) client.reset();
|
|
32
|
+
}
|
|
33
|
+
function destroyGuidely() {
|
|
34
|
+
get(guidely)?.destroy();
|
|
35
|
+
guidely.set(null);
|
|
36
|
+
}
|
|
37
|
+
var CONTEXT_KEY = /* @__PURE__ */ Symbol.for("guidely");
|
|
38
|
+
function setGuidelyContext(client) {
|
|
39
|
+
setContext(CONTEXT_KEY, client);
|
|
40
|
+
}
|
|
41
|
+
function getGuidelyContext() {
|
|
42
|
+
return getContext(CONTEXT_KEY) ?? get(guidely);
|
|
43
|
+
}
|
|
44
|
+
function fromClient(initial, compute, events) {
|
|
45
|
+
return readable(initial, (set) => {
|
|
46
|
+
let offs = [];
|
|
47
|
+
const unsub = guidely.subscribe((client) => {
|
|
48
|
+
offs.forEach((off) => off());
|
|
49
|
+
offs = [];
|
|
50
|
+
if (!client) return set(initial);
|
|
51
|
+
const update = () => set(compute(client));
|
|
52
|
+
update();
|
|
53
|
+
offs = events.map((e) => client.on(e, update));
|
|
54
|
+
});
|
|
55
|
+
return () => {
|
|
56
|
+
offs.forEach((off) => off());
|
|
57
|
+
unsub();
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
var guidelyReady = fromClient(false, (c) => c.getState().ready, ["ready"]);
|
|
62
|
+
var activeGuide = fromClient(null, (c) => c.getActiveGuide(), ["ready", "guide:start", "guide:complete", "guide:dismiss", "guide:skip", "identify"]);
|
|
63
|
+
function checklistProgress(idOrKey) {
|
|
64
|
+
return fromClient({ completedTaskIds: [], completedAt: null, dismissedAt: null }, (c) => c.getChecklistProgress(idOrKey), ["ready", "identify", "checklist:task", "checklist:complete"]);
|
|
65
|
+
}
|
|
66
|
+
function guideCompleted(idOrKey) {
|
|
67
|
+
return derived(fromClient(false, (c) => c.isGuideCompleted(idOrKey), ["ready", "identify", "guide:complete"]), (v) => v);
|
|
68
|
+
}
|
|
69
|
+
function guideTrigger(node, key) {
|
|
70
|
+
let current = key;
|
|
71
|
+
const onClick = (e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
get(guidely)?.startGuide(current);
|
|
74
|
+
};
|
|
75
|
+
node.addEventListener("click", onClick);
|
|
76
|
+
node.setAttribute("data-guidely-trigger", current);
|
|
77
|
+
return {
|
|
78
|
+
update(next) {
|
|
79
|
+
current = next;
|
|
80
|
+
node.setAttribute("data-guidely-trigger", next);
|
|
81
|
+
},
|
|
82
|
+
destroy() {
|
|
83
|
+
node.removeEventListener("click", onClick);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function guidelyTarget(node, id) {
|
|
88
|
+
const apply = (v) => {
|
|
89
|
+
if (v) node.setAttribute("data-tour", v);
|
|
90
|
+
};
|
|
91
|
+
apply(id);
|
|
92
|
+
return { update: apply, destroy() {
|
|
93
|
+
} };
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
activeGuide,
|
|
97
|
+
checklistProgress,
|
|
98
|
+
createGuidely,
|
|
99
|
+
destroyGuidely,
|
|
100
|
+
getGuidelyContext,
|
|
101
|
+
guideCompleted,
|
|
102
|
+
guideTrigger,
|
|
103
|
+
guidely,
|
|
104
|
+
guidelyReady,
|
|
105
|
+
guidelyTarget,
|
|
106
|
+
setGuidelyContext,
|
|
107
|
+
syncGuidelyUser
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createGuidely as createCore, type ChecklistProgressState, type GuidelyClient, type GuidelyOptions, type GuidelyUser, type PublishedGuide } from \"@guidelytech/sdk-core\";\nimport { getContext, setContext } from \"svelte\";\nimport { derived, get, readable, writable, type Readable } from \"svelte/store\";\n\nexport type { GuidelyClient, GuidelyOptions, GuidelyEvents, GuidelyUser, ChecklistProgressState, PublishedGuide } from \"@guidelytech/sdk-core\";\n\n/** The current client (null on the server and before `createGuidely`). */\nexport const guidely = writable<GuidelyClient | null>(null);\n\n/**\n * Creates the client and stores it in the `guidely` store. Browser-only: throws a helpful error\n * when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).\n */\nexport function createGuidely(options: GuidelyOptions): GuidelyClient {\n if (typeof window === \"undefined\") throw new Error(\"[Guidely] createGuidely() can only run in the browser. Call it inside onMount(), or use initGuidely() from @guidelytech/sveltekit.\");\n const existing = get(guidely);\n if (existing && !existing.getState().destroyed && existing.options.projectId === options.projectId) return existing;\n existing?.destroy();\n const client = createCore(options);\n guidely.set(client);\n if (pendingUser !== undefined) applyUser(client, pendingUser);\n pendingUser = undefined;\n return client;\n}\n\nconst appliedUser = new WeakMap<GuidelyClient, string | null>();\nlet pendingUser: GuidelyUser | null | undefined;\n\n/**\n * Keeps the Guidely user in step with your app's signed-in user. Idempotent: call it whenever your\n * user data may have changed (a `$effect` / `$:` on layout data). A user identifies (again only when\n * id, traits or account change); `null` resets a previously identified user, including one restored\n * from storage; `undefined` means \"not known yet\" and changes nothing. No-op on the server; called\n * before `createGuidely`, it is applied when the client is created.\n */\nexport function syncGuidelyUser(user: GuidelyUser | null | undefined): void {\n if (typeof window === \"undefined\") return;\n const client = get(guidely);\n if (client) applyUser(client, user);\n else pendingUser = user;\n}\n\nfunction applyUser(client: GuidelyClient, user: GuidelyUser | null | undefined): void {\n if (user === undefined) return;\n const key = user ? JSON.stringify([String(user.id), user.traits ?? null, user.account ?? null]) : null;\n if (appliedUser.has(client) && appliedUser.get(client) === key) return;\n appliedUser.set(client, key);\n if (user) void client.identify(user.id, user.traits, user.account);\n else if (client.getState().user?.id) client.reset();\n}\n\n/** Destroys the current client and clears the store. */\nexport function destroyGuidely(): void {\n get(guidely)?.destroy();\n guidely.set(null);\n}\n\nconst CONTEXT_KEY = Symbol.for(\"guidely\");\n\nexport function setGuidelyContext(client: GuidelyClient | null): void {\n setContext(CONTEXT_KEY, client);\n}\n\nexport function getGuidelyContext(): GuidelyClient | null {\n return (getContext(CONTEXT_KEY) as GuidelyClient | null | undefined) ?? get(guidely);\n}\n\nfunction fromClient<T>(initial: T, compute: (client: GuidelyClient) => T, events: Array<Parameters<GuidelyClient[\"on\"]>[0]>): Readable<T> {\n return readable<T>(initial, (set) => {\n let offs: Array<() => void> = [];\n const unsub = guidely.subscribe((client) => {\n offs.forEach((off) => off());\n offs = [];\n if (!client) return set(initial);\n const update = () => set(compute(client));\n update();\n offs = events.map((e) => client.on(e, update as never));\n });\n return () => {\n offs.forEach((off) => off());\n unsub();\n };\n });\n}\n\n/** True once the configuration has loaded. */\nexport const guidelyReady: Readable<boolean> = fromClient(false, (c) => c.getState().ready, [\"ready\"]);\n\n/** The guide currently showing (flows, modals, surveys), or null. */\nexport const activeGuide: Readable<PublishedGuide | null> = fromClient<PublishedGuide | null>(null, (c) => c.getActiveGuide(), [\"ready\", \"guide:start\", \"guide:complete\", \"guide:dismiss\", \"guide:skip\", \"identify\"]);\n\n/** Live checklist progress for a checklist guide (by id or key). */\nexport function checklistProgress(idOrKey: string): Readable<ChecklistProgressState> {\n return fromClient<ChecklistProgressState>({ completedTaskIds: [], completedAt: null, dismissedAt: null }, (c) => c.getChecklistProgress(idOrKey), [\"ready\", \"identify\", \"checklist:task\", \"checklist:complete\"]);\n}\n\n/** Is the given guide completed for the current user? */\nexport function guideCompleted(idOrKey: string): Readable<boolean> {\n return derived(fromClient<boolean>(false, (c) => c.isGuideCompleted(idOrKey), [\"ready\", \"identify\", \"guide:complete\"]), (v) => v);\n}\n\n/** `use:guideTrigger={\"guide-key\"}` — clicking the element starts the guide. */\nexport function guideTrigger(node: HTMLElement, key: string): { update(key: string): void; destroy(): void } {\n let current = key;\n const onClick = (e: Event) => {\n e.preventDefault();\n get(guidely)?.startGuide(current);\n };\n node.addEventListener(\"click\", onClick);\n node.setAttribute(\"data-guidely-trigger\", current);\n return {\n update(next: string) {\n current = next;\n node.setAttribute(\"data-guidely-trigger\", next);\n },\n destroy() {\n node.removeEventListener(\"click\", onClick);\n },\n };\n}\n\n/** `use:guidelyTarget={\"id\"}` — marks an element as a guide target (`data-tour`). No runtime behaviour. */\nexport function guidelyTarget(node: HTMLElement, id?: string): { update(id?: string): void; destroy(): void } {\n const apply = (v?: string) => {\n if (v) node.setAttribute(\"data-tour\", v);\n };\n apply(id);\n return { update: apply, destroy() {} };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB,kBAA+H;AACzJ,SAAS,YAAY,kBAAkB;AACvC,SAAS,SAAS,KAAK,UAAU,gBAA+B;AAKzD,IAAM,UAAU,SAA+B,IAAI;AAMnD,SAAS,cAAc,SAAwC;AACpE,MAAI,OAAO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AACnB,gBAAU;AACV,WAAK,aAAa,wBAAwB,IAAI;AAAA,IAChD;AAAA,IACA,UAAU;AACR,WAAK,oBAAoB,SAAS,OAAO;AAAA,IAC3C;AAAA,EACF;AACF;AAGO,SAAS,cAAc,MAAmB,IAA6D;AAC5G,QAAM,QAAQ,CAAC,MAAe;AAC5B,QAAI,EAAG,MAAK,aAAa,aAAa,CAAC;AAAA,EACzC;AACA,QAAM,EAAE;AACR,SAAO,EAAE,QAAQ,OAAO,UAAU;AAAA,EAAC,EAAE;AACvC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guidelytech/svelte",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Svelte stores, actions and client for Guidely",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.cjs",
|
|
9
|
+
"module": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@guidelytech/sdk-core": "0.2.0",
|
|
24
|
+
"@guidelytech/shared": "0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"tsup": "^8.5.1",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"vitest": "^3.2.7",
|
|
30
|
+
"happy-dom": "^17.6.3",
|
|
31
|
+
"eslint": "^9.39.5",
|
|
32
|
+
"@eslint/js": "^9.39.5",
|
|
33
|
+
"typescript-eslint": "^8.46.0",
|
|
34
|
+
"svelte": "^5.57.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"svelte": ">=4.0.0"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/parmarg/Guidely.git",
|
|
45
|
+
"directory": "packages/svelte"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/parmarg/Guidely/tree/main/packages/svelte#readme",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/parmarg/Guidely/issues"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"guidely",
|
|
53
|
+
"product-adoption",
|
|
54
|
+
"onboarding",
|
|
55
|
+
"product-tour",
|
|
56
|
+
"in-app-guidance",
|
|
57
|
+
"svelte"
|
|
58
|
+
],
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsup",
|
|
61
|
+
"dev": "tsup --watch",
|
|
62
|
+
"typecheck": "tsc --noEmit",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"lint": "eslint src",
|
|
65
|
+
"clean": "rm -rf dist"
|
|
66
|
+
}
|
|
6
67
|
}
|