Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
"@knocklabs/types": "0.1.5",
"@knocklabs/typescript-config": "0.0.2"
},
"changesets": []
"changesets": [
"knockprovider-enabled-client",
"knockprovider-enabled-prop",
"use-knock-auth-state-reactive-integrations"
]
}
7 changes: 7 additions & 0 deletions examples/client-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# client-example

## 0.3.60-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- @knocklabs/client@0.22.0-rc.0

## 0.3.59

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/client-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "client-example",
"version": "0.3.59",
"version": "0.3.60-rc.0",
"private": true,
"type": "module",
"dependencies": {
Expand Down
8 changes: 8 additions & 0 deletions examples/expo-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @knocklabs/expo-example

## 1.1.10-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/expo@0.7.0-rc.0

## 1.1.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/expo-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@knocklabs/expo-example",
"main": "expo-router/entry",
"version": "1.1.9",
"version": "1.1.10-rc.0",
"scripts": {
"start": "expo start",
"android": "expo start --android",
Expand Down
10 changes: 10 additions & 0 deletions examples/guide-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# guide-example

## 0.0.85-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/client@0.22.0-rc.0
- @knocklabs/react@0.12.0-rc.0

## 0.0.84

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/guide-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "guide-example",
"private": true,
"version": "0.0.84",
"version": "0.0.85-rc.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
8 changes: 8 additions & 0 deletions examples/ms-teams-connect-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ms-teams-connect-example

## 0.0.72-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/react@0.12.0-rc.0

## 0.0.71

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/ms-teams-connect-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ms-teams-connect-example",
"version": "0.0.71",
"version": "0.0.72-rc.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -11,7 +11,7 @@
"format:check": "prettier \"**/*.{js,ts,tsx}\" --check"
},
"dependencies": {
"@knocklabs/react": "0.11.24",
"@knocklabs/react": "0.12.0-rc.0",
"jsonwebtoken": "^9.0.3",
"next": "15.3.6",
"react": "^19.2.7",
Expand Down
8 changes: 8 additions & 0 deletions examples/nextjs-app-dir-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# nextjs-app-dir-example

## 0.0.71-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/react@0.12.0-rc.0

## 0.0.70

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-app-dir-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-app-dir-example",
"version": "0.0.70",
"version": "0.0.71-rc.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
Expand Down
8 changes: 8 additions & 0 deletions examples/nextjs-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# nextjs-example

## 1.2.37-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/react@0.12.0-rc.0

## 1.2.36

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nextjs-example",
"version": "1.2.36",
"version": "1.2.37-rc.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand Down
8 changes: 8 additions & 0 deletions examples/slack-connect-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# slack-connect-example

## 0.3.71-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/react@0.12.0-rc.0

## 0.3.70

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/slack-connect-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-connect-example",
"version": "0.3.70",
"version": "0.3.71-rc.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -11,7 +11,7 @@
"format:check": "prettier \"**/*.{js,ts,tsx}\" --check"
},
"dependencies": {
"@knocklabs/react": "0.11.24",
"@knocklabs/react": "0.12.0-rc.0",
"jsonwebtoken": "^9.0.3",
"next": "15.3.6",
"react": "^19.2.7",
Expand Down
8 changes: 8 additions & 0 deletions examples/slack-kit-example/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# slack-kit-example

## 0.4.69-rc.0

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/react@0.12.0-rc.0

## 0.4.68

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions examples/slack-kit-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-kit-example",
"version": "0.4.68",
"version": "0.4.69-rc.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -12,7 +12,7 @@
},
"dependencies": {
"@knocklabs/node": "^1.30.0",
"@knocklabs/react": "0.11.24",
"@knocklabs/react": "0.12.0-rc.0",
"jsonwebtoken": "^9.0.3",
"next": "15.3.6",
"react": "^19.2.7",
Expand Down
14 changes: 14 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## 0.22.0-rc.0

### Minor Changes

- d2f7948: Make the client do nothing (instead of throwing or making requests) when there's no signed-in user, and add tools to manage sign-in state.

- New `Knock.logout()` clears the user and disconnects everything: the websocket, the token-refresh timer, and the page-visibility listener.
- New `knock.authStatus` (`"authenticated"` or `"unauthenticated"`) and a subscribable `knock.authStore` to check or react to whether a user is signed in.
- With no signed-in user, these now do nothing instead of throwing or calling the API:
- Feed `markAs*` / `markAll*` / `fetchNextPage` (they also skip the optimistic UI update).
- Guides `fetch` / `subscribe` and the step actions. These previously threw, which could crash the app when Guides rendered before a user was set.
- Slack/MS Teams `authCheck` (returns "not connected"), `getChannels` / `getTeams` (return empty), and `messages.batchUpdateStatuses` (returns `[]`).
- Fixes two Guide bugs: real-time updates broke after a re-login (a stale socket reference), and the `history` patch used for location tracking broke when a Guide provider remounted.

## 0.21.15

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@knocklabs/client",
"version": "0.21.15",
"version": "0.22.0-rc.0",
"description": "The clientside library for interacting with Knock",
"homepage": "https://github.com/knocklabs/javascript/tree/main/packages/client",
"author": "@knocklabs",
Expand Down
39 changes: 39 additions & 0 deletions packages/expo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# @knocklabs/expo

## 0.7.0-rc.0

### Minor Changes

- d2f7948: Add an `enabled` prop to `KnockProvider` (and an `enabled` option to `useAuthenticatedKnockClient`).

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.

Use this instead of conditionally mounting `KnockProvider`, for example to wait for a user token that loads asynchronously:

```tsx
<KnockProvider
apiKey={apiKey}
user={{ id: userId }}
userToken={userToken}
enabled={Boolean(userId && userToken)}
/>
```

Also fixed:

- `useFeedSettings` no longer calls `GET /v1/users/undefined/feeds/.../settings` when there's no user.
- `KnockProvider` now disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.

- d2f7948: Add `useKnockAuthState()` and make Slack, MS Teams, and Expo respond to sign-in changes.

- New `useKnockAuthState(knock)` hook re-renders when the user signs in, signs out, or switches.
- Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- 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.

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/client@0.22.0-rc.0
- @knocklabs/react-core@0.14.0-rc.0
- @knocklabs/react-native@0.10.0-rc.0

## 0.6.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@knocklabs/expo",
"version": "0.6.9",
"version": "0.7.0-rc.0",
"author": "@knocklabs",
"license": "MIT",
"main": "dist/cjs/index.js",
Expand Down
35 changes: 35 additions & 0 deletions packages/react-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
# Changelog

## 0.14.0-rc.0

### Minor Changes

- d2f7948: Add an `enabled` prop to `KnockProvider` (and an `enabled` option to `useAuthenticatedKnockClient`).

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.

Use this instead of conditionally mounting `KnockProvider`, for example to wait for a user token that loads asynchronously:

```tsx
<KnockProvider
apiKey={apiKey}
user={{ id: userId }}
userToken={userToken}
enabled={Boolean(userId && userToken)}
/>
```

Also fixed:

- `useFeedSettings` no longer calls `GET /v1/users/undefined/feeds/.../settings` when there's no user.
- `KnockProvider` now disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.

- d2f7948: Add `useKnockAuthState()` and make Slack, MS Teams, and Expo respond to sign-in changes.

- New `useKnockAuthState(knock)` hook re-renders when the user signs in, signs out, or switches.
- Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- 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.

### Patch Changes

- Updated dependencies [d2f7948]
- @knocklabs/client@0.22.0-rc.0

## 0.13.16

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@knocklabs/react-core",
"description": "A set of React components to build notification experiences powered by Knock",
"author": "@knocklabs",
"version": "0.13.16",
"version": "0.14.0-rc.0",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
Expand Down
38 changes: 38 additions & 0 deletions packages/react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,43 @@
# Changelog

## 0.10.0-rc.0

### Minor Changes

- d2f7948: Add an `enabled` prop to `KnockProvider` (and an `enabled` option to `useAuthenticatedKnockClient`).

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.

Use this instead of conditionally mounting `KnockProvider`, for example to wait for a user token that loads asynchronously:

```tsx
<KnockProvider
apiKey={apiKey}
user={{ id: userId }}
userToken={userToken}
enabled={Boolean(userId && userToken)}
/>
```

Also fixed:

- `useFeedSettings` no longer calls `GET /v1/users/undefined/feeds/.../settings` when there's no user.
- `KnockProvider` now disconnects its client (websocket, token-refresh timer, listener) when it unmounts, instead of leaving them running.

- d2f7948: Add `useKnockAuthState()` and make Slack, MS Teams, and Expo respond to sign-in changes.

- New `useKnockAuthState(knock)` hook re-renders when the user signs in, signs out, or switches.
- Slack and MS Teams connection status now re-checks when the user changes, instead of checking once and sticking with that result.
- 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.

### Patch Changes

- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- Updated dependencies [d2f7948]
- @knocklabs/client@0.22.0-rc.0
- @knocklabs/react-core@0.14.0-rc.0

## 0.9.9

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@knocklabs/react-native",
"version": "0.9.9",
"version": "0.10.0-rc.0",
"author": "@knocklabs",
"license": "MIT",
"main": "dist/cjs/index.js",
Expand Down
Loading
Loading