@strivacity/sdk-nuxt 2.1.2 → 2.2.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.
- package/.nuxt/nuxt.d.ts +2 -2
- package/.nuxt/nuxt.node.d.ts +1 -2
- package/.nuxt/strivacity-sdk-logging.d.ts +13 -0
- package/.nuxt/strivacity-sdk-logging.mjs +1 -0
- package/.nuxt/types/modules.d.ts +2 -22
- package/CHANGELOG.md +15 -0
- package/README.md +88 -0
- package/dist/module.d.mts +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +21 -0
- package/dist/module.mjs.map +1 -1
- package/dist/runtime/composables.d.ts +1 -1
- package/dist/runtime/composables.js +2 -1
- package/dist/runtime/login-renderer.vue +12 -7
- package/dist/types.d.mts +2 -0
- package/package.json +2 -2
- /package/.nuxt/manifest/meta/{4b6c7a2a-83c6-4fad-a545-f8cfc2c7cbdf.json → a41f6cc8-433d-4287-b51e-946204a91660.json} +0 -0
package/.nuxt/nuxt.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="./src" />
|
|
2
|
-
/// <reference types="@strivacity/sdk-nuxt" />
|
|
3
2
|
/// <reference types="@nuxt/devtools" />
|
|
4
|
-
/// <reference types="@nuxt
|
|
3
|
+
/// <reference types="@strivacity/sdk-nuxt" />
|
|
5
4
|
/// <reference path="types/builder-env.d.ts" />
|
|
6
5
|
/// <reference path="types/plugins.d.ts" />
|
|
7
6
|
/// <reference path="types/build.d.ts" />
|
|
@@ -10,6 +9,7 @@
|
|
|
10
9
|
/// <reference types="nuxt/app" />
|
|
11
10
|
/// <reference types="/home/runner/work/sdk-js/sdk-js/node_modules/.pnpm/@nuxt+nitro-server@4.2.1_@capacitor+preferences@7.0.2_@capacitor+core@7.4.4__db0@0.3.4__a3a53caef1516cc79201461eb04c532f/node_modules/@nuxt/nitro-server/dist/index.mjs" />
|
|
12
11
|
/// <reference path="strivacity-sdk-storage.d.ts" />
|
|
12
|
+
/// <reference path="strivacity-sdk-logging.d.ts" />
|
|
13
13
|
/// <reference path="types/middleware.d.ts" />
|
|
14
14
|
/// <reference path="types/components.d.ts" />
|
|
15
15
|
/// <reference path="imports.d.ts" />
|
package/.nuxt/nuxt.node.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="./src" />
|
|
2
|
-
/// <reference types="@strivacity/sdk-nuxt" />
|
|
3
2
|
/// <reference types="@nuxt/devtools" />
|
|
4
|
-
/// <reference types="@nuxt
|
|
3
|
+
/// <reference types="@strivacity/sdk-nuxt" />
|
|
5
4
|
/// <reference path="types/modules.d.ts" />
|
|
6
5
|
/// <reference path="types/runtime-config.d.ts" />
|
|
7
6
|
/// <reference path="types/app.config.d.ts" />
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import type { SDKLogging } from '@strivacity/sdk-core';
|
|
3
|
+
|
|
4
|
+
declare class CustomLogging implements SDKLogging {
|
|
5
|
+
xEventId: string | undefined;
|
|
6
|
+
|
|
7
|
+
debug(message: string): void;
|
|
8
|
+
info(message: string): void;
|
|
9
|
+
warn(message: string): void;
|
|
10
|
+
error(message: string, error: Error): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default CustomLogging
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default undefined
|
package/.nuxt/types/modules.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ declare module '@nuxt/schema' {
|
|
|
3
3
|
interface ModuleDependencies {
|
|
4
4
|
["./../../src"]?: ModuleDependencyMeta<typeof import("./../../src").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
5
5
|
["@nuxt/devtools"]?: ModuleDependencyMeta<typeof import("@nuxt/devtools").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
6
|
-
["@nuxt/telemetry"]?: ModuleDependencyMeta<typeof import("@nuxt/telemetry").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
7
6
|
}
|
|
8
7
|
interface NuxtOptions {
|
|
9
8
|
/**
|
|
@@ -14,10 +13,6 @@ declare module '@nuxt/schema' {
|
|
|
14
13
|
* Configuration for `@nuxt/devtools`
|
|
15
14
|
*/
|
|
16
15
|
["devtools"]: typeof import("@nuxt/devtools").default extends NuxtModule<infer O, unknown, boolean> ? O : Record<string, any>
|
|
17
|
-
/**
|
|
18
|
-
* Configuration for `@nuxt/telemetry`
|
|
19
|
-
*/
|
|
20
|
-
["telemetry"]: typeof import("@nuxt/telemetry").default extends NuxtModule<infer O, unknown, boolean> ? O : Record<string, any>
|
|
21
16
|
}
|
|
22
17
|
interface NuxtConfig {
|
|
23
18
|
/**
|
|
@@ -28,18 +23,13 @@ declare module '@nuxt/schema' {
|
|
|
28
23
|
* Configuration for `@nuxt/devtools`
|
|
29
24
|
*/
|
|
30
25
|
["devtools"]?: typeof import("@nuxt/devtools").default extends NuxtModule<infer O, unknown, boolean> ? Partial<O> : Record<string, any>
|
|
31
|
-
|
|
32
|
-
* Configuration for `@nuxt/telemetry`
|
|
33
|
-
*/
|
|
34
|
-
["telemetry"]?: typeof import("@nuxt/telemetry").default extends NuxtModule<infer O, unknown, boolean> ? Partial<O> : Record<string, any>
|
|
35
|
-
modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ["./../../src", Exclude<NuxtConfig["strivacity"], boolean>] | ["@nuxt/devtools", Exclude<NuxtConfig["devtools"], boolean>] | ["@nuxt/telemetry", Exclude<NuxtConfig["telemetry"], boolean>])[],
|
|
26
|
+
modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ["./../../src", Exclude<NuxtConfig["strivacity"], boolean>] | ["@nuxt/devtools", Exclude<NuxtConfig["devtools"], boolean>])[],
|
|
36
27
|
}
|
|
37
28
|
}
|
|
38
29
|
declare module 'nuxt/schema' {
|
|
39
30
|
interface ModuleDependencies {
|
|
40
31
|
["./../../src"]?: ModuleDependencyMeta<typeof import("./../../src").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
41
32
|
["@nuxt/devtools"]?: ModuleDependencyMeta<typeof import("@nuxt/devtools").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
42
|
-
["@nuxt/telemetry"]?: ModuleDependencyMeta<typeof import("@nuxt/telemetry").default extends NuxtModule<infer O> ? O : Record<string, unknown>>
|
|
43
33
|
}
|
|
44
34
|
interface NuxtOptions {
|
|
45
35
|
/**
|
|
@@ -52,11 +42,6 @@ declare module 'nuxt/schema' {
|
|
|
52
42
|
* @see https://www.npmjs.com/package/@nuxt/devtools
|
|
53
43
|
*/
|
|
54
44
|
["devtools"]: typeof import("@nuxt/devtools").default extends NuxtModule<infer O, unknown, boolean> ? O : Record<string, any>
|
|
55
|
-
/**
|
|
56
|
-
* Configuration for `@nuxt/telemetry`
|
|
57
|
-
* @see https://www.npmjs.com/package/@nuxt/telemetry
|
|
58
|
-
*/
|
|
59
|
-
["telemetry"]: typeof import("@nuxt/telemetry").default extends NuxtModule<infer O, unknown, boolean> ? O : Record<string, any>
|
|
60
45
|
}
|
|
61
46
|
interface NuxtConfig {
|
|
62
47
|
/**
|
|
@@ -69,11 +54,6 @@ declare module 'nuxt/schema' {
|
|
|
69
54
|
* @see https://www.npmjs.com/package/@nuxt/devtools
|
|
70
55
|
*/
|
|
71
56
|
["devtools"]?: typeof import("@nuxt/devtools").default extends NuxtModule<infer O, unknown, boolean> ? Partial<O> : Record<string, any>
|
|
72
|
-
|
|
73
|
-
* Configuration for `@nuxt/telemetry`
|
|
74
|
-
* @see https://www.npmjs.com/package/@nuxt/telemetry
|
|
75
|
-
*/
|
|
76
|
-
["telemetry"]?: typeof import("@nuxt/telemetry").default extends NuxtModule<infer O, unknown, boolean> ? Partial<O> : Record<string, any>
|
|
77
|
-
modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ["./../../src", Exclude<NuxtConfig["strivacity"], boolean>] | ["@nuxt/devtools", Exclude<NuxtConfig["devtools"], boolean>] | ["@nuxt/telemetry", Exclude<NuxtConfig["telemetry"], boolean>])[],
|
|
57
|
+
modules?: (undefined | null | false | NuxtModule<any> | string | [NuxtModule | string, Record<string, any>] | ["./../../src", Exclude<NuxtConfig["strivacity"], boolean>] | ["@nuxt/devtools", Exclude<NuxtConfig["devtools"], boolean>])[],
|
|
78
58
|
}
|
|
79
59
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## 2.2.0 (2026-02-06)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- logging implemented ([032dc8a](https://github.com/Strivacity/sdk-js/commit/032dc8a))
|
|
6
|
+
|
|
7
|
+
### 🩹 Fixes
|
|
8
|
+
|
|
9
|
+
- error message rendering fixed ([9e67051](https://github.com/Strivacity/sdk-js/commit/9e67051))
|
|
10
|
+
- minor sdk type fixes ([3434a90](https://github.com/Strivacity/sdk-js/commit/3434a90))
|
|
11
|
+
|
|
12
|
+
### 🧱 Updated Dependencies
|
|
13
|
+
|
|
14
|
+
- Updated sdk-core to 2.2.0
|
|
15
|
+
|
|
1
16
|
## 2.1.2 (2026-01-13)
|
|
2
17
|
|
|
3
18
|
### 🧱 Updated Dependencies
|
package/README.md
CHANGED
|
@@ -382,6 +382,94 @@ Same as the profile page example in redirect/popup mode.
|
|
|
382
382
|
|
|
383
383
|
Same as the logout page example in redirect/popup mode.
|
|
384
384
|
|
|
385
|
+
## Logging
|
|
386
|
+
|
|
387
|
+
The SDK supports optional logging to help you debug authentication flows and monitor SDK behavior. You can enable the built-in console logger or provide your own custom logger implementation.
|
|
388
|
+
|
|
389
|
+
### Using the Default Logger
|
|
390
|
+
|
|
391
|
+
Enable the default console logger by adding the `logging` option in your Nuxt configuration:
|
|
392
|
+
|
|
393
|
+
```typescript
|
|
394
|
+
import { defineNuxtConfig } from 'nuxt/config';
|
|
395
|
+
import { DefaultLogging } from '@strivacity/sdk-nuxt';
|
|
396
|
+
|
|
397
|
+
export default defineNuxtConfig({
|
|
398
|
+
ssr: false,
|
|
399
|
+
modules: ['@strivacity/sdk-nuxt'],
|
|
400
|
+
strivacity: {
|
|
401
|
+
mode: 'redirect',
|
|
402
|
+
issuer: 'https://<YOUR_DOMAIN>',
|
|
403
|
+
scopes: ['openid', 'profile'],
|
|
404
|
+
clientId: '<YOUR_CLIENT_ID>',
|
|
405
|
+
redirectUri: '<YOUR_REDIRECT_URI>',
|
|
406
|
+
logging: DefaultLogging, // Enable built-in console logging
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
The default logger writes to the browser console and automatically prefixes messages with a correlation ID when available (via the `xEventId` property).
|
|
412
|
+
|
|
413
|
+
### Creating a Custom Logger
|
|
414
|
+
|
|
415
|
+
You can provide your own logger by implementing the `SDKLogging` interface with four methods: `debug`, `info`, `warn`, and `error`. An optional `xEventId` property is honored for log correlation.
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
import type { SDKLogging } from '@strivacity/sdk-nuxt';
|
|
419
|
+
|
|
420
|
+
export class MyLogger implements SDKLogging {
|
|
421
|
+
xEventId?: string;
|
|
422
|
+
|
|
423
|
+
debug(message: string): void {
|
|
424
|
+
// Send to your logging pipeline
|
|
425
|
+
console.debug(this.xEventId ? `[${this.xEventId}] ${message}` : message);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
info(message: string): void {
|
|
429
|
+
console.info(this.xEventId ? `[${this.xEventId}] ${message}` : message);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
warn(message: string): void {
|
|
433
|
+
console.warn(this.xEventId ? `[${this.xEventId}] ${message}` : message);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
error(message: string, error: Error): void {
|
|
437
|
+
console.error(this.xEventId ? `[${this.xEventId}] ${message}` : message, error);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
```
|
|
441
|
+
|
|
442
|
+
Then register your custom logger in your Nuxt configuration:
|
|
443
|
+
|
|
444
|
+
```typescript
|
|
445
|
+
import { defineNuxtConfig } from 'nuxt/config';
|
|
446
|
+
import { MyLogger } from './logging/MyLogger';
|
|
447
|
+
|
|
448
|
+
export default defineNuxtConfig({
|
|
449
|
+
ssr: false,
|
|
450
|
+
modules: ['@strivacity/sdk-nuxt'],
|
|
451
|
+
strivacity: {
|
|
452
|
+
mode: 'redirect',
|
|
453
|
+
issuer: 'https://<YOUR_DOMAIN>',
|
|
454
|
+
scopes: ['openid', 'profile'],
|
|
455
|
+
clientId: '<YOUR_CLIENT_ID>',
|
|
456
|
+
redirectUri: '<YOUR_REDIRECT_URI>',
|
|
457
|
+
logging: MyLogger, // Use your custom logger
|
|
458
|
+
},
|
|
459
|
+
});
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### Logger Interface
|
|
463
|
+
|
|
464
|
+
The `SDKLogging` interface requires the following methods:
|
|
465
|
+
|
|
466
|
+
- **`debug(message: string): void`** - Log debug-level messages
|
|
467
|
+
- **`info(message: string): void`** - Log informational messages
|
|
468
|
+
- **`warn(message: string): void`** - Log warning messages
|
|
469
|
+
- **`error(message: string, error: Error): void`** - Log error messages with error objects
|
|
470
|
+
|
|
471
|
+
The optional `xEventId` property, when set by the SDK, provides a correlation ID to trace related log messages across the authentication flow.
|
|
472
|
+
|
|
385
473
|
### API Documentation
|
|
386
474
|
|
|
387
475
|
#### `useStrivacity` composable
|
package/dist/module.d.mts
CHANGED
|
@@ -8,6 +8,7 @@ export { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';
|
|
|
8
8
|
import { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';
|
|
9
9
|
export { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';
|
|
10
10
|
export { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';
|
|
11
|
+
export { DefaultLogging } from '@strivacity/sdk-core/utils/Logging';
|
|
11
12
|
export { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
12
13
|
export { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';
|
|
13
14
|
export { createCredential, getCredential } from '@strivacity/sdk-core/utils/credentials';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addComponent, addImports } from '@nuxt/kit';
|
|
2
2
|
export { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';
|
|
3
|
+
export { DefaultLogging } from '@strivacity/sdk-core/utils/Logging';
|
|
3
4
|
import { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
4
5
|
export { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';
|
|
5
6
|
export { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';
|
|
@@ -31,6 +32,26 @@ declare class CustomStorage implements SDKStorage {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export default CustomStorage`
|
|
35
|
+
});
|
|
36
|
+
addTemplate({
|
|
37
|
+
filename: "strivacity-sdk-logging.mjs",
|
|
38
|
+
getContents: () => `export default ${options.logging?.toString()}`
|
|
39
|
+
});
|
|
40
|
+
addTypeTemplate({
|
|
41
|
+
filename: "strivacity-sdk-logging.d.ts",
|
|
42
|
+
getContents: () => `
|
|
43
|
+
import type { SDKLogging } from '@strivacity/sdk-core';
|
|
44
|
+
|
|
45
|
+
declare class CustomLogging implements SDKLogging {
|
|
46
|
+
xEventId: string | undefined;
|
|
47
|
+
|
|
48
|
+
debug(message: string): void;
|
|
49
|
+
info(message: string): void;
|
|
50
|
+
warn(message: string): void;
|
|
51
|
+
error(message: string, error: Error): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default CustomLogging`
|
|
34
55
|
});
|
|
35
56
|
addComponent({
|
|
36
57
|
name: "StyLoginRenderer",
|
package/dist/module.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import type { SDKOptions } from '@strivacity/sdk-core';\nimport { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addImports, addComponent } from '@nuxt/kit';\nimport type { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';\nimport type { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';\nimport type { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';\nimport { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';\nimport { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';\nimport { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';\n\ndeclare module '@nuxt/schema' {\n\tinterface PublicRuntimeConfig {\n\t\tstrivacity: SDKOptions;\n\t}\n}\n\nexport type ModuleOptions = SDKOptions;\n\nexport * from '@strivacity/sdk-core';\nexport { createCredential, getCredential } from '@strivacity/sdk-core/utils/credentials';\nexport type * from './types';\nexport type { PopupFlow, RedirectFlow, NativeFlow };\nexport { HttpClient, LocalStorage, SessionStorage };\n\nexport default defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: '@strivacity/sdk-nuxt',\n\t\tconfigKey: 'strivacity',\n\t},\n\tdefaults: {} as SDKOptions,\n\tsetup(options, nuxt) {\n\t\tconst resolver = createResolver(import.meta.url);\n\n\t\tnuxt.options.runtimeConfig.public.strivacity = options;\n\n\t\taddTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.mjs',\n\t\t\tgetContents: () => `export default ${options.storage ? options.storage.toString() : LocalStorage.toString()}`,\n\t\t});\n\t\taddTypeTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.d.ts',\n\t\t\tgetContents: () => `\nimport type { SDKStorage } from '@strivacity/sdk-core';\n\ndeclare class CustomStorage implements SDKStorage {\n\tget(key: string): Promise<string | null>;\n\tdelete(key: string): Promise<void>;\n\tset(key: string, value: string): Promise<void>;\n}\n\nexport default CustomStorage`,\n\t\t});\n\t\taddComponent({\n\t\t\tname: 'StyLoginRenderer',\n\t\t\tfilePath: resolver.resolve('./runtime/login-renderer.vue'),\n\t\t});\n\t\taddImports({ name: 'useStrivacity', as: 'useStrivacity', from: resolver.resolve('./runtime/composables') });\n\t\taddImports({ name: 'getCredential', as: 'getCredential', from: resolver.resolve('./runtime/composables') });\n\t\taddImports({ name: 'createCredential', as: 'createCredential', from: resolver.resolve('./runtime/composables') });\n\t},\n});\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"module.mjs","sources":["../src/module.ts"],"sourcesContent":["import type { SDKOptions } from '@strivacity/sdk-core';\nimport { defineNuxtModule, createResolver, addTemplate, addTypeTemplate, addImports, addComponent } from '@nuxt/kit';\nimport type { PopupFlow } from '@strivacity/sdk-core/flows/PopupFlow';\nimport type { RedirectFlow } from '@strivacity/sdk-core/flows/RedirectFlow';\nimport type { NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow';\nimport { HttpClient } from '@strivacity/sdk-core/utils/HttpClient';\nimport { DefaultLogging } from '@strivacity/sdk-core/utils/Logging';\nimport { LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage';\nimport { SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage';\n\ndeclare module '@nuxt/schema' {\n\tinterface PublicRuntimeConfig {\n\t\tstrivacity: SDKOptions;\n\t}\n}\n\nexport type ModuleOptions = SDKOptions;\n\nexport * from '@strivacity/sdk-core';\nexport { createCredential, getCredential } from '@strivacity/sdk-core/utils/credentials';\nexport type * from './types';\nexport type { PopupFlow, RedirectFlow, NativeFlow };\nexport { HttpClient, DefaultLogging, LocalStorage, SessionStorage };\n\nexport default defineNuxtModule<ModuleOptions>({\n\tmeta: {\n\t\tname: '@strivacity/sdk-nuxt',\n\t\tconfigKey: 'strivacity',\n\t},\n\tdefaults: {} as SDKOptions,\n\tsetup(options, nuxt) {\n\t\tconst resolver = createResolver(import.meta.url);\n\n\t\tnuxt.options.runtimeConfig.public.strivacity = options;\n\n\t\taddTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.mjs',\n\t\t\tgetContents: () => `export default ${options.storage ? options.storage.toString() : LocalStorage.toString()}`,\n\t\t});\n\t\taddTypeTemplate({\n\t\t\tfilename: 'strivacity-sdk-storage.d.ts',\n\t\t\tgetContents: () => `\nimport type { SDKStorage } from '@strivacity/sdk-core';\n\ndeclare class CustomStorage implements SDKStorage {\n\tget(key: string): Promise<string | null>;\n\tdelete(key: string): Promise<void>;\n\tset(key: string, value: string): Promise<void>;\n}\n\nexport default CustomStorage`,\n\t\t});\n\t\taddTemplate({\n\t\t\tfilename: 'strivacity-sdk-logging.mjs',\n\t\t\tgetContents: () => `export default ${options.logging?.toString()}`,\n\t\t});\n\t\taddTypeTemplate({\n\t\t\tfilename: 'strivacity-sdk-logging.d.ts',\n\t\t\tgetContents: () => `\nimport type { SDKLogging } from '@strivacity/sdk-core';\n\ndeclare class CustomLogging implements SDKLogging {\n\txEventId: string | undefined;\n\n\tdebug(message: string): void;\n\tinfo(message: string): void;\n\twarn(message: string): void;\n\terror(message: string, error: Error): void;\n}\n\nexport default CustomLogging`,\n\t\t});\n\t\taddComponent({\n\t\t\tname: 'StyLoginRenderer',\n\t\t\tfilePath: resolver.resolve('./runtime/login-renderer.vue'),\n\t\t});\n\t\taddImports({ name: 'useStrivacity', as: 'useStrivacity', from: resolver.resolve('./runtime/composables') });\n\t\taddImports({ name: 'getCredential', as: 'getCredential', from: resolver.resolve('./runtime/composables') });\n\t\taddImports({ name: 'createCredential', as: 'createCredential', from: resolver.resolve('./runtime/composables') });\n\t},\n});\n"],"names":[],"mappings":";;;;;;;;;AAwBA,eAAe,gBAAA,CAAgC;AAAA,EAC9C,IAAA,EAAM;AAAA,IACL,IAAA,EAAM,sBAAA;AAAA,IACN,SAAA,EAAW;AAAA,GACZ;AAAA,EACA,UAAU,EAAC;AAAA,EACX,KAAA,CAAM,SAAS,IAAA,EAAM;AACpB,IAAA,MAAM,QAAA,GAAW,cAAA,CAAe,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAE/C,IAAA,IAAA,CAAK,OAAA,CAAQ,aAAA,CAAc,MAAA,CAAO,UAAA,GAAa,OAAA;AAE/C,IAAA,WAAA,CAAY;AAAA,MACX,QAAA,EAAU,4BAAA;AAAA,MACV,WAAA,EAAa,MAAM,CAAA,eAAA,EAAkB,OAAA,CAAQ,OAAA,GAAU,OAAA,CAAQ,OAAA,CAAQ,QAAA,EAAS,GAAI,YAAA,CAAa,QAAA,EAAU,CAAA;AAAA,KAC3G,CAAA;AACD,IAAA,eAAA,CAAgB;AAAA,MACf,QAAA,EAAU,6BAAA;AAAA,MACV,aAAa,MAAM;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,4BAAA;AAAA,KAUnB,CAAA;AACD,IAAA,WAAA,CAAY;AAAA,MACX,QAAA,EAAU,4BAAA;AAAA,MACV,aAAa,MAAM,CAAA,eAAA,EAAkB,OAAA,CAAQ,OAAA,EAAS,UAAU,CAAA;AAAA,KAChE,CAAA;AACD,IAAA,eAAA,CAAgB;AAAA,MACf,QAAA,EAAU,6BAAA;AAAA,MACV,aAAa,MAAM;AAAA;;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA,4BAAA;AAAA,KAanB,CAAA;AACD,IAAA,YAAA,CAAa;AAAA,MACZ,IAAA,EAAM,kBAAA;AAAA,MACN,QAAA,EAAU,QAAA,CAAS,OAAA,CAAQ,8BAA8B;AAAA,KACzD,CAAA;AACD,IAAA,UAAA,CAAW,EAAE,IAAA,EAAM,eAAA,EAAiB,EAAA,EAAI,eAAA,EAAiB,MAAM,QAAA,CAAS,OAAA,CAAQ,uBAAuB,CAAA,EAAG,CAAA;AAC1G,IAAA,UAAA,CAAW,EAAE,IAAA,EAAM,eAAA,EAAiB,EAAA,EAAI,eAAA,EAAiB,MAAM,QAAA,CAAS,OAAA,CAAQ,uBAAuB,CAAA,EAAG,CAAA;AAC1G,IAAA,UAAA,CAAW,EAAE,IAAA,EAAM,kBAAA,EAAoB,EAAA,EAAI,kBAAA,EAAoB,MAAM,QAAA,CAAS,OAAA,CAAQ,uBAAuB,CAAA,EAAG,CAAA;AAAA,EACjH;AACD,CAAC,CAAA;;;;"}
|
|
@@ -9,4 +9,4 @@ export { createCredential, getCredential } from '@strivacity/sdk-core/utils/cred
|
|
|
9
9
|
*
|
|
10
10
|
* @returns {T} The Strivacity SDK context, typed as either PopupContext or RedirectContext or NativeContext.
|
|
11
11
|
*/
|
|
12
|
-
export declare const useStrivacity:
|
|
12
|
+
export declare const useStrivacity: <T extends PopupContext | RedirectContext | NativeContext>() => T;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import StorageClass from "#build/strivacity-sdk-storage";
|
|
2
|
+
import LoggingClass from "#build/strivacity-sdk-logging";
|
|
2
3
|
import { ref, useRuntimeConfig } from "#imports";
|
|
3
4
|
import { initFlow } from "@strivacity/sdk-core";
|
|
4
5
|
export { createCredential, getCredential } from "@strivacity/sdk-core/utils/credentials";
|
|
@@ -24,7 +25,7 @@ const updateSession = async () => {
|
|
|
24
25
|
};
|
|
25
26
|
export const useStrivacity = () => {
|
|
26
27
|
if (!sdk) {
|
|
27
|
-
sdk = initFlow({ ...useRuntimeConfig().public.strivacity, storage: StorageClass });
|
|
28
|
+
sdk = initFlow({ ...useRuntimeConfig().public.strivacity, storage: StorageClass, logging: LoggingClass });
|
|
28
29
|
optionsRef.value = sdk.options;
|
|
29
30
|
sdk.subscribeToEvent("init", updateSession);
|
|
30
31
|
sdk.subscribeToEvent("loggedIn", updateSession);
|
|
@@ -26,18 +26,18 @@ const WidgetRenderer = defineComponent({
|
|
|
26
26
|
const form = state.value?.forms?.find((form2) => form2.id === item.formId);
|
|
27
27
|
const widget = form?.widgets.find((widget2) => widget2.id === item.widgetId);
|
|
28
28
|
if (!form || !widget) {
|
|
29
|
-
triggerFallback();
|
|
29
|
+
triggerFallback(void 0, `Unable to find form or widget for item: formId=${item.formId}, widgetId=${item.widgetId}`);
|
|
30
30
|
return null;
|
|
31
31
|
}
|
|
32
32
|
const component = props2.widgets[widget.type];
|
|
33
33
|
if (!component) {
|
|
34
|
-
triggerFallback();
|
|
34
|
+
triggerFallback(void 0, `No component found for widget type ${widget.type}`);
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
return h(component, { key: `${form.id}.${widget.id}`, formId: form.id, config: widget });
|
|
38
38
|
} else if (item.type === "vertical" || item.type === "horizontal") {
|
|
39
39
|
if (!props2.widgets.layout) {
|
|
40
|
-
triggerFallback();
|
|
40
|
+
triggerFallback(void 0, "No layout component provided");
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
return h(
|
|
@@ -46,7 +46,7 @@ const WidgetRenderer = defineComponent({
|
|
|
46
46
|
() => h(WidgetRenderer, { items: item.items, widgets: props2.widgets })
|
|
47
47
|
);
|
|
48
48
|
} else {
|
|
49
|
-
triggerFallback();
|
|
49
|
+
triggerFallback(void 0, "Unknown item type in layout");
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
})
|
|
@@ -81,10 +81,13 @@ onMounted(async () => {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
function triggerFallback(hostedUrl) {
|
|
84
|
+
function triggerFallback(hostedUrl, message) {
|
|
85
85
|
const url = hostedUrl || state.value.hostedUrl;
|
|
86
|
+
sdk.logging?.warn(message ? `Triggering fallback due to: ${message}` : "Triggering fallback");
|
|
86
87
|
if (!url) {
|
|
87
|
-
|
|
88
|
+
const error = new Error("No hosted URL provided");
|
|
89
|
+
sdk.logging?.error("Fallback error", error);
|
|
90
|
+
throw error;
|
|
88
91
|
}
|
|
89
92
|
emit("fallback", new FallbackError(new URL(url)));
|
|
90
93
|
}
|
|
@@ -131,7 +134,7 @@ async function handleResponse(data) {
|
|
|
131
134
|
screen: data?.screen ?? state.value.screen,
|
|
132
135
|
forms: data?.forms ?? state.value.forms,
|
|
133
136
|
layout: data?.layout ?? state.value.layout,
|
|
134
|
-
messages: data?.messages ??
|
|
137
|
+
messages: data?.messages ?? {},
|
|
135
138
|
branding: data?.branding ?? state.value.branding
|
|
136
139
|
};
|
|
137
140
|
if (newState.screen != state.value.screen) {
|
|
@@ -141,6 +144,8 @@ async function handleResponse(data) {
|
|
|
141
144
|
forms.value[form.id] = {};
|
|
142
145
|
messages.value[form.id] = {};
|
|
143
146
|
}
|
|
147
|
+
} else {
|
|
148
|
+
sdk.logging?.info(`Updating screen: ${newState.screen}`);
|
|
144
149
|
}
|
|
145
150
|
Object.keys(newState.messages ?? {}).forEach((formId) => {
|
|
146
151
|
if (formId === "global") {
|
package/dist/types.d.mts
CHANGED
|
@@ -6,6 +6,8 @@ export { type NativeFlow } from '@strivacity/sdk-core/flows/NativeFlow'
|
|
|
6
6
|
|
|
7
7
|
export { type HttpClient } from '@strivacity/sdk-core/utils/HttpClient'
|
|
8
8
|
|
|
9
|
+
export { type DefaultLogging } from '@strivacity/sdk-core/utils/Logging'
|
|
10
|
+
|
|
9
11
|
export { type LocalStorage } from '@strivacity/sdk-core/storages/LocalStorage'
|
|
10
12
|
|
|
11
13
|
export { type SessionStorage } from '@strivacity/sdk-core/storages/SessionStorage'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strivacity/sdk-nuxt",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
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": "2.
|
|
13
|
+
"@strivacity/sdk-core": "2.2.0"
|
|
14
14
|
},
|
|
15
15
|
"main": "./dist/module.mjs",
|
|
16
16
|
"types": "./dist/types.d.mts",
|
|
File without changes
|