@strivacity/sdk-nuxt 4.0.0-beta.0 → 4.0.0-beta.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.
@@ -122,7 +122,7 @@
122
122
  "./imports"
123
123
  ],
124
124
  "#app-manifest": [
125
- "./manifest/meta/cb11df97-b0c9-4a91-9d4b-60c25c918599.json"
125
+ "./manifest/meta/b2d6b125-90fd-44d4-9916-0898f71676da.json"
126
126
  ],
127
127
  "#components": [
128
128
  "./components"
@@ -122,7 +122,7 @@
122
122
  "./imports"
123
123
  ],
124
124
  "#app-manifest": [
125
- "./manifest/meta/cb11df97-b0c9-4a91-9d4b-60c25c918599.json"
125
+ "./manifest/meta/b2d6b125-90fd-44d4-9916-0898f71676da.json"
126
126
  ],
127
127
  "#components": [
128
128
  "./components"
@@ -122,7 +122,7 @@
122
122
  "./imports"
123
123
  ],
124
124
  "#app-manifest": [
125
- "./manifest/meta/cb11df97-b0c9-4a91-9d4b-60c25c918599.json"
125
+ "./manifest/meta/b2d6b125-90fd-44d4-9916-0898f71676da.json"
126
126
  ],
127
127
  "#build": [
128
128
  "."
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@strivacity/sdk-nuxt",
3
3
  "configKey": "strivacity",
4
- "version": "4.0.0-beta.0",
4
+ "version": "4.0.0-beta.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -1,7 +1,7 @@
1
1
  import { STRIVACITY_LOGIN_CONTEXT } from "./use-native-login-context.js";
2
2
  import { provide, ref, onMounted, onUnmounted } from "vue";
3
3
  import { FallbackError } from "@strivacity/sdk-core/utils/errors";
4
- import { unflattenObject } from "@strivacity/sdk-core/utils";
4
+ import { isSessionExpired, unflattenObject } from "@strivacity/sdk-core/utils";
5
5
  import { useStrivacity } from "./use-strivacity.js";
6
6
  export function useNativeLogin(options = {}) {
7
7
  const abortController = new AbortController();
@@ -25,7 +25,7 @@ export function useNativeLogin(options = {}) {
25
25
  });
26
26
  onUnmounted(() => abortController.abort());
27
27
  function handleResponse(nextState) {
28
- if (sdk.session) {
28
+ if (sdk.session && !isSessionExpired(sdk.session)) {
29
29
  return void options.onLogin?.(sdk.session);
30
30
  }
31
31
  const newState = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strivacity/sdk-nuxt",
3
- "version": "4.0.0-beta.0",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "Strivacity Nuxt SDK client",
5
5
  "license": "MIT",
6
6
  "author": "strivacity <opensource@strivacity.com>",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@strivacity/sdk-core": "4.0.0-beta.0"
45
+ "@strivacity/sdk-core": "4.0.0-beta.1"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "nuxt": ">=4.0"
@@ -3,7 +3,7 @@ import type { LoginContext, UseNativeLoginOptions } from '../types';
3
3
  import { STRIVACITY_LOGIN_CONTEXT, type useNativeLoginContext } from './use-native-login-context';
4
4
  import { provide, ref, onMounted, onUnmounted } from 'vue';
5
5
  import { FallbackError } from '@strivacity/sdk-core/utils/errors';
6
- import { unflattenObject } from '@strivacity/sdk-core/utils';
6
+ import { isSessionExpired, unflattenObject } from '@strivacity/sdk-core/utils';
7
7
  import { useStrivacity } from './use-strivacity';
8
8
 
9
9
  /**
@@ -41,7 +41,7 @@ export function useNativeLogin(options: UseNativeLoginOptions = {}): ReturnType<
41
41
  onUnmounted(() => abortController.abort());
42
42
 
43
43
  function handleResponse(nextState: Partial<NativeFlowState>) {
44
- if (sdk.session) {
44
+ if (sdk.session && !isSessionExpired(sdk.session)) {
45
45
  return void options.onLogin?.(sdk.session);
46
46
  }
47
47
 
@@ -330,7 +330,7 @@ describe('useNativeLogin', () => {
330
330
  });
331
331
 
332
332
  test('calls onLogin and leaves the tracked state untouched when the sdk already has a session', async () => {
333
- const session = { access_token: 'access-token' } as unknown as SessionData;
333
+ const session = { access_token: 'access-token', expires_at: Math.floor(Date.now() / 1000) + 3600 } as unknown as SessionData;
334
334
  vi.doMock('../../src/runtime/composables/use-session', () => ({ useSession: () => ({ value: session }) }));
335
335
 
336
336
  const sdk = createMockFlow<NativeFlow>();