@knocklabs/react 0.12.0-rc.0 → 0.12.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.
Files changed (2) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e8567eb: Add an `enabled` prop to `KnockProvider` (and an `enabled` option to `useAuthenticatedKnockClient`).
8
+
9
+ When `enabled` is `false`, the provider still renders its children but the Knock client sits idle: no identify call, no API requests, no websocket. Set it to `true` and it connects like a login; set it back to `false` and it disconnects and clears its data like a logout. It defaults to `true`, so existing code is unaffected.
10
+
11
+ Use this instead of conditionally mounting `KnockProvider`, for example to wait for a user token that loads asynchronously:
12
+
13
+ ```tsx
14
+ <KnockProvider
15
+ apiKey={apiKey}
16
+ user={{ id: userId }}
17
+ userToken={userToken}
18
+ enabled={Boolean(userId && userToken)}
19
+ />
20
+ ```
21
+
22
+ Also fixed:
23
+
24
+ - `useFeedSettings` no longer calls `GET /v1/users/undefined/feeds/.../settings` when there's no user.
25
+ - `KnockProvider` now disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.
26
+
27
+ - e8567eb: Add `useKnockAuthState()` and make Slack, MS Teams, and Expo respond to sign-in changes.
28
+
29
+ - New `useKnockAuthState(knock)` hook re-renders when the user signs in, signs out, or switches.
30
+ - Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
31
+ - Expo waits for a signed-in user before registering for push notifications, so logged-out users don't see the OS permission prompt. A notification tapped while logged out no longer tries to update its status.
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [e8567eb]
36
+ - Updated dependencies [e8567eb]
37
+ - Updated dependencies [e8567eb]
38
+ - @knocklabs/client@0.22.0
39
+ - @knocklabs/react-core@0.14.0
40
+
3
41
  ## 0.12.0-rc.0
4
42
 
5
43
  ### Minor Changes
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@knocklabs/react",
3
3
  "description": "A set of React components to build notification experiences powered by Knock",
4
4
  "author": "@knocklabs",
5
- "version": "0.12.0-rc.0",
5
+ "version": "0.12.0",
6
6
  "license": "MIT",
7
7
  "main": "dist/cjs/index.js",
8
8
  "module": "dist/esm/index.mjs",
@@ -73,8 +73,8 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@knocklabs/client": "^0.22.0-rc.0",
77
- "@knocklabs/react-core": "^0.14.0-rc.0",
76
+ "@knocklabs/client": "^0.22.0",
77
+ "@knocklabs/react-core": "^0.14.0",
78
78
  "@popperjs/core": "^2.11.8",
79
79
  "@radix-ui/react-dialog": "^1.1.15",
80
80
  "@radix-ui/react-hover-card": "^1.1.15",