@guidelytech/sveltekit 0.5.0 → 0.6.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 +21 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -17,14 +17,34 @@ pnpm add @guidelytech/sveltekit
|
|
|
17
17
|
initGuidely({ ...guidelyEnv(env), debug: import.meta.env.DEV });
|
|
18
18
|
|
|
19
19
|
// data.user from +layout.server.ts — identifies on sign-in/change, resets on sign-out.
|
|
20
|
-
$effect(() =>
|
|
20
|
+
$effect(() =>
|
|
21
|
+
syncGuidelyUser(
|
|
22
|
+
data.user
|
|
23
|
+
? {
|
|
24
|
+
id: String(data.user.id),
|
|
25
|
+
traits: { name: data.user.name, email: data.user.email, role: data.user.role },
|
|
26
|
+
account: { id: String(data.user.companyId), traits: { name: data.user.companyName } },
|
|
27
|
+
}
|
|
28
|
+
: null,
|
|
29
|
+
),
|
|
30
|
+
);
|
|
21
31
|
</script>
|
|
22
32
|
|
|
23
33
|
{@render children()}
|
|
24
34
|
```
|
|
25
35
|
|
|
36
|
+
```ts
|
|
37
|
+
// src/routes/+layout.server.ts
|
|
38
|
+
export const load = ({ locals }) => ({ user: locals.user ?? null });
|
|
39
|
+
```
|
|
40
|
+
|
|
26
41
|
Page views are tracked automatically on every navigation; users are anonymous until identified.
|
|
27
42
|
|
|
43
|
+
The `name` and `email` traits are what the dashboard's Users list shows and searches, so send them
|
|
44
|
+
when you have them (otherwise users appear by id only). An account's `name` trait labels the
|
|
45
|
+
Account column. Traits merge on each identify, so existing users pick up their name and email the
|
|
46
|
+
next time they load the app.
|
|
47
|
+
|
|
28
48
|
| Export | Description |
|
|
29
49
|
|---|---|
|
|
30
50
|
| `initGuidely(options)` | Call once during root layout initialisation. Returns the client in the browser, `null` on the server. Uses `afterNavigate` from `$app/navigation` to call `page()` and destroys the client when the layout is destroyed. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guidelytech/sveltekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "SvelteKit helpers 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/svelte": "0.
|
|
24
|
-
"@guidelytech/sdk-core": "0.
|
|
23
|
+
"@guidelytech/svelte": "0.6.1",
|
|
24
|
+
"@guidelytech/sdk-core": "0.6.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsup": "^8.5.1",
|