@guidelytech/svelte 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/README.md CHANGED
@@ -24,6 +24,7 @@ pnpm add @guidelytech/svelte
24
24
  |---|---|
25
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
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. |
27
28
  | `guidely` | `Writable<GuidelyClient \| null>`. |
28
29
  | `guidelyReady` | `Readable<boolean>`. |
29
30
  | `activeGuide` | `Readable<PublishedGuide \| null>`. |
package/dist/index.cjs CHANGED
@@ -30,7 +30,8 @@ __export(index_exports, {
30
30
  guidely: () => guidely,
31
31
  guidelyReady: () => guidelyReady,
32
32
  guidelyTarget: () => guidelyTarget,
33
- setGuidelyContext: () => setGuidelyContext
33
+ setGuidelyContext: () => setGuidelyContext,
34
+ syncGuidelyUser: () => syncGuidelyUser
34
35
  });
35
36
  module.exports = __toCommonJS(index_exports);
36
37
  var import_sdk_core = require("@guidelytech/sdk-core");
@@ -44,8 +45,26 @@ function createGuidely(options) {
44
45
  existing?.destroy();
45
46
  const client = (0, import_sdk_core.createGuidely)(options);
46
47
  guidely.set(client);
48
+ if (pendingUser !== void 0) applyUser(client, pendingUser);
49
+ pendingUser = void 0;
47
50
  return client;
48
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
+ }
49
68
  function destroyGuidely() {
50
69
  (0, import_store.get)(guidely)?.destroy();
51
70
  guidely.set(null);
@@ -120,6 +139,7 @@ function guidelyTarget(node, id) {
120
139
  guidely,
121
140
  guidelyReady,
122
141
  guidelyTarget,
123
- setGuidelyContext
142
+ setGuidelyContext,
143
+ syncGuidelyUser
124
144
  });
125
145
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createGuidely as createCore, type ChecklistProgressState, type GuidelyClient, type GuidelyOptions, 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 return client;\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,sBAAuI;AACvI,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,SAAO;AACT;AAGO,SAAS,iBAAuB;AACrC,wBAAI,OAAO,GAAG,QAAQ;AACtB,UAAQ,IAAI,IAAI;AAClB;AAEA,IAAM,cAAc,uBAAO,IAAI,SAAS;AAEjC,SAAS,kBAAkB,QAAoC;AACpE,gCAAW,aAAa,MAAM;AAChC;AAEO,SAAS,oBAA0C;AACxD,aAAQ,0BAAW,WAAW,SAA0C,kBAAI,OAAO;AACrF;AAEA,SAAS,WAAc,SAAY,SAAuC,QAAgE;AACxI,aAAO,uBAAY,SAAS,CAAC,QAAQ;AACnC,QAAI,OAA0B,CAAC;AAC/B,UAAM,QAAQ,QAAQ,UAAU,CAAC,WAAW;AAC1C,WAAK,QAAQ,CAAC,QAAQ,IAAI,CAAC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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"]}
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;AACj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5B,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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as svelte_store from 'svelte/store';
2
2
  import { Readable } from 'svelte/store';
3
- import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient } from '@guidelytech/sdk-core';
3
+ import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient, GuidelyUser } from '@guidelytech/sdk-core';
4
4
  export { ChecklistProgressState, GuidelyClient, GuidelyEvents, GuidelyOptions, GuidelyUser, PublishedGuide } from '@guidelytech/sdk-core';
5
5
 
6
6
  /** The current client (null on the server and before `createGuidely`). */
@@ -10,6 +10,14 @@ declare const guidely: svelte_store.Writable<GuidelyClient | null>;
10
10
  * when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).
11
11
  */
12
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;
13
21
  /** Destroys the current client and clears the store. */
14
22
  declare function destroyGuidely(): void;
15
23
  declare function setGuidelyContext(client: GuidelyClient | null): void;
@@ -33,4 +41,4 @@ declare function guidelyTarget(node: HTMLElement, id?: string): {
33
41
  destroy(): void;
34
42
  };
35
43
 
36
- export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext };
44
+ export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext, syncGuidelyUser };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as svelte_store from 'svelte/store';
2
2
  import { Readable } from 'svelte/store';
3
- import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient } from '@guidelytech/sdk-core';
3
+ import { PublishedGuide, ChecklistProgressState, GuidelyOptions, GuidelyClient, GuidelyUser } from '@guidelytech/sdk-core';
4
4
  export { ChecklistProgressState, GuidelyClient, GuidelyEvents, GuidelyOptions, GuidelyUser, PublishedGuide } from '@guidelytech/sdk-core';
5
5
 
6
6
  /** The current client (null on the server and before `createGuidely`). */
@@ -10,6 +10,14 @@ declare const guidely: svelte_store.Writable<GuidelyClient | null>;
10
10
  * when called during SSR (call it from `onMount` or use `@guidelytech/sveltekit`'s `initGuidely`).
11
11
  */
12
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;
13
21
  /** Destroys the current client and clears the store. */
14
22
  declare function destroyGuidely(): void;
15
23
  declare function setGuidelyContext(client: GuidelyClient | null): void;
@@ -33,4 +41,4 @@ declare function guidelyTarget(node: HTMLElement, id?: string): {
33
41
  destroy(): void;
34
42
  };
35
43
 
36
- export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext };
44
+ export { activeGuide, checklistProgress, createGuidely, destroyGuidely, getGuidelyContext, guideCompleted, guideTrigger, guidely, guidelyReady, guidelyTarget, setGuidelyContext, syncGuidelyUser };
package/dist/index.js CHANGED
@@ -10,8 +10,26 @@ function createGuidely(options) {
10
10
  existing?.destroy();
11
11
  const client = createCore(options);
12
12
  guidely.set(client);
13
+ if (pendingUser !== void 0) applyUser(client, pendingUser);
14
+ pendingUser = void 0;
13
15
  return client;
14
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
+ }
15
33
  function destroyGuidely() {
16
34
  get(guidely)?.destroy();
17
35
  guidely.set(null);
@@ -85,6 +103,7 @@ export {
85
103
  guidely,
86
104
  guidelyReady,
87
105
  guidelyTarget,
88
- setGuidelyContext
106
+ setGuidelyContext,
107
+ syncGuidelyUser
89
108
  };
90
109
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createGuidely as createCore, type ChecklistProgressState, type GuidelyClient, type GuidelyOptions, 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 return client;\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,kBAA6G;AACvI,SAAS,YAAY,kBAAkB;AACvC,SAAS,SAAS,KAAK,UAAU,gBAA+B;AAKzD,IAAM,UAAU,SAA+B,IAAI;AAMnD,SAAS,cAAc,SAAwC;AACpE,MAAI,OAAO,WAAW,YAAa,OAAM,IAAI,MAAM,oIAAoI;AACvL,QAAM,WAAW,IAAI,OAAO;AAC5B,MAAI,YAAY,CAAC,SAAS,SAAS,EAAE,aAAa,SAAS,QAAQ,cAAc,QAAQ,UAAW,QAAO;AAC3G,YAAU,QAAQ;AAClB,QAAM,SAAS,WAAW,OAAO;AACjC,UAAQ,IAAI,MAAM;AAClB,SAAO;AACT;AAGO,SAAS,iBAAuB;AACrC,MAAI,OAAO,GAAG,QAAQ;AACtB,UAAQ,IAAI,IAAI;AAClB;AAEA,IAAM,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AmB,KAA6D;AAC3G,MAAI,UAAU;AACd,QAAM,UAAU,CAAC,MAAa;AAC5B,MAAE,eAAe;AACjB,QAAI,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":[]}
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,IA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AAwB,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":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guidelytech/svelte",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Svelte stores, actions and client for Guidely",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,8 +20,8 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@guidelytech/sdk-core": "0.1.0",
24
- "@guidelytech/shared": "0.1.0"
23
+ "@guidelytech/sdk-core": "0.2.1",
24
+ "@guidelytech/shared": "0.2.1"
25
25
  },
26
26
  "devDependencies": {
27
27
  "tsup": "^8.5.1",