@strivacity/sdk-angular 4.0.0-beta.0 → 4.0.0-beta.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.
@@ -1,221 +0,0 @@
1
- export * from '@strivacity/sdk-core/utils/errors';
2
- import { Router } from 'express';
3
- import { createBaseServerSDK } from '@strivacity/sdk-core/server';
4
- import { Readable } from 'node:stream';
5
- export * from '@strivacity/sdk-core/utils';
6
- import { makeStateKey, provideAppInitializer, inject, REQUEST, TransferState } from '@angular/core';
7
- import { createSessionIdCookieStorage as createSessionIdCookieStorage$1 } from '@strivacity/sdk-core/storages/server';
8
- export * from '@strivacity/sdk-core/storages';
9
- export * from '@strivacity/sdk-core/types';
10
-
11
- /**
12
- * Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.
13
- *
14
- * @param {AngularServerRequest} req - The incoming request.
15
- * @returns {Request} The equivalent Web `Request` object.
16
- */
17
- function toWebRequest(req) {
18
- if (req instanceof Request) {
19
- return req;
20
- }
21
- const url = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`);
22
- const headers = new Headers();
23
- for (const [key, value] of Object.entries(req.headers)) {
24
- if (value === undefined) {
25
- continue;
26
- }
27
- for (const v of Array.isArray(value) ? value : [value]) {
28
- headers.append(key, v);
29
- }
30
- }
31
- const hasBody = req.method !== 'GET' && req.method !== 'HEAD';
32
- return new Request(url, {
33
- method: req.method,
34
- headers,
35
- ...(hasBody ? { body: Readable.toWeb(req), duplex: 'half' } : {}),
36
- });
37
- }
38
- /**
39
- * Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.
40
- *
41
- * @param {Response} response - The `Response` to write.
42
- * @param {ExpressResponse} res - The Express response to write to.
43
- */
44
- async function applyResponse(response, res) {
45
- res.status(response.status);
46
- for (const [key, value] of response.headers.entries()) {
47
- if (key.toLowerCase() === 'set-cookie') {
48
- continue;
49
- }
50
- res.setHeader(key, value);
51
- }
52
- const setCookies = response.headers.getSetCookie();
53
- if (setCookies.length) {
54
- res.setHeader('set-cookie', setCookies);
55
- }
56
- if (!response.body) {
57
- res.end();
58
- return;
59
- }
60
- await new Promise((resolve, reject) => {
61
- Readable.fromWeb(response.body)
62
- .pipe(res)
63
- .on('finish', resolve)
64
- .on('error', reject);
65
- });
66
- }
67
-
68
- function getRouteHandlers(base) {
69
- const router = Router();
70
- router.get('/login', async (req, res, next) => {
71
- try {
72
- const response = await base.handleLogin(req);
73
- await applyResponse(response, res);
74
- }
75
- catch (error) {
76
- next(error);
77
- }
78
- });
79
- router.get('/register', async (req, res, next) => {
80
- try {
81
- const response = await base.handleRegister(req);
82
- await applyResponse(response, res);
83
- }
84
- catch (error) {
85
- next(error);
86
- }
87
- });
88
- router.get('/callback', async (req, res, next) => {
89
- try {
90
- const response = await base.handleCallback(req);
91
- await applyResponse(response, res);
92
- }
93
- catch (error) {
94
- next(error);
95
- }
96
- });
97
- router.get('/refresh', async (req, res, next) => {
98
- try {
99
- const response = await base.handleRefresh(req);
100
- await applyResponse(response, res);
101
- }
102
- catch (error) {
103
- next(error);
104
- }
105
- });
106
- router.get('/revoke', async (req, res, next) => {
107
- try {
108
- const response = await base.handleRevoke(req);
109
- await applyResponse(response, res);
110
- }
111
- catch (error) {
112
- next(error);
113
- }
114
- });
115
- router.get('/entry', async (req, res, next) => {
116
- try {
117
- const response = await base.handleEntry(req);
118
- await applyResponse(response, res);
119
- }
120
- catch (error) {
121
- next(error);
122
- }
123
- });
124
- router.get('/logout', async (req, res, next) => {
125
- try {
126
- const response = await base.handleLogout(req);
127
- await applyResponse(response, res);
128
- }
129
- catch (error) {
130
- next(error);
131
- }
132
- });
133
- router.post('/backchannel-logout', async (req, res, next) => {
134
- try {
135
- const response = await base.handleBackChannelLogout(req);
136
- await applyResponse(response, res);
137
- }
138
- catch (error) {
139
- next(error);
140
- }
141
- });
142
- return router;
143
- }
144
- /**
145
- * Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.
146
- *
147
- * @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.
148
- * @returns {AngularServerSDK} The server-side SDK instance.
149
- */
150
- function createServerSDK(initConfig) {
151
- const base = createBaseServerSDK({
152
- toRequest: (req) => toWebRequest(req),
153
- }, initConfig);
154
- return {
155
- get options() {
156
- return base.options;
157
- },
158
- handlers: getRouteHandlers(base),
159
- getSession: (req) => base.getSession(req),
160
- updateSession: (session, req) => base.updateSession(session, req),
161
- refreshSession: (req) => base.refreshSession(req),
162
- revokeSession: (req) => base.revokeSession(req),
163
- getEntrySession: (entryUrl) => base.getEntrySession(entryUrl),
164
- completeLogin: (params, req) => base.completeLogin(params, req),
165
- logout: (postLogoutRedirectUri, req) => base.logout(postLogoutRedirectUri, req),
166
- handleLogin: (req) => base.handleLogin(req),
167
- handleRegister: (req) => base.handleRegister(req),
168
- handleCallback: (req) => base.handleCallback(req),
169
- handleRefresh: (req) => base.handleRefresh(req),
170
- handleRevoke: (req) => base.handleRevoke(req),
171
- handleEntry: (req) => base.handleEntry(req),
172
- handleLogout: (req) => base.handleLogout(req),
173
- handleBackChannelLogout: (req) => base.handleBackChannelLogout(req),
174
- handler: (req) => base.handler(req),
175
- };
176
- }
177
-
178
- const SESSION_TRANSFER_KEY = makeStateKey('sty.session');
179
- /**
180
- * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app
181
- * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without
182
- * an extra round-trip or a loading flash.
183
- *
184
- * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.
185
- *
186
- * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).
187
- * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.
188
- */
189
- function provideStrivacityServerSession(serverSdk) {
190
- return provideAppInitializer(async () => {
191
- const request = inject(REQUEST);
192
- if (!request || !serverSdk) {
193
- return;
194
- }
195
- const transferState = inject(TransferState);
196
- const session = await serverSdk.getSession(request);
197
- transferState.set(SESSION_TRANSFER_KEY, session);
198
- });
199
- }
200
-
201
- /**
202
- * Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.
203
- *
204
- * @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.
205
- * @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.
206
- * @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
207
- * @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.
208
- * @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.
209
- */
210
- function createSessionIdCookieStorage(storage, options) {
211
- return createSessionIdCookieStorage$1({
212
- toRequest: (req) => toWebRequest(req),
213
- }, storage, options);
214
- }
215
-
216
- /**
217
- * Generated bundle index. Do not edit.
218
- */
219
-
220
- export { SESSION_TRANSFER_KEY, applyResponse, createServerSDK, createSessionIdCookieStorage, provideStrivacityServerSession, toWebRequest };
221
- //# sourceMappingURL=strivacity-sdk-angular-src-server.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strivacity-sdk-angular-src-server.mjs","sources":["../../src/server/utils.ts","../../src/server/sdk.ts","../../src/server/session.ts","../../src/server/storages.ts","../../src/server/strivacity-sdk-angular-src-server.ts"],"sourcesContent":["import type { Response as ExpressResponse } from 'express';\nimport type { AngularServerRequest } from './types';\nimport { Readable } from 'node:stream';\n\nexport * from '@strivacity/sdk-core/utils';\n\n/**\n * Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.\n *\n * @param {AngularServerRequest} req - The incoming request.\n * @returns {Request} The equivalent Web `Request` object.\n */\nexport function toWebRequest(req: AngularServerRequest): Request {\n\tif (req instanceof Request) {\n\t\treturn req;\n\t}\n\n\tconst url = new URL(req.originalUrl, `${req.protocol}://${req.get('host')}`);\n\tconst headers = new Headers();\n\n\tfor (const [key, value] of Object.entries(req.headers)) {\n\t\tif (value === undefined) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfor (const v of Array.isArray(value) ? value : [value]) {\n\t\t\theaders.append(key, v);\n\t\t}\n\t}\n\n\tconst hasBody = req.method !== 'GET' && req.method !== 'HEAD';\n\n\treturn new Request(url, {\n\t\tmethod: req.method,\n\t\theaders,\n\t\t...(hasBody ? { body: Readable.toWeb(req), duplex: 'half' } : {}),\n\t} as RequestInit);\n}\n\n/**\n * Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.\n *\n * @param {Response} response - The `Response` to write.\n * @param {ExpressResponse} res - The Express response to write to.\n */\nexport async function applyResponse(response: Response, res: ExpressResponse): Promise<void> {\n\tres.status(response.status);\n\n\tfor (const [key, value] of response.headers.entries()) {\n\t\tif (key.toLowerCase() === 'set-cookie') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tres.setHeader(key, value);\n\t}\n\n\tconst setCookies = response.headers.getSetCookie();\n\n\tif (setCookies.length) {\n\t\tres.setHeader('set-cookie', setCookies);\n\t}\n\n\tif (!response.body) {\n\t\tres.end();\n\t\treturn;\n\t}\n\n\tawait new Promise<void>((resolve, reject) => {\n\t\tReadable.fromWeb(response.body as Parameters<typeof Readable.fromWeb>[0])\n\t\t\t.pipe(res)\n\t\t\t.on('finish', resolve)\n\t\t\t.on('error', reject);\n\t});\n}\n","import type { AngularServerRequest, AngularServerSDK, AngularServerSDKInitConfig } from './types';\nimport { Router } from 'express';\nimport { createBaseServerSDK } from '@strivacity/sdk-core/server';\nimport { applyResponse, toWebRequest } from './utils';\n\nfunction getRouteHandlers(base: ReturnType<typeof createBaseServerSDK<AngularServerRequest | undefined>>): Router {\n\tconst router = Router();\n\n\trouter.get('/login', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleLogin(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/register', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRegister(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/callback', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleCallback(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/refresh', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRefresh(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/revoke', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleRevoke(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/entry', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleEntry(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.get('/logout', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleLogout(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\trouter.post('/backchannel-logout', async (req, res, next) => {\n\t\ttry {\n\t\t\tconst response = await base.handleBackChannelLogout(req);\n\t\t\tawait applyResponse(response, res);\n\t\t} catch (error) {\n\t\t\tnext(error);\n\t\t}\n\t});\n\n\treturn router;\n}\n\n/**\n * Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.\n *\n * @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.\n * @returns {AngularServerSDK} The server-side SDK instance.\n */\nexport function createServerSDK(initConfig: AngularServerSDKInitConfig): AngularServerSDK {\n\tconst base = createBaseServerSDK<AngularServerRequest | undefined>(\n\t\t{\n\t\t\ttoRequest: (req) => toWebRequest(req as AngularServerRequest),\n\t\t},\n\t\tinitConfig,\n\t);\n\n\treturn {\n\t\tget options() {\n\t\t\treturn base.options;\n\t\t},\n\t\thandlers: getRouteHandlers(base),\n\t\tgetSession: (req) => base.getSession(req),\n\t\tupdateSession: (session, req) => base.updateSession(session, req),\n\t\trefreshSession: (req) => base.refreshSession(req),\n\t\trevokeSession: (req) => base.revokeSession(req),\n\t\tgetEntrySession: (entryUrl) => base.getEntrySession(entryUrl),\n\t\tcompleteLogin: (params, req) => base.completeLogin(params, req),\n\t\tlogout: (postLogoutRedirectUri, req) => base.logout(postLogoutRedirectUri, req),\n\t\thandleLogin: (req) => base.handleLogin(req),\n\t\thandleRegister: (req) => base.handleRegister(req),\n\t\thandleCallback: (req) => base.handleCallback(req),\n\t\thandleRefresh: (req) => base.handleRefresh(req),\n\t\thandleRevoke: (req) => base.handleRevoke(req),\n\t\thandleEntry: (req) => base.handleEntry(req),\n\t\thandleLogout: (req) => base.handleLogout(req),\n\t\thandleBackChannelLogout: (req) => base.handleBackChannelLogout(req),\n\t\thandler: (req) => base.handler(req),\n\t};\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport type { AngularServerSDK, SessionData } from './types';\nimport { REQUEST, TransferState, inject, makeStateKey, provideAppInitializer } from '@angular/core';\n\nexport const SESSION_TRANSFER_KEY = makeStateKey<SessionData | null>('sty.session');\n\n/**\n * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app\n * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without\n * an extra round-trip or a loading flash.\n *\n * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.\n *\n * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).\n * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.\n */\nexport function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders {\n\treturn provideAppInitializer(async () => {\n\t\tconst request = inject(REQUEST);\n\n\t\tif (!request || !serverSdk) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transferState = inject(TransferState);\n\t\tconst session = await serverSdk.getSession(request);\n\n\t\ttransferState.set(SESSION_TRANSFER_KEY, session);\n\t});\n}\n","import type { ServerStorage, AngularServerRequest } from './types';\nimport type { SDKStorage, SessionIdCookieStorageOptions } from '@strivacity/sdk-core/types';\nimport { createSessionIdCookieStorage as createSessionIdCookieStorageBase } from '@strivacity/sdk-core/storages/server';\nimport { toWebRequest } from './utils';\n\nexport * from '@strivacity/sdk-core/storages';\n\n/**\n * Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.\n *\n * @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.\n * @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.\n * @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.\n * @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.\n * @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.\n */\nexport function createSessionIdCookieStorage(storage: SDKStorage, options?: SessionIdCookieStorageOptions): ServerStorage {\n\treturn createSessionIdCookieStorageBase<AngularServerRequest>(\n\t\t{\n\t\t\ttoRequest: (req) => toWebRequest(req),\n\t\t},\n\t\tstorage,\n\t\toptions,\n\t);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["createSessionIdCookieStorageBase"],"mappings":";;;;;;;;;;AAMA;;;;;AAKG;AACG,SAAU,YAAY,CAAC,GAAyB,EAAA;AACrD,IAAA,IAAI,GAAG,YAAY,OAAO,EAAE;AAC3B,QAAA,OAAO,GAAG;IACX;IAEA,MAAM,GAAG,G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qBAAqB,CAAC,YAAW;AACvC,QAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;AAE/B,QAAA,IAAI,CAAC,OAAO,IAAI,CAAC,SAAS,EAAE;YAC3B;QACD;AAEA,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC3C,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;AAEnD,QAAA,aAAa,CAAC,GAAG,CAAC,oBAAoB,EAAE,OAAO,CAAC;AACjD,IAAA,CAAC,CAAC;AACH;;ACtBA;;;;;;;;AAQG;AACG,SAAU,4BAA4B,CAAC,OAAmB,EAAE,OAAuC,EAAA;AACxG,IAAA,OAAOA,8BAAgC,CACtC;QACC,SAAS,EAAE,CAAC,GAAG,KAAK,YAAY,CAAC,GAAG,CAAC;AACrC,KAAA,EACD,OAAO,EACP,OAAO,CACP;AACF;;ACxBA;;AAEG;;"}
@@ -1,6 +0,0 @@
1
- export * from '@strivacity/sdk-core/types';
2
-
3
- /**
4
- * Generated bundle index. Do not edit.
5
- */
6
- //# sourceMappingURL=strivacity-sdk-angular-src-types.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"strivacity-sdk-angular-src-types.mjs","sources":["../../src/types/strivacity-sdk-angular-src-types.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAA;;AAEG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"strivacity-sdk-angular.mjs","sources":["../../src/lib/utils.ts","../../src/server/session.ts","../../src/lib/services/auth.service.ts","../../src/lib/services/native-login.service.ts","../../src/strivacity-sdk-angular.ts"],"sourcesContent":["import type { Provider, ModuleWithProviders } from '@angular/core';\nimport type { AngularSDKInitConfig } from '../types';\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule, InjectionToken } from '@angular/core';\nimport { StrivacityAuthService } from './services/auth.service';\n\nexport const STRIVACITY_SDK = new InjectionToken<AngularSDKInitConfig>('strivacity-sdk');\n\n/**\n * Provides the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.\n *\n * This function is used to supply the Strivacity SDK configuration to the application\n * by binding it to the `STRIVACITY_SDK` token, and to register `StrivacityAuthService` as an injectable.\n *\n * @param {AngularSDKInitConfig} config The SDK configuration options.\n * @returns {Provider[]} The providers to add to the application (or component) injector.\n */\nexport function provideStrivacity(config: AngularSDKInitConfig): Provider[] {\n\treturn [{ provide: STRIVACITY_SDK, useValue: config }, StrivacityAuthService];\n}\n\n@NgModule({\n\tschemas: [CUSTOM_ELEMENTS_SCHEMA],\n})\nexport class StrivacityAuthModule {\n\t/**\n\t * Registers the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.\n\t *\n\t * This is the `NgModule`-based equivalent of `provideStrivacity()`, for applications that still bootstrap via `NgModule`.\n\t *\n\t * @param {AngularSDKInitConfig} options The SDK configuration options.\n\t * @returns {ModuleWithProviders<StrivacityAuthModule>} The module along with its providers, to be imported once at the root of the application.\n\t */\n\tstatic forRoot(options: AngularSDKInitConfig): ModuleWithProviders<StrivacityAuthModule> {\n\t\treturn {\n\t\t\tngModule: StrivacityAuthModule,\n\t\t\tproviders: [provideStrivacity(options)],\n\t\t};\n\t}\n}\n","import type { EnvironmentProviders } from '@angular/core';\nimport type { AngularServerSDK, SessionData } from './types';\nimport { REQUEST, TransferState, inject, makeStateKey, provideAppInitializer } from '@angular/core';\n\nexport const SESSION_TRANSFER_KEY = makeStateKey<SessionData | null>('sty.session');\n\n/**\n * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app\n * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without\n * an extra round-trip or a loading flash.\n *\n * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.\n *\n * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).\n * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.\n */\nexport function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders {\n\treturn provideAppInitializer(async () => {\n\t\tconst request = inject(REQUEST);\n\n\t\tif (!request || !serverSdk) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst transferState = inject(TransferState);\n\t\tconst session = await serverSdk.getSession(request);\n\n\t\ttransferState.set(SESSION_TRANSFER_KEY, session);\n\t});\n}\n","import type { IdTokenClaims, SDKInstance } from '../../types';\nimport { DestroyRef, Injectable, PLATFORM_ID, TransferState, inject, signal } from '@angular/core';\nimport { isPlatformBrowser } from '@angular/common';\nimport { initFlow } from '@strivacity/sdk-core';\nimport { STRIVACITY_SDK } from '../utils';\nimport { SESSION_TRANSFER_KEY } from '../../server/session';\n\n/**\n * Signal-based service exposing the Strivacity SDK state and actions to Angular components.\n *\n * Provided via `provideStrivacity()` (standalone) or `StrivacityAuthModule.forRoot()` (NgModule).\n */\n@Injectable()\nexport class StrivacityAuthService {\n\tprivate readonly loadingSignal = signal(true);\n\tprivate readonly languageSignal = signal(globalThis.navigator?.language ?? 'en-US');\n\tprivate readonly isAuthenticatedSignal = signal(false);\n\tprivate readonly idTokenClaimsSignal = signal<IdTokenClaims | null>(null);\n\tprivate readonly accessTokenSignal = signal<string | null>(null);\n\tprivate readonly refreshTokenSignal = signal<string | null>(null);\n\tprivate readonly accessTokenExpiredSignal = signal(true);\n\tprivate readonly accessTokenExpirationDateSignal = signal<number | null>(null);\n\n\treadonly options = inject(STRIVACITY_SDK);\n\treadonly sdk: SDKInstance = initFlow(this.options as never);\n\treadonly loading = this.loadingSignal.asReadonly();\n\treadonly language = this.languageSignal.asReadonly();\n\treadonly isAuthenticated = this.isAuthenticatedSignal.asReadonly();\n\treadonly idTokenClaims = this.idTokenClaimsSignal.asReadonly();\n\treadonly accessToken = this.accessTokenSignal.asReadonly();\n\treadonly refreshToken = this.refreshTokenSignal.asReadonly();\n\treadonly accessTokenExpired = this.accessTokenExpiredSignal.asReadonly();\n\treadonly accessTokenExpirationDate = this.accessTokenExpirationDateSignal.asReadonly();\n\n\tconstructor() {\n\t\tif (this.options.serverSessionUri) {\n\t\t\tconst transferState = inject(TransferState);\n\t\t\tconst hydratedSession = transferState.get(SESSION_TRANSFER_KEY, undefined);\n\n\t\t\tif (hydratedSession) {\n\t\t\t\tthis.sdk.session = hydratedSession;\n\n\t\t\t\tif (isPlatformBrowser(inject(PLATFORM_ID))) {\n\t\t\t\t\ttransferState.remove(SESSION_TRANSFER_KEY);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvoid this.updateSession();\n\n\t\tconst subscription = this.sdk.subscribeToAllEvents(() => this.updateSession());\n\t\tinject(DestroyRef).onDestroy(() => subscription.dispose());\n\t}\n\n\tinit(...args: Parameters<typeof this.sdk.init>): ReturnType<typeof this.sdk.init> {\n\t\treturn this.sdk.init(...args);\n\t}\n\n\tsubscribeToEvent(...args: Parameters<typeof this.sdk.subscribeToEvent>): ReturnType<typeof this.sdk.subscribeToEvent> {\n\t\treturn this.sdk.subscribeToEvent(...args);\n\t}\n\n\tsubscribeToAllEvents(...args: Parameters<typeof this.sdk.subscribeToAllEvents>): ReturnType<typeof this.sdk.subscribeToAllEvents> {\n\t\treturn this.sdk.subscribeToAllEvents(...args);\n\t}\n\n\tcheckAuthentication(...args: Parameters<typeof this.sdk.checkAuthentication>): ReturnType<typeof this.sdk.checkAuthentication> {\n\t\treturn this.sdk.checkAuthentication(...args);\n\t}\n\n\ttokenExchange(...args: Parameters<typeof this.sdk.tokenExchange>): ReturnType<typeof this.sdk.tokenExchange> {\n\t\treturn this.sdk.tokenExchange(...args);\n\t}\n\n\thandleCallback(...args: Parameters<typeof this.sdk.handleCallback>): ReturnType<typeof this.sdk.handleCallback> {\n\t\treturn this.sdk.handleCallback(...args);\n\t}\n\n\trefresh(): ReturnType<typeof this.sdk.refresh> {\n\t\treturn this.sdk.refresh();\n\t}\n\n\trevoke(): ReturnType<typeof this.sdk.revoke> {\n\t\treturn this.sdk.revoke();\n\t}\n\n\tlogout(...args: Parameters<typeof this.sdk.logout>): ReturnType<typeof this.sdk.logout> {\n\t\treturn this.sdk.logout(...args);\n\t}\n\n\tlogin(...args: Parameters<typeof this.sdk.login>): ReturnType<typeof this.sdk.login> {\n\t\treturn this.sdk.login(...args);\n\t}\n\n\tregister(...args: Parameters<typeof this.sdk.register>): ReturnType<typeof this.sdk.register> {\n\t\treturn this.sdk.register(...args);\n\t}\n\n\tentry(...args: Parameters<typeof this.sdk.entry>): ReturnType<typeof this.sdk.entry> {\n\t\treturn this.sdk.entry(...args);\n\t}\n\n\tprivate async updateSession(): Promise<void> {\n\t\tconst authenticated = await this.sdk.isAuthenticated;\n\n\t\tif (this.loadingSignal()) {\n\t\t\tthis.loadingSignal.set(false);\n\t\t}\n\t\tif (this.sdk.language !== this.languageSignal()) {\n\t\t\tthis.languageSignal.set(this.sdk.language);\n\t\t}\n\t\tif (authenticated !== this.isAuthenticatedSignal()) {\n\t\t\tthis.isAuthenticatedSignal.set(authenticated);\n\t\t}\n\t\tif (this.sdk.idTokenClaims !== this.idTokenClaimsSignal()) {\n\t\t\tthis.idTokenClaimsSignal.set(this.sdk.idTokenClaims ?? null);\n\t\t}\n\t\tif (this.sdk.accessToken !== this.accessTokenSignal()) {\n\t\t\tthis.accessTokenSignal.set(this.sdk.accessToken ?? null);\n\t\t}\n\t\tif (this.sdk.refreshToken !== this.refreshTokenSignal()) {\n\t\t\tthis.refreshTokenSignal.set(this.sdk.refreshToken ?? null);\n\t\t}\n\t\tif (this.sdk.accessTokenExpired !== this.accessTokenExpiredSignal()) {\n\t\t\tthis.accessTokenExpiredSignal.set(this.sdk.accessTokenExpired);\n\t\t}\n\t\tif (this.sdk.accessTokenExpirationDate !== this.accessTokenExpirationDateSignal()) {\n\t\t\tthis.accessTokenExpirationDateSignal.set(this.sdk.accessTokenExpirationDate ?? null);\n\t\t}\n\t}\n}\n","import type { NativeFlowMessage, NativeFlowState, NativeParams, NativeLoginOptions } from '../../types';\nimport { DestroyRef, Injectable, inject, signal } from '@angular/core';\nimport { FallbackError } from '@strivacity/sdk-core/utils/errors';\nimport { unflattenObject } from '@strivacity/sdk-core/utils';\nimport { StrivacityAuthService } from './auth.service';\n\n@Injectable()\nexport class StrivacityNativeLoginService {\n\tprivate readonly authService = inject(StrivacityAuthService);\n\tprivate readonly sdk = this.authService.sdk;\n\tprivate readonly abortController = new AbortController();\n\tprivate options: NativeLoginOptions = {};\n\n\tprivate readonly loadingSignal = signal(true);\n\tprivate readonly formsSignal = signal<Record<string, Record<string, unknown>>>({});\n\tprivate readonly messagesSignal = signal<Record<string, Record<string, NativeFlowMessage>>>({});\n\tprivate readonly stateSignal = signal<Partial<NativeFlowState>>({});\n\n\treadonly loading = this.loadingSignal.asReadonly();\n\treadonly forms = this.formsSignal.asReadonly();\n\treadonly messages = this.messagesSignal.asReadonly();\n\treadonly state = this.stateSignal.asReadonly();\n\n\tconstructor() {\n\t\tinject(DestroyRef).onDestroy(() => this.abortController.abort());\n\t}\n\n\t/**\n\t * Starts a native login flow session. Should be called once, from the page component that owns this service.\n\t *\n\t * @param {NativeLoginOptions} [options] - Optional options for the login session.\n\t */\n\tasync start(options: NativeLoginOptions = {}): Promise<void> {\n\t\tthis.options = options;\n\n\t\tawait this.sdk.init();\n\n\t\ttry {\n\t\t\tawait this.startSession(options.params);\n\t\t} catch (error) {\n\t\t\tif (error instanceof DOMException && error.name === 'AbortError') {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.sdk.logging?.error('Error fetching authorization URI', error as Error);\n\t\t\tawait this.options.onError?.(error as Error);\n\t\t\tthis.loadingSignal.set(false);\n\t\t}\n\t}\n\n\tasync submitForm(formId: string, customBody?: Record<string, unknown>): Promise<void> {\n\t\ttry {\n\t\t\tthis.loadingSignal.set(true);\n\n\t\t\tconst nextState = await this.sdk.submitForm(formId, customBody ?? unflattenObject(this.formsSignal()[formId] ?? {}));\n\n\t\t\tif (nextState) {\n\t\t\t\tawait this.handleResponse(nextState);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof FallbackError) {\n\t\t\t\tthis.sdk.logging?.error('Fallback error occurred', error);\n\t\t\t\tawait this.options.onFallback?.(error);\n\t\t\t} else {\n\t\t\t\tthis.sdk.logging?.error('Error submitting form', error as Error);\n\t\t\t\tawait this.options.onError?.(error as Error);\n\t\t\t}\n\t\t}\n\t}\n\n\tsetFormValue(formId: string, widgetId: string, value: unknown): void {\n\t\tconst forms = { ...this.formsSignal() };\n\n\t\tforms[formId] = { ...(forms[formId] ?? {}), [widgetId]: value === '' ? null : value };\n\t\tthis.formsSignal.set(forms);\n\t}\n\n\tsetMessage(formId: string, widgetId: string, value: NativeFlowMessage): void {\n\t\tconst messages = { ...this.messagesSignal() };\n\n\t\tmessages[formId] = { ...(messages[formId] ?? {}), [widgetId]: value };\n\t\tthis.messagesSignal.set(messages);\n\t}\n\n\ttriggerFallback(message?: string): void {\n\t\tthis.sdk.logging?.warn(message ? `Triggering fallback due to: ${message}` : 'Triggering fallback');\n\n\t\tconst hostedUrl = this.stateSignal().hostedUrl;\n\n\t\tif (!hostedUrl) {\n\t\t\tconst error = new Error('No hosted URL provided');\n\t\t\tthis.sdk.logging?.error('Fallback error', error);\n\t\t\tthrow error;\n\t\t}\n\n\t\tvoid this.options.onFallback?.(new FallbackError(new URL(hostedUrl)));\n\t}\n\n\ttriggerClose(): void {\n\t\tthis.sdk.logging?.debug('Triggering close');\n\t\tvoid this.options.onClose?.();\n\t}\n\n\tprivate async startSession(loginParams: NativeParams = {}): Promise<void> {\n\t\ttry {\n\t\t\tthis.loadingSignal.set(true);\n\n\t\t\tconst nextState = await this.sdk.startSession(loginParams);\n\n\t\t\tif (nextState) {\n\t\t\t\tawait this.handleResponse(nextState);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (error instanceof FallbackError) {\n\t\t\t\tthis.sdk.logging?.error('Fallback error occurred', error);\n\t\t\t\tawait this.options.onFallback?.(error);\n\t\t\t} else {\n\t\t\t\tthis.sdk.logging?.error('Error starting session', error as Error);\n\t\t\t\tawait this.options.onError?.(error as Error);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async handleResponse(nextState: Partial<NativeFlowState>): Promise<void> {\n\t\tif (this.sdk.session) {\n\t\t\treturn await this.options.onLogin?.(this.sdk.session);\n\t\t}\n\n\t\tconst currentState = this.stateSignal();\n\t\tconst newState: NativeFlowState = {\n\t\t\thostedUrl: nextState.hostedUrl ?? currentState.hostedUrl,\n\t\t\tfinalizeUrl: nextState.finalizeUrl ?? currentState.finalizeUrl,\n\t\t\tscreen: nextState.screen ?? currentState.screen,\n\t\t\tforms: nextState.forms ?? currentState.forms,\n\t\t\tlayout: nextState.layout ?? currentState.layout,\n\t\t\tmessages: nextState.messages ?? {},\n\t\t\tbranding: nextState.branding ?? currentState.branding,\n\t\t};\n\n\t\tif (newState.screen !== currentState.screen) {\n\t\t\tconst nextForms: Record<string, Record<string, unknown>> = {};\n\t\t\tconst nextMessages: Record<string, Record<string, NativeFlowMessage>> = {};\n\n\t\t\tfor (const form of newState.forms ?? []) {\n\t\t\t\tnextForms[form.id] = {};\n\t\t\t\tnextMessages[form.id] = {};\n\t\t\t}\n\n\t\t\tthis.formsSignal.set(nextForms);\n\t\t\tthis.messagesSignal.set(nextMessages);\n\t\t} else {\n\t\t\tthis.sdk.logging?.info(`Updating screen: ${newState.screen}`);\n\t\t}\n\n\t\tconst nextMessageMap = { ...this.messagesSignal() };\n\n\t\tfor (const formId of Object.keys(newState.messages ?? {})) {\n\t\t\tif (formId === 'global') {\n\t\t\t\tawait this.options.onGlobalMessage?.(newState.messages!.global!);\n\t\t\t} else {\n\t\t\t\tnextMessageMap[formId] = newState.messages![formId] ?? {};\n\t\t\t}\n\t\t}\n\n\t\tthis.messagesSignal.set(nextMessageMap);\n\t\tthis.stateSignal.set(newState);\n\n\t\tif (!newState.finalizeUrl) {\n\t\t\tthis.loadingSignal.set(false);\n\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WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;AAE9B,QAAA,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;AAC1B,YAAA,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC;QAC9B;IACD;8GAnKY,4BAA4B,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAA5B,4BAA4B,EAAA,CAAA,CAAA;;2FAA5B,4BAA4B,EAAA,UAAA,EAAA,CAAA;kBADxC;;;ACND;;AAEG;;"}
@@ -1,82 +0,0 @@
1
- export * from '@strivacity/sdk-core/utils/errors';
2
- import { Request as Request$1, Router, Response as Response$1 } from 'express';
3
- import { BaseServerSDK, SDKStorage, CookieOptions, LogoutTokenClaims, ServerSDKInitConfig, ServerSDKOptions, SessionData, SessionIdCookieStorageOptions, ServerStorage } from '@strivacity/sdk-core/types';
4
- export * from '@strivacity/sdk-core/types';
5
- import * as _angular_core from '@angular/core';
6
- import { EnvironmentProviders } from '@angular/core';
7
- export * from '@strivacity/sdk-core/storages';
8
- export * from '@strivacity/sdk-core/utils';
9
-
10
- type AngularServerRequest = Request$1 | Request;
11
- type AngularServerStorage = SDKStorage<[
12
- req?: AngularServerRequest
13
- ], [
14
- req?: Request$1,
15
- res?: Response$1,
16
- cookieOptions?: CookieOptions
17
- ], [
18
- req?: Request$1,
19
- res?: Response$1,
20
- cookieOptions?: CookieOptions
21
- ]> & {
22
- deleteByLogoutToken?(token: LogoutTokenClaims): Promise<void>;
23
- };
24
- type AngularServerSDKOptions<Storage extends AngularServerStorage = AngularServerStorage, StateStorage extends SDKStorage = SDKStorage> = ServerSDKOptions<Storage, StateStorage>;
25
- type AngularServerSDKInitConfig<Storage extends AngularServerStorage = AngularServerStorage, StateStorage extends SDKStorage = SDKStorage> = ServerSDKInitConfig & Partial<AngularServerSDKOptions<Storage, StateStorage>>;
26
- type AngularServerSDK<TEvent extends AngularServerRequest | undefined = AngularServerRequest | undefined> = BaseServerSDK<TEvent> & {
27
- /**
28
- * The Express router exposing the authentication endpoints.
29
- * Mount it under `authUrlPrefix`, e.g. `app.use('/auth', sdk.router)`.
30
- */
31
- readonly handlers: Router;
32
- };
33
-
34
- /**
35
- * Creates the server-side Strivacity SDK: an Express router exposing the auth endpoints and session helpers that can be reused elsewhere on the server.
36
- *
37
- * @param {AngularServerSDKInitConfig} initConfig - The SDK configuration options.
38
- * @returns {AngularServerSDK} The server-side SDK instance.
39
- */
40
- declare function createServerSDK(initConfig: AngularServerSDKInitConfig): AngularServerSDK;
41
-
42
- declare const SESSION_TRANSFER_KEY: _angular_core.StateKey<SessionData | null>;
43
- /**
44
- * Loads the current session from the encrypted cookie storage (using Angular's `REQUEST` token) before the app
45
- * renders, and hands it over to the client through `TransferState`, so `StrivacityAuthService` can hydrate without
46
- * an extra round-trip or a loading flash.
47
- *
48
- * Add this to the server-only `ApplicationConfig` (e.g. `app.config.server.ts`), alongside `provideServerRendering()`.
49
- *
50
- * @param {AngularServerSDK | undefined} serverSdk - The server SDK instance created via `createServerSDK()`, or `undefined` when server-side sessions aren't configured (a no-op in that case).
51
- * @returns {EnvironmentProviders} The providers to add to the server `ApplicationConfig`.
52
- */
53
- declare function provideStrivacityServerSession(serverSdk: AngularServerSDK | undefined): EnvironmentProviders;
54
-
55
- /**
56
- * Creates a session storage that puts a random unique id value cookie on the client and keeping the actual session data in the given `storage`.
57
- *
58
- * @param {SDKStorage} storage - The storage used to persist session data, keyed by a randomly generated session id.
59
- * @param {SessionIdCookieStorageOptions} [options] - Options for the session ID cookie, including default cookie attributes and a UUID generator function.
60
- * @param {Partial<ServerCookieOptions>} [options.defaultCookieOptions] - Default cookie attributes for the session ID cookie.
61
- * @param {() => string} [options.uuidGenerator] - Function to generate a new UUID for the session ID. Defaults to `() => crypto.randomUUID()`.
62
- * @returns {ServerStorage} An object implementing the ServerStorage interface for managing sessions indexed by a session-id cookie.
63
- */
64
- declare function createSessionIdCookieStorage(storage: SDKStorage, options?: SessionIdCookieStorageOptions): ServerStorage;
65
-
66
- /**
67
- * Converts an incoming Express request (or an already-standard `Request`, e.g. Angular's SSR `REQUEST` token) into a standard Web `Request`.
68
- *
69
- * @param {AngularServerRequest} req - The incoming request.
70
- * @returns {Request} The equivalent Web `Request` object.
71
- */
72
- declare function toWebRequest(req: AngularServerRequest): Request;
73
- /**
74
- * Writes a standard Web `Response` (built by the shared server SDK core) onto the Express response.
75
- *
76
- * @param {Response} response - The `Response` to write.
77
- * @param {ExpressResponse} res - The Express response to write to.
78
- */
79
- declare function applyResponse(response: Response, res: Response$1): Promise<void>;
80
-
81
- export { SESSION_TRANSFER_KEY, applyResponse, createServerSDK, createSessionIdCookieStorage, provideStrivacityServerSession, toWebRequest };
82
- export type { AngularServerRequest, AngularServerSDK, AngularServerSDKInitConfig, AngularServerSDKOptions, AngularServerStorage };
@@ -1,41 +0,0 @@
1
- import { SDKInitConfig, NativeParams, SessionData, NativeFlowMessage } from '@strivacity/sdk-core/types';
2
- export * from '@strivacity/sdk-core/types';
3
- import { initFlow } from '@strivacity/sdk-core';
4
- import { FallbackError } from '@strivacity/sdk-core/utils';
5
-
6
- /**
7
- * Configuration used to initialize the Strivacity SDK on the client (browser) side.
8
- */
9
- type AngularSDKInitConfig = SDKInitConfig;
10
- /**
11
- * The concrete SDK flow instance returned by `initFlow`, matching the configured `mode`.
12
- */
13
- type SDKInstance = ReturnType<typeof initFlow>;
14
- type NativeLoginOptions = {
15
- /**
16
- * Optional parameters to be passed to the login session request. These parameters will be sent to the `authorizationUri` endpoint.
17
- */
18
- params?: NativeParams;
19
- /**
20
- * Called when the user successfully completes the login flow.
21
- */
22
- onLogin?: (session: SessionData) => void | Promise<void>;
23
- /**
24
- * Called when the fallback flow is triggered, typically due to an error or unsupported environment.
25
- */
26
- onFallback?: (error: FallbackError) => void | Promise<void>;
27
- /**
28
- * Called when the login flow is closed by the user.
29
- */
30
- onClose?: () => void | Promise<void>;
31
- /**
32
- * Called when an error occurs during the login session initialization or flow.
33
- */
34
- onError?: (error: Error) => void | Promise<void>;
35
- /**
36
- * Called when a global message is received during the login flow.
37
- */
38
- onGlobalMessage?: (message: NativeFlowMessage) => void | Promise<void>;
39
- };
40
-
41
- export type { AngularSDKInitConfig, NativeLoginOptions, SDKInstance };
@@ -1,147 +0,0 @@
1
- export * from '@strivacity/sdk-core/flows';
2
- export * from '@strivacity/sdk-core/handlers';
3
- import { FallbackError } from '@strivacity/sdk-core/utils';
4
- export * from '@strivacity/sdk-core/utils';
5
- import { SDKInitConfig, NativeParams, SessionData, NativeFlowMessage, IdTokenClaims, NativeFlowState } from '@strivacity/sdk-core/types';
6
- export * from '@strivacity/sdk-core/types';
7
- import * as _angular_core from '@angular/core';
8
- import { InjectionToken, ModuleWithProviders, Provider } from '@angular/core';
9
- import * as _strivacity_sdk_core from '@strivacity/sdk-core';
10
- import { initFlow } from '@strivacity/sdk-core';
11
- export { COOKIE_CHUNK_SIZE, COOKIE_CONTEXT, createCacheAPIStorage, createIndexedDBStorage, createLocalStorage, createMemoryStorage, createServerMemoryStorage, createSessionStorage, createWorkerStorage, handleWorkerStorageRequests } from '@strivacity/sdk-core/storages';
12
-
13
- /**
14
- * Configuration used to initialize the Strivacity SDK on the client (browser) side.
15
- */
16
- type AngularSDKInitConfig = SDKInitConfig;
17
- /**
18
- * The concrete SDK flow instance returned by `initFlow`, matching the configured `mode`.
19
- */
20
- type SDKInstance = ReturnType<typeof initFlow>;
21
- type NativeLoginOptions = {
22
- /**
23
- * Optional parameters to be passed to the login session request. These parameters will be sent to the `authorizationUri` endpoint.
24
- */
25
- params?: NativeParams;
26
- /**
27
- * Called when the user successfully completes the login flow.
28
- */
29
- onLogin?: (session: SessionData) => void | Promise<void>;
30
- /**
31
- * Called when the fallback flow is triggered, typically due to an error or unsupported environment.
32
- */
33
- onFallback?: (error: FallbackError) => void | Promise<void>;
34
- /**
35
- * Called when the login flow is closed by the user.
36
- */
37
- onClose?: () => void | Promise<void>;
38
- /**
39
- * Called when an error occurs during the login session initialization or flow.
40
- */
41
- onError?: (error: Error) => void | Promise<void>;
42
- /**
43
- * Called when a global message is received during the login flow.
44
- */
45
- onGlobalMessage?: (message: NativeFlowMessage) => void | Promise<void>;
46
- };
47
-
48
- /**
49
- * Signal-based service exposing the Strivacity SDK state and actions to Angular components.
50
- *
51
- * Provided via `provideStrivacity()` (standalone) or `StrivacityAuthModule.forRoot()` (NgModule).
52
- */
53
- declare class StrivacityAuthService {
54
- private readonly loadingSignal;
55
- private readonly languageSignal;
56
- private readonly isAuthenticatedSignal;
57
- private readonly idTokenClaimsSignal;
58
- private readonly accessTokenSignal;
59
- private readonly refreshTokenSignal;
60
- private readonly accessTokenExpiredSignal;
61
- private readonly accessTokenExpirationDateSignal;
62
- readonly options: _strivacity_sdk_core.SDKInitConfig;
63
- readonly sdk: SDKInstance;
64
- readonly loading: _angular_core.Signal<boolean>;
65
- readonly language: _angular_core.Signal<string>;
66
- readonly isAuthenticated: _angular_core.Signal<boolean>;
67
- readonly idTokenClaims: _angular_core.Signal<IdTokenClaims | null>;
68
- readonly accessToken: _angular_core.Signal<string | null>;
69
- readonly refreshToken: _angular_core.Signal<string | null>;
70
- readonly accessTokenExpired: _angular_core.Signal<boolean>;
71
- readonly accessTokenExpirationDate: _angular_core.Signal<number | null>;
72
- constructor();
73
- init(...args: Parameters<typeof this$1.sdk.init>): ReturnType<typeof this$1.sdk.init>;
74
- subscribeToEvent(...args: Parameters<typeof this$1.sdk.subscribeToEvent>): ReturnType<typeof this$1.sdk.subscribeToEvent>;
75
- subscribeToAllEvents(...args: Parameters<typeof this$1.sdk.subscribeToAllEvents>): ReturnType<typeof this$1.sdk.subscribeToAllEvents>;
76
- checkAuthentication(...args: Parameters<typeof this$1.sdk.checkAuthentication>): ReturnType<typeof this$1.sdk.checkAuthentication>;
77
- tokenExchange(...args: Parameters<typeof this$1.sdk.tokenExchange>): ReturnType<typeof this$1.sdk.tokenExchange>;
78
- handleCallback(...args: Parameters<typeof this$1.sdk.handleCallback>): ReturnType<typeof this$1.sdk.handleCallback>;
79
- refresh(): ReturnType<typeof this$1.sdk.refresh>;
80
- revoke(): ReturnType<typeof this$1.sdk.revoke>;
81
- logout(...args: Parameters<typeof this$1.sdk.logout>): ReturnType<typeof this$1.sdk.logout>;
82
- login(...args: Parameters<typeof this$1.sdk.login>): ReturnType<typeof this$1.sdk.login>;
83
- register(...args: Parameters<typeof this$1.sdk.register>): ReturnType<typeof this$1.sdk.register>;
84
- entry(...args: Parameters<typeof this$1.sdk.entry>): ReturnType<typeof this$1.sdk.entry>;
85
- private updateSession;
86
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityAuthService, never>;
87
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<StrivacityAuthService>;
88
- }
89
-
90
- declare class StrivacityNativeLoginService {
91
- private readonly authService;
92
- private readonly sdk;
93
- private readonly abortController;
94
- private options;
95
- private readonly loadingSignal;
96
- private readonly formsSignal;
97
- private readonly messagesSignal;
98
- private readonly stateSignal;
99
- readonly loading: _angular_core.Signal<boolean>;
100
- readonly forms: _angular_core.Signal<Record<string, Record<string, unknown>>>;
101
- readonly messages: _angular_core.Signal<Record<string, Record<string, NativeFlowMessage>>>;
102
- readonly state: _angular_core.Signal<Partial<NativeFlowState>>;
103
- constructor();
104
- /**
105
- * Starts a native login flow session. Should be called once, from the page component that owns this service.
106
- *
107
- * @param {NativeLoginOptions} [options] - Optional options for the login session.
108
- */
109
- start(options?: NativeLoginOptions): Promise<void>;
110
- submitForm(formId: string, customBody?: Record<string, unknown>): Promise<void>;
111
- setFormValue(formId: string, widgetId: string, value: unknown): void;
112
- setMessage(formId: string, widgetId: string, value: NativeFlowMessage): void;
113
- triggerFallback(message?: string): void;
114
- triggerClose(): void;
115
- private startSession;
116
- private handleResponse;
117
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityNativeLoginService, never>;
118
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<StrivacityNativeLoginService>;
119
- }
120
-
121
- declare const STRIVACITY_SDK: InjectionToken<_strivacity_sdk_core.SDKInitConfig>;
122
- /**
123
- * Provides the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.
124
- *
125
- * This function is used to supply the Strivacity SDK configuration to the application
126
- * by binding it to the `STRIVACITY_SDK` token, and to register `StrivacityAuthService` as an injectable.
127
- *
128
- * @param {AngularSDKInitConfig} config The SDK configuration options.
129
- * @returns {Provider[]} The providers to add to the application (or component) injector.
130
- */
131
- declare function provideStrivacity(config: AngularSDKInitConfig): Provider[];
132
- declare class StrivacityAuthModule {
133
- /**
134
- * Registers the Strivacity SDK configuration and the `StrivacityAuthService` as dependency injection providers.
135
- *
136
- * This is the `NgModule`-based equivalent of `provideStrivacity()`, for applications that still bootstrap via `NgModule`.
137
- *
138
- * @param {AngularSDKInitConfig} options The SDK configuration options.
139
- * @returns {ModuleWithProviders<StrivacityAuthModule>} The module along with its providers, to be imported once at the root of the application.
140
- */
141
- static forRoot(options: AngularSDKInitConfig): ModuleWithProviders<StrivacityAuthModule>;
142
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrivacityAuthModule, never>;
143
- static ɵmod: _angular_core.ɵɵNgModuleDeclaration<StrivacityAuthModule, never, never, never>;
144
- static ɵinj: _angular_core.ɵɵInjectorDeclaration<StrivacityAuthModule>;
145
- }
146
-
147
- export { STRIVACITY_SDK, StrivacityAuthModule, StrivacityAuthService, StrivacityNativeLoginService, provideStrivacity };