@strivacity/sdk-nuxt 3.0.0 → 3.0.2
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/CHANGELOG.md +20 -0
- package/README.md +63 -1
- package/dist/module.json +1 -1
- package/dist/runtime/login-renderer.vue +4 -2
- package/dist/runtime/login-renderer.vue.d.ts +4 -0
- package/package.json +2 -2
- /package/.nuxt/manifest/meta/{7ef5cbe0-d9c8-4c40-a2ac-1f1aea1b9ec5.json → b47927c0-b36b-4d2c-b650-8d55c5ec676a.json} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
## 3.0.2 (2026-05-12)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- language parameter added to the login renderer component ([c8f18d9](https://github.com/Strivacity/sdk-js/commit/c8f18d9))
|
|
6
|
+
|
|
7
|
+
### 🧱 Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated sdk-core to 3.0.2
|
|
10
|
+
|
|
11
|
+
## 3.0.1 (2026-04-20)
|
|
12
|
+
|
|
13
|
+
### 🩹 Fixes
|
|
14
|
+
|
|
15
|
+
- handle language parameter from response body url correctly ([e42294b](https://github.com/Strivacity/sdk-js/commit/e42294b))
|
|
16
|
+
|
|
17
|
+
### 🧱 Updated Dependencies
|
|
18
|
+
|
|
19
|
+
- Updated sdk-core to 3.0.1
|
|
20
|
+
|
|
1
21
|
# 3.0.0 (2026-04-09)
|
|
2
22
|
|
|
3
23
|
### 🚀 Features
|
package/README.md
CHANGED
|
@@ -230,7 +230,7 @@ export const widgets = {
|
|
|
230
230
|
|
|
231
231
|
#### Login page example
|
|
232
232
|
|
|
233
|
-
The login page extracts `session_id` from the URL on load, cleans up the URL, and passes
|
|
233
|
+
The login page extracts `session_id` and optionally `language` from the URL on load, cleans up the URL, and passes them to the renderer. When a `session_id` is present the renderer calls `startSession(sessionId)` to resume the existing flow instead of starting a new one. When a `language` parameter is present it is passed to the renderer which uses it for the authentication UI and emits the resolved language back via `v-model:language`.
|
|
234
234
|
|
|
235
235
|
```vue
|
|
236
236
|
<script setup lang="ts">
|
|
@@ -240,10 +240,16 @@ import { widgets } from '~/components/widgets';
|
|
|
240
240
|
|
|
241
241
|
const router = useRouter();
|
|
242
242
|
const sessionId = ref<string | null>(null);
|
|
243
|
+
const language = ref<string | null>(null);
|
|
243
244
|
|
|
244
245
|
if (window.location.search !== '') {
|
|
245
246
|
const url = new URL(window.location.href);
|
|
246
247
|
sessionId.value = url.searchParams.get('session_id');
|
|
248
|
+
|
|
249
|
+
if (url.searchParams.has('language')) {
|
|
250
|
+
language.value = url.searchParams.get('language');
|
|
251
|
+
}
|
|
252
|
+
|
|
247
253
|
url.search = '';
|
|
248
254
|
history.replaceState({}, '', url.toString());
|
|
249
255
|
}
|
|
@@ -276,6 +282,7 @@ const onBlockReady = ({ previousState, state }: { previousState: LoginFlowState;
|
|
|
276
282
|
|
|
277
283
|
<template>
|
|
278
284
|
<StyLoginRenderer
|
|
285
|
+
v-model:language="language"
|
|
279
286
|
:widgets="widgets"
|
|
280
287
|
:session-id="sessionId"
|
|
281
288
|
@fallback="onFallback"
|
|
@@ -446,6 +453,59 @@ export class MyLogger implements SDKLogging {
|
|
|
446
453
|
|
|
447
454
|
The `SDKLogging` interface requires `debug`, `info`, `warn`, and `error` methods. The optional `xEventId` property, when set by the SDK, provides a correlation ID to trace related log messages across the authentication flow.
|
|
448
455
|
|
|
456
|
+
## HTTP Client
|
|
457
|
+
|
|
458
|
+
The SDK uses a built-in `fetch`-based HTTP client for all requests. You can replace it with your own implementation by extending `SDKHttpClient` and passing your class via the `httpClient` option. This is useful when you need to attach custom headers (e.g. `x-sty-app-id`) to every outgoing request or route traffic through a proxy.
|
|
459
|
+
|
|
460
|
+
### Adding custom headers to every request
|
|
461
|
+
|
|
462
|
+
```typescript
|
|
463
|
+
// nuxt.config.ts
|
|
464
|
+
import { SDKHttpClient, type HttpClientResponse } from '@strivacity/sdk-nuxt';
|
|
465
|
+
|
|
466
|
+
class CustomHttpClient extends SDKHttpClient {
|
|
467
|
+
async request<T>(url: string, options?: RequestInit): Promise<HttpClientResponse<T>> {
|
|
468
|
+
const mergedOptions: RequestInit = {
|
|
469
|
+
...options,
|
|
470
|
+
headers: {
|
|
471
|
+
'x-sty-app-id': 'my-app',
|
|
472
|
+
...(options?.headers as Record<string, string>),
|
|
473
|
+
},
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
const response = await fetch(url, mergedOptions);
|
|
477
|
+
|
|
478
|
+
return {
|
|
479
|
+
headers: response.headers,
|
|
480
|
+
ok: response.ok,
|
|
481
|
+
status: response.status,
|
|
482
|
+
statusText: response.statusText,
|
|
483
|
+
url: response.url,
|
|
484
|
+
json: async () => (await response.json()) as T,
|
|
485
|
+
text: async () => await response.text(),
|
|
486
|
+
};
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export default defineNuxtConfig({
|
|
491
|
+
modules: ['@strivacity/sdk-nuxt'],
|
|
492
|
+
strivacity: {
|
|
493
|
+
// ...other options
|
|
494
|
+
httpClient: CustomHttpClient,
|
|
495
|
+
},
|
|
496
|
+
});
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
Any header you add inside `request()` is automatically included in every SDK request
|
|
500
|
+
|
|
501
|
+
### CORS configuration
|
|
502
|
+
|
|
503
|
+
For custom request headers to reach the Strivacity cluster, the cluster must be configured to explicitly allow them. Add the header name(s) to the **Access-Control-Allow-Headers** list in the cluster settings. Without this, browsers will block the preflight `OPTIONS` request and the SDK call will fail with a CORS error.
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
Access-Control-Allow-Headers: x-sty-app-id, <any other custom headers>
|
|
507
|
+
```
|
|
508
|
+
|
|
449
509
|
## API Documentation
|
|
450
510
|
|
|
451
511
|
### `useStrivacity` composable
|
|
@@ -515,6 +575,7 @@ Auto-imported in `native` mode to render the authentication UI with your own wid
|
|
|
515
575
|
- **`params?: NativeParams`**: Additional parameters for the native login flow.
|
|
516
576
|
- **`widgets?: PartialRecord<WidgetType, Vue.Component>`**: Custom Vue components for each widget type used in the flow.
|
|
517
577
|
- **`sessionId?: string | null`**: Session ID for resuming an existing authentication session.
|
|
578
|
+
- **`language?: string | null`**: Language tag (e.g. `"en-US"`) for the authentication UI. Defaults to `navigator.language`. Supports two-way binding via `v-model:language` — after the session starts the component emits the resolved language back to the parent. See the [Translations](https://docs.strivacity.com/docs/translations) page to learn about language precedence implemented by the product.
|
|
518
579
|
|
|
519
580
|
**Events**
|
|
520
581
|
|
|
@@ -523,6 +584,7 @@ Auto-imported in `native` mode to render the authentication UI with your own wid
|
|
|
523
584
|
- **`@error`**: Emitted when an error occurs during authentication.
|
|
524
585
|
- **`@global-message`**: Emitted when the flow wants to display a global message (e.g. account lockout warning).
|
|
525
586
|
- **`@block-ready`**: Emitted on flow state transitions. Receives `{ previousState: LoginFlowState; state: LoginFlowState }`. Useful for analytics and custom logging.
|
|
587
|
+
- **`@update:language`**: Emitted after the session starts with the resolved language string. Used automatically by `v-model:language`.
|
|
526
588
|
|
|
527
589
|
## Vulnerability Reporting
|
|
528
590
|
|
package/dist/module.json
CHANGED
|
@@ -7,9 +7,10 @@ const { sdk } = useStrivacity();
|
|
|
7
7
|
const props = defineProps({
|
|
8
8
|
params: { type: Object, required: false, default: () => ({}) },
|
|
9
9
|
widgets: { type: null, required: false, default: () => ({}) },
|
|
10
|
+
language: { type: [String, null], required: false, default: navigator.language },
|
|
10
11
|
sessionId: { type: [String, null], required: false, default: null }
|
|
11
12
|
});
|
|
12
|
-
const emit = defineEmits(["login", "fallback", "close", "error", "globalMessage", "blockReady"]);
|
|
13
|
+
const emit = defineEmits(["login", "fallback", "close", "error", "globalMessage", "blockReady", "update:language"]);
|
|
13
14
|
const WidgetRenderer = defineComponent({
|
|
14
15
|
props: {
|
|
15
16
|
items: {
|
|
@@ -69,7 +70,8 @@ provide("nativeFlowContext", {
|
|
|
69
70
|
});
|
|
70
71
|
onMounted(async () => {
|
|
71
72
|
try {
|
|
72
|
-
const data = await loginHandler.startSession(props.sessionId);
|
|
73
|
+
const data = await loginHandler.startSession(props.sessionId, props.language);
|
|
74
|
+
emit("update:language", loginHandler.language);
|
|
73
75
|
if (data) {
|
|
74
76
|
await handleResponse(data);
|
|
75
77
|
}
|
|
@@ -4,6 +4,7 @@ import { FallbackError } from '@strivacity/sdk-core';
|
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
params?: NativeParams;
|
|
6
6
|
widgets?: PartialRecord<WidgetType, Component>;
|
|
7
|
+
language?: string | null;
|
|
7
8
|
sessionId?: string | null;
|
|
8
9
|
};
|
|
9
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
@@ -16,6 +17,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
16
17
|
previousState: LoginFlowState;
|
|
17
18
|
state: LoginFlowState;
|
|
18
19
|
}) => any;
|
|
20
|
+
"update:language": (args_0: string | null) => any;
|
|
19
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
22
|
onLogin?: ((args_0: IdTokenClaims | null | undefined) => any) | undefined;
|
|
21
23
|
onError?: ((args_0: any) => any) | undefined;
|
|
@@ -26,9 +28,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
26
28
|
previousState: LoginFlowState;
|
|
27
29
|
state: LoginFlowState;
|
|
28
30
|
}) => any) | undefined;
|
|
31
|
+
"onUpdate:language"?: ((args_0: string | null) => any) | undefined;
|
|
29
32
|
}>, {
|
|
30
33
|
params: NativeParams;
|
|
31
34
|
widgets: PartialRecord<WidgetType, Component>;
|
|
35
|
+
language: string | null;
|
|
32
36
|
sessionId: string | null;
|
|
33
37
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
38
|
declare const _default: typeof __VLS_export;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strivacity/sdk-nuxt",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Strivacity Nuxt SDK client",
|
|
6
6
|
"author": "strivacity <opensource@strivacity.com>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@strivacity/sdk-core": "3.0.
|
|
13
|
+
"@strivacity/sdk-core": "3.0.2"
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/module.mjs",
|
|
16
16
|
"types": "./dist/types.d.mts",
|
|
File without changes
|