Skip to content

Releases: knocklabs/javascript

@knocklabs/react@0.12.0

Choose a tag to compare

Minor Changes

  • e8567eb: 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:

    <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.
  • e8567eb: 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 [e8567eb]
  • Updated dependencies [e8567eb]
  • Updated dependencies [e8567eb]
    • @knocklabs/client@0.22.0
    • @knocklabs/react-core@0.14.0

@knocklabs/react-native@0.10.0

Choose a tag to compare

Minor Changes

  • e8567eb: 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:

    <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.
  • e8567eb: 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 [e8567eb]
  • Updated dependencies [e8567eb]
  • Updated dependencies [e8567eb]
    • @knocklabs/client@0.22.0
    • @knocklabs/react-core@0.14.0

@knocklabs/react-core@0.14.0

Choose a tag to compare

Minor Changes

  • e8567eb: 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:

    <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.
  • e8567eb: 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 [e8567eb]
    • @knocklabs/client@0.22.0

@knocklabs/expo@0.7.0

Choose a tag to compare

Minor Changes

  • e8567eb: 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:

    <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.
  • e8567eb: 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

  • e8567eb: Fix Expo push auto-registration not re-running when the signed-in user changes in place. The auto-register effect now depends on the authenticated userId, so switching users on the same KnockProvider (where isAuthenticated never flips) re-registers the device token against the new user's channel data.
  • Updated dependencies [e8567eb]
  • Updated dependencies [e8567eb]
  • Updated dependencies [e8567eb]
    • @knocklabs/client@0.22.0
    • @knocklabs/react-core@0.14.0
    • @knocklabs/react-native@0.10.0

@knocklabs/client@0.22.0

Choose a tag to compare

Minor Changes

  • e8567eb: 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.

@knocklabs/expo@0.7.0-rc.1

Pre-release

Choose a tag to compare

@knock-eng-bot knock-eng-bot released this 14 Jul 16:49
703d5bf

Patch Changes

  • 6414414: Fix Expo push auto-registration not re-running when the signed-in user changes in place. The auto-register effect now depends on the authenticated userId, so switching users on the same KnockProvider (where isAuthenticated never flips) re-registers the device token against the new user's channel data.

@knocklabs/react@0.11.24

Choose a tag to compare

@knock-eng-bot knock-eng-bot released this 10 Jul 19:03
806f37a

Patch Changes

  • Updated dependencies [3d7a041]
    • @knocklabs/client@0.21.15
    • @knocklabs/react-core@0.13.16

@knocklabs/react-native@0.9.9

Choose a tag to compare

@knock-eng-bot knock-eng-bot released this 10 Jul 19:03
806f37a

Patch Changes

  • Updated dependencies [3d7a041]
    • @knocklabs/client@0.21.15
    • @knocklabs/react-core@0.13.16

@knocklabs/react-core@0.13.16

Choose a tag to compare

@knock-eng-bot knock-eng-bot released this 10 Jul 19:03
806f37a

Patch Changes

  • Updated dependencies [3d7a041]
    • @knocklabs/client@0.21.15

@knocklabs/expo@0.6.9

Choose a tag to compare

@knock-eng-bot knock-eng-bot released this 10 Jul 19:03
806f37a

Patch Changes

  • Updated dependencies [3d7a041]
    • @knocklabs/client@0.21.15
    • @knocklabs/react-core@0.13.16
    • @knocklabs/react-native@0.9.9