@strivacity/sdk-remix 3.0.0-rc.0 → 3.0.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +208 -249
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## 3.0.1 (2026-04-20)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - handle language parameter from response body url correctly ([e42294b](https://github.com/Strivacity/sdk-js/commit/e42294b))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated sdk-core to 3.0.1
10
+
11
+ # 3.0.0 (2026-04-09)
12
+
13
+ ### 🚀 Features
14
+
15
+ - ⚠️ EmbeddedFlow implemented ([a0e3ad8](https://github.com/Strivacity/sdk-js/commit/a0e3ad8))
16
+ - ⚠️ NativeFlow entry function now returns an object instead of a string ([9a8942d](https://github.com/Strivacity/sdk-js/commit/9a8942d))
17
+
18
+ ### ⚠️ Breaking Changes
19
+
20
+ - EmbeddedFlow implemented ([a0e3ad8](https://github.com/Strivacity/sdk-js/commit/a0e3ad8))
21
+ - NativeFlow entry function now returns an object instead of a string ([9a8942d](https://github.com/Strivacity/sdk-js/commit/9a8942d))
22
+
23
+ ### 🧱 Updated Dependencies
24
+
25
+ - Updated sdk-core to 3.0.0
26
+
1
27
  ## 3.0.0-rc.0 (2026-02-18)
2
28
 
3
29
  ### 🚀 Features
package/README.md CHANGED
@@ -1,11 +1,21 @@
1
1
  # @strivacity/sdk-remix
2
2
 
3
- > **The SDK supports Remix version 2 and above**
3
+ A Remix library that integrates Strivacity's policy-driven authentication journeys into your application using the OAuth 2.0 PKCE flow. Supports `redirect`, `popup`, `native`, and `embedded` modes.
4
4
 
5
- ## Example App
5
+ See our [Developer Portal](https://www.strivacity.com/learn-support/developer-hub) to get started with developing with the Strivacity product.
6
+
7
+ ## Overview
8
+
9
+ This SDK allows you to integrate Strivacity's policy-driven journeys into your Remix application. It wraps the `@strivacity/sdk-core` library as a React context provider and exposes a `useStrivacity` hook that provides authentication state and methods throughout your component tree. The SDK uses the OAuth 2.0 PKCE flow to authenticate with Strivacity. For detailed configuration options, available modes, and advanced usage refer to the [`@strivacity/sdk-core` documentation](https://github.com/Strivacity/sdk-js/blob/main/packages/sdk-core/README.md).
10
+
11
+ ## Demo Application
6
12
 
7
13
  - [Example app](https://github.com/Strivacity/sdk-js/tree/main/apps/remix)
8
14
 
15
+ ## Requirements
16
+
17
+ - Remix: 2+
18
+
9
19
  ## Install
10
20
 
11
21
  ```bash
@@ -14,48 +24,45 @@ npm install @strivacity/sdk-remix
14
24
 
15
25
  ## Usage
16
26
 
17
- ### Wrap your app with `StyAuthProvider`
27
+ ### Initialization
18
28
 
19
- Add the `StyAuthProvider` to your `main.tsx` file.
29
+ Wrap your application with `StyAuthProvider` in your root layout:
20
30
 
21
31
  ```tsx
22
- import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
23
- import { StyAuthProvider, type SDKOptions } from '@strivacity/sdk-react';
32
+ import { StyAuthProvider, type SDKOptions } from '@strivacity/sdk-remix';
24
33
 
25
34
  const options: SDKOptions = {
26
- mode: 'redirect', // or 'popup' or 'native'
35
+ mode: 'redirect', // or 'popup', 'native', 'embedded'
27
36
  issuer: 'https://<YOUR_DOMAIN>',
28
37
  scopes: ['openid', 'profile'],
29
38
  clientId: '<YOUR_CLIENT_ID>',
30
39
  redirectUri: '<YOUR_REDIRECT_URI>',
31
40
  };
32
41
 
33
- createRoot(document.getElementById('app')!).render(
34
- <BrowserRouter>
42
+ export default function App() {
43
+ return (
35
44
  <StyAuthProvider options={options}>
36
- <Routes>
37
- <Route path="/" element={<App />}>
38
- ...
39
- </Route>
40
- </Routes>
45
+ <Outlet />
41
46
  </StyAuthProvider>
42
- </BrowserRouter>,
43
- );
47
+ );
48
+ }
44
49
  ```
45
50
 
46
- ### How to use the SDK in your components:
47
-
48
- #### Redirect or popup mode
51
+ Use the `useStrivacity` hook in any component to access authentication state:
49
52
 
50
- When using redirect or popup mode, the authentication flow involves two main components: a login page that initiates the authentication process, and a callback page that handles the response from the identity provider.
53
+ ```tsx
54
+ import { useStrivacity } from '@strivacity/sdk-remix';
51
55
 
52
- In **redirect mode**, users are redirected to the identity provider's login page in the same browser window. After successful authentication, they are redirected back to your application's callback URL.
56
+ export default function MyComponent() {
57
+ const { loading, isAuthenticated, idTokenClaims } = useStrivacity();
58
+ }
59
+ ```
53
60
 
54
- In **popup mode**, the authentication happens in a popup window, allowing the main application to remain open while the user authenticates.
61
+ ### Redirect / Popup mode
55
62
 
56
- ##### Login page example
63
+ In `redirect` mode the user is taken to the identity provider in the same window; in `popup` mode authentication happens in a popup. Both are initiated the same way from code.
57
64
 
58
- The login page is where users start the authentication process. This component automatically triggers the login flow when the page loads, redirecting users to the identity provider for authentication.
65
+ #### Login page example
59
66
 
60
67
  ```tsx
61
68
  import { useEffect } from 'react';
@@ -76,9 +83,9 @@ export default function Login() {
76
83
  }
77
84
  ```
78
85
 
79
- ##### Callback page example
86
+ #### Callback page example
80
87
 
81
- The callback page handles the response from the identity provider after successful authentication. It processes the authentication result, extracts the tokens, and redirects users to their intended destination (typically a protected page like a profile or dashboard).
88
+ The callback page handles the response from the identity provider. It calls `handleCallback()` and redirects to `/profile` on success:
82
89
 
83
90
  ```tsx
84
91
  import { useEffect } from 'react';
@@ -108,11 +115,7 @@ export default function Callback() {
108
115
  }
109
116
  ```
110
117
 
111
- ##### Profile page example
112
-
113
- The profile page displays user information and authentication details after successful login. It uses the `useStrivacity` hook to access the authentication state and display relevant data such as access tokens, ID token claims, and expiration status.
114
-
115
- We check if the user is authenticated and display their profile information. If the user is not authenticated, we redirect them to the login page.
118
+ #### Profile page example
116
119
 
117
120
  ```tsx
118
121
  import { useStrivacity } from '@strivacity/sdk-remix';
@@ -163,11 +166,9 @@ export default function Profile() {
163
166
  }
164
167
  ```
165
168
 
166
- ##### Logout page example
169
+ #### Logout page example
167
170
 
168
- The logout page handles user logout by terminating their session. The `postLogoutRedirectUri` parameter is optional and specifies where users should be redirected after logout. If not provided, users will be redirected to the identity provider's logout page.
169
-
170
- This URI must be configured in the Admin Console as an allowed post-logout redirect URI for your application.
171
+ The `postLogoutRedirectUri` parameter is optional and specifies where users are redirected after logout. This URI must be configured in the Admin Console as an allowed post-logout redirect URI.
171
172
 
172
173
  ```tsx
173
174
  import { useEffect } from 'react';
@@ -196,15 +197,34 @@ export default function Logout() {
196
197
  }
197
198
  ```
198
199
 
199
- #### Native mode
200
+ #### Component example
200
201
 
201
- If you are using `native` mode, you can use the `StyLoginRenderer` component to render the login UI.
202
+ ```tsx
203
+ import { useStrivacity } from '@strivacity/sdk-remix';
202
204
 
203
- To customize the UI components used in the authentication flows, define the `widgets` object in your component.
205
+ export default function Nav() {
206
+ const { isAuthenticated, idTokenClaims, login, logout } = useStrivacity();
207
+ const name = `${idTokenClaims?.given_name} ${idTokenClaims?.family_name}`;
208
+
209
+ return isAuthenticated ? (
210
+ <div>
211
+ <div>Welcome, {name}!</div>
212
+ <button onClick={() => logout()}>Logout</button>
213
+ </div>
214
+ ) : (
215
+ <div>
216
+ <div>Not logged in</div>
217
+ <button onClick={() => login()}>Log in</button>
218
+ </div>
219
+ );
220
+ }
221
+ ```
222
+
223
+ ### Native mode
204
224
 
205
- ###### Example widgets
225
+ In `native` mode the `StyLoginRenderer` component renders the authentication UI inline using your custom widget components. You can define custom components for each input type; see [Example widgets](https://github.com/Strivacity/sdk-js/tree/main/apps/remix/app/components/widgets).
206
226
 
207
- The example widgets use SCSS for styling and Luxon for date handling. You'll need to install these dependencies:
227
+ The example widgets use SCSS for styling and Luxon for date handling:
208
228
 
209
229
  ```bash
210
230
  npm install sass luxon
@@ -241,110 +261,71 @@ export const widgets = {
241
261
  };
242
262
  ```
243
263
 
244
- You can find example widgets here: [Example widgets](https://github.com/Strivacity/sdk-js/tree/main/apps/remix/src/components/widgets)
245
-
246
- ##### Login page example
264
+ #### Login page example
247
265
 
248
- The native mode login page provides a fully customizable authentication experience rendered directly within your application. Unlike redirect or popup modes, native mode keeps users on your site throughout the entire authentication process using the `StyLoginRenderer` component.
249
-
250
- This example demonstrates how to handle session management, implement callback functions for various authentication events, and manage URL parameters for session continuity.
266
+ 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 overrides `uiLocales` to display the authentication UI in the specified language.
251
267
 
252
268
  ```tsx
253
- import { Suspense, useEffect, useState } from 'react';
269
+ import { useEffect, useState } from 'react';
254
270
  import { useNavigate } from 'react-router-dom';
255
- import { useStrivacity, StyLoginRenderer, FallbackError, type LoginFlowState } from '@strivacity/sdk-remix';
256
- import { widgets } from '@/components/widgets';
271
+ import { StyLoginRenderer, FallbackError, type LoginFlowState } from '@strivacity/sdk-remix';
272
+ import { widgets } from '~/components/widgets';
257
273
 
258
274
  export default function Login() {
259
275
  const navigate = useNavigate();
260
- const { options, login } = useStrivacity();
261
276
  const [sessionId, setSessionId] = useState<string | null>(null);
262
277
 
263
- /**
264
- * Extract session_id from URL parameters and clean up the URL
265
- * This is necessary for maintaining session state across external login providers
266
- */
267
278
  useEffect(() => {
268
279
  if (window.location.search !== '') {
269
280
  const url = new URL(window.location.href);
270
- const sid = url.searchParams.get('session_id');
271
- setSessionId(sid);
281
+ setSessionId(url.searchParams.get('session_id'));
272
282
  url.search = '';
273
283
  window.history.replaceState({}, '', url.toString());
274
284
  }
275
285
  }, []);
276
286
 
277
- /**
278
- * Called when authentication is successful
279
- * Redirects user to the profile page
280
- */
281
287
  const onLogin = async () => {
282
288
  await navigate('/profile');
283
289
  };
284
290
 
285
- /**
286
- * Called when native flow cannot handle the authentication
287
- * Falls back to redirect mode by navigating to the provided URL
288
- * @param error - FallbackError containing the fallback URL and message
289
- */
290
291
  const onFallback = (error: FallbackError) => {
291
292
  if (error.url) {
292
- console.log(`Fallback: ${error.url}`);
293
293
  window.location.href = error.url.toString();
294
294
  } else {
295
- console.error(`FallbackError without URL: ${error.message}`);
296
295
  alert(error);
297
296
  }
298
297
  };
299
298
 
300
- /**
301
- * Called when an error occurs during the authentication process
302
- * @param error - Error message describing what went wrong
303
- */
304
299
  const onError = (error: string) => {
305
- console.error(`Error: ${error}`);
306
300
  alert(error);
307
301
  };
308
302
 
309
- /**
310
- * Called when the authentication flow wants to display a global message
311
- * @param message - Message to display to the user
312
- */
313
303
  const onGlobalMessage = (message: string) => {
314
304
  alert(message);
315
305
  };
316
306
 
317
- /**
318
- * Called when the authentication flow transitions between states
319
- * Useful for tracking flow progress and inject custom logic such as logging or analytics
320
- * @param params - Object containing previous and current flow states
321
- */
322
307
  const onBlockReady = ({ previousState, state }: { previousState: LoginFlowState; state: LoginFlowState }) => {
323
308
  console.log('previousState', previousState);
324
309
  console.log('state', state);
325
310
  };
326
311
 
327
312
  return (
328
- <Suspense fallback={<span>Loading...</span>}>
329
- <StyLoginRenderer
330
- widgets={widgets}
331
- sessionId={sessionId}
332
- onFallback={onFallback}
333
- onLogin={() => void onLogin()}
334
- onError={onError}
335
- onGlobalMessage={onGlobalMessage}
336
- onBlockReady={onBlockReady}
337
- />
338
- </Suspense>
313
+ <StyLoginRenderer
314
+ widgets={widgets}
315
+ sessionId={sessionId}
316
+ onFallback={onFallback}
317
+ onLogin={() => void onLogin()}
318
+ onError={onError}
319
+ onGlobalMessage={onGlobalMessage}
320
+ onBlockReady={onBlockReady}
321
+ />
339
322
  );
340
323
  }
341
324
  ```
342
325
 
343
- ##### Callback page example
344
-
345
- The native mode callback page handles authentication responses when external identity providers redirect back to your application. This page checks for session IDs in the URL parameters and either continues the native flow or falls back to standard callback handling.
326
+ #### Callback page example
346
327
 
347
- This component is essential for handling social login providers (like Google, Facebook, etc.) that require redirect-based authentication even within native mode flows.
328
+ When a `session_id` is present in the URL the native flow is resumed by forwarding it to the login page. Otherwise the standard `handleCallback()` path is used:
348
329
 
349
330
  ```tsx
350
331
  import { useEffect } from 'react';
@@ -352,7 +333,6 @@ import { useNavigate } from 'react-router-dom';
352
333
  import { useStrivacity } from '@strivacity/sdk-remix';
353
334
 
354
335
  export default function Callback() {
355
- const query = globalThis?.window ? Object.fromEntries(new URLSearchParams(globalThis.window.location.search)) : {};
356
336
  const navigate = useNavigate();
357
337
  const { handleCallback } = useStrivacity();
358
338
 
@@ -374,45 +354,96 @@ export default function Callback() {
374
354
  })();
375
355
  }, []);
376
356
 
377
- if (query.error) {
378
- return (
379
- <section>
380
- <h1>Error in authentication</h1>
381
- <div>
382
- <h4>{query.error}</h4>
383
- <p>{query.error_description}</p>
384
- </div>
385
- </section>
386
- );
387
- } else {
388
- return (
389
- <section>
390
- <h1>Logging in...</h1>
391
- </section>
392
- );
393
- }
357
+ return (
358
+ <section>
359
+ <h1>Logging in...</h1>
360
+ </section>
361
+ );
362
+ }
363
+ ```
364
+
365
+ #### Entry page example
366
+
367
+ The entry page processes flows started by an external process (e.g. password reset) by calling `entry()` to extract the necessary parameters to resume the flow and forwarding them to the callback page:
368
+
369
+ ```tsx
370
+ import { useEffect } from 'react';
371
+ import { useNavigate } from 'react-router-dom';
372
+ import { useStrivacity } from '@strivacity/sdk-remix';
373
+
374
+ export default function Entry() {
375
+ const navigate = useNavigate();
376
+ const { entry } = useStrivacity();
377
+
378
+ useEffect(() => {
379
+ (async () => {
380
+ try {
381
+ const data = await entry();
382
+
383
+ if (data && Object.keys(data).length > 0) {
384
+ await navigate(`/callback?${new URLSearchParams(data).toString()}`);
385
+ } else {
386
+ await navigate('/');
387
+ }
388
+ } catch (error) {
389
+ console.error('Entry failed:', error);
390
+ await navigate('/');
391
+ }
392
+ })();
393
+ }, []);
394
+
395
+ return (
396
+ <section>
397
+ <h1>Loading...</h1>
398
+ </section>
399
+ );
394
400
  }
395
401
  ```
396
402
 
397
- ##### Profile page example
403
+ #### Profile page example
398
404
 
399
405
  Same as the profile page example in redirect/popup mode.
400
406
 
401
- ##### Logout page example
407
+ #### Logout page example
402
408
 
403
409
  Same as the logout page example in redirect/popup mode.
404
410
 
411
+ ### Embedded mode
412
+
413
+ In `embedded` mode the `<sty-login>` web component (loaded via `bundle.js` from the cluster) handles rendering. Import the bundle at application startup to register the Strivacity web components:
414
+
415
+ ```tsx
416
+ import { StyAuthProvider } from '@strivacity/sdk-remix';
417
+
418
+ void import(`${window.ENV.VITE_ISSUER}/assets/components/bundle.js`);
419
+
420
+ export default function App() {
421
+ return (
422
+ <StyAuthProvider
423
+ options={{
424
+ mode: 'embedded',
425
+ issuer: 'https://<YOUR_DOMAIN>',
426
+ scopes: ['openid', 'profile'],
427
+ clientId: '<YOUR_CLIENT_ID>',
428
+ redirectUri: '<YOUR_REDIRECT_URI>',
429
+ }}
430
+ >
431
+ <Outlet />
432
+ </StyAuthProvider>
433
+ );
434
+ }
435
+ ```
436
+
405
437
  ## Logging
406
438
 
407
439
  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.
408
440
 
409
441
  ### Using the Default Logger
410
442
 
411
- Enable the default console logger by adding the `logging` option when creating the SDK:
443
+ Enable the default console logger by adding the `logging` option:
412
444
 
413
445
  ```tsx
414
- import { BrowserRouter, Routes } from 'react-router-dom';
415
- import { StyAuthProvider, type SDKOptions, DefaultLogging } from '@strivacity/sdk-remix';
446
+ import { StyAuthProvider, DefaultLogging, type SDKOptions } from '@strivacity/sdk-remix';
416
447
 
417
448
  const options: SDKOptions = {
418
449
  mode: 'redirect',
@@ -420,23 +451,13 @@ const options: SDKOptions = {
420
451
  scopes: ['openid', 'profile'],
421
452
  clientId: '<YOUR_CLIENT_ID>',
422
453
  redirectUri: '<YOUR_REDIRECT_URI>',
423
- logging: DefaultLogging, // Enable built-in console logging
454
+ logging: DefaultLogging,
424
455
  };
425
-
426
- createRoot(document.getElementById('app')!).render(
427
- <BrowserRouter>
428
- <StyAuthProvider options={options}>
429
- <Routes>{/* Your routes */}</Routes>
430
- </StyAuthProvider>
431
- </BrowserRouter>,
432
- );
433
456
  ```
434
457
 
435
- The default logger writes to the browser console and automatically prefixes messages with a correlation ID when available (via the `xEventId` property).
436
-
437
458
  ### Creating a Custom Logger
438
459
 
439
- 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.
460
+ Implement the `SDKLogging` interface and pass your class to the `logging` option:
440
461
 
441
462
  ```typescript
442
463
  import type { SDKLogging } from '@strivacity/sdk-remix';
@@ -445,7 +466,6 @@ export class MyLogger implements SDKLogging {
445
466
  xEventId?: string;
446
467
 
447
468
  debug(message: string): void {
448
- // Send to your logging pipeline
449
469
  console.debug(this.xEventId ? `[${this.xEventId}] ${message}` : message);
450
470
  }
451
471
 
@@ -463,161 +483,100 @@ export class MyLogger implements SDKLogging {
463
483
  }
464
484
  ```
465
485
 
466
- Then register your custom logger when creating the SDK:
486
+ 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.
467
487
 
468
- ```tsx
469
- import { StyAuthProvider } from '@strivacity/sdk-remix';
470
- import { MyLogger } from './logging/MyLogger';
488
+ ## API Documentation
471
489
 
472
- const options: SDKOptions = {
473
- mode: 'redirect',
474
- issuer: 'https://<YOUR_DOMAIN>',
475
- scopes: ['openid', 'profile'],
476
- clientId: '<YOUR_CLIENT_ID>',
477
- redirectUri: '<YOUR_REDIRECT_URI>',
478
- logging: MyLogger, // Use your custom logger
479
- };
480
- ```
481
-
482
- ### Logger Interface
483
-
484
- The `SDKLogging` interface requires the following methods:
485
-
486
- - **`debug(message: string): void`** - Log debug-level messages
487
- - **`info(message: string): void`** - Log informational messages
488
- - **`warn(message: string): void`** - Log warning messages
489
- - **`error(message: string, error: Error): void`** - Log error messages with error objects
490
-
491
- The optional `xEventId` property, when set by the SDK, provides a correlation ID to trace related log messages across the authentication flow.
492
-
493
- ### API Documentation
494
-
495
- #### `useStrivacity` hook
490
+ ### `useStrivacity` hook
496
491
 
497
492
  ```typescript
498
493
  useStrivacity<T extends PopupContext | RedirectContext | NativeContext>(): T;
499
494
  ```
500
495
 
501
- You can choose between `PopupContext`, `RedirectContext`, or `NativeContext` with the `mode` option when you configure the sdk options.
496
+ The hook returns a different context type depending on the `mode` configured in `StyAuthProvider`.
502
497
 
503
- **Properties**
498
+ **Shared properties (all modes)**
504
499
 
505
- - **`loading: boolean`**: Indicates if the session is being loaded.
506
- - **`isAuthenticated: boolean`**: Indicates whether the user is authenticated.
507
- - **`idTokenClaims: IdTokenClaims | null`**: Claims from the ID token or null if not available.
508
- - **`accessToken: string | null`**: The access token or null if not available.
509
- - **`refreshToken: string | null`**: The refresh token or null if not available.
510
- - **`accessTokenExpired: boolean`**: Indicates if the access token has expired.
511
- - **`accessTokenExpirationDate: number | null`**: Expiration date of the access token or null if not set.
500
+ - **`sdk: RedirectFlow | PopupFlow | NativeFlow`**: The underlying SDK flow instance.
501
+ - **`loading: boolean`**: `true` while the session is being initialized.
502
+ - **`options: SDKOptions`**: The configured SDK options.
503
+ - **`isAuthenticated: boolean`**: `true` when the user has a valid session.
504
+ - **`idTokenClaims: IdTokenClaims | null`**: Claims from the ID token, or `null` if not authenticated.
505
+ - **`accessToken: string | null`**: The current access token.
506
+ - **`refreshToken: string | null`**: The current refresh token.
507
+ - **`accessTokenExpired: boolean`**: `true` when the access token has expired.
508
+ - **`accessTokenExpirationDate: number | null`**: Expiration timestamp (Unix seconds) of the access token.
512
509
 
513
510
  ---
514
511
 
515
- Type: `RedirectContext`
516
- Represents the available methods for Redirect-based interactions.
512
+ **Type: `RedirectContext`**
517
513
 
518
- - **`login(options?: LoginOptions): Promise<void>`**: Initiates the login process by redirecting the user to the identity provider.
519
- - `options` (optional): Configuration options for login.
520
- - **`register(options?: RegisterOptions): Promise<void>`**: Registers a new user using a redirect flow.
521
- - `options` (optional): Configuration options for registration.
522
- - **`refresh(): Promise<void>`**: Refreshes the user's session using a redirect flow.
523
- - **`revoke(): Promise<void>`**: Revokes the current session tokens using a redirect flow.
524
- - **`logout(options?: LogoutOptions): Promise<void>`**: Logs out the user by redirecting to the identity provider.
525
- - `options` (optional): Configuration options for logout.
526
- - **`handleCallback(url?: string): Promise<void>`**: Handles the callback after a redirect-based authentication or token exchange.
527
- - `url` (optional): The URL to handle for the callback.
514
+ - **`login(options?: LoginOptions): Promise<void>`**: Initiates login by redirecting to the identity provider.
515
+ - **`register(options?: RegisterOptions): Promise<void>`**: Initiates registration using a redirect flow.
516
+ - **`refresh(): Promise<void>`**: Refreshes the user's session.
517
+ - **`revoke(): Promise<void>`**: Revokes the current session tokens.
518
+ - **`logout(options?: LogoutOptions): Promise<void>`**: Logs the user out via redirect.
519
+ - **`handleCallback(url?: string): Promise<void>`**: Processes the authorization callback after redirect.
520
+ - **`entry(): Promise<Record<string, string>>`**: Processes an externally-initiated flow URL and returns the parameters needed to resume the flow.
528
521
 
529
522
  ---
530
523
 
531
- Type: `PopupContext`
532
- Represents the available methods for Popup-based interactions.
524
+ **Type: `PopupContext`**
533
525
 
534
- - **`login(options?: LoginOptions): Promise<void>`**: Initiates the login process using a popup window.
535
- - `options` (optional): Configuration options for login.
536
- - **`register(options?: RegisterOptions): Promise<void>`**: Registers a new user using a popup flow.
537
- - `options` (optional): Configuration options for registration.
538
- - **`refresh(): Promise<void>`**: Refreshes the user's session using a popup.
539
- - **`revoke(): Promise<void>`**: Revokes the current session tokens using a popup flow.
540
- - **`logout(options?: LogoutOptions): Promise<void>`**: Logs out the user using a popup window.
541
- - `options` (optional): Configuration options for logout.
542
- - **`handleCallback(url?: string): Promise<void>`**: Handles the callback after a popup-based authentication or token exchange.
543
- - `url` (optional): The URL to handle for the callback.
526
+ - **`login(options?: LoginOptions): Promise<void>`**: Initiates login using a popup window.
527
+ - **`register(options?: RegisterOptions): Promise<void>`**: Initiates registration using a popup.
528
+ - **`refresh(): Promise<void>`**: Refreshes the user's session.
529
+ - **`revoke(): Promise<void>`**: Revokes the current session tokens.
530
+ - **`logout(options?: LogoutOptions): Promise<void>`**: Logs the user out via popup.
531
+ - **`handleCallback(url?: string): Promise<void>`**: Processes the authorization callback.
532
+ - **`entry(): Promise<Record<string, string>>`**: Processes an externally-initiated flow URL.
544
533
 
545
534
  ---
546
535
 
547
- Type: `NativeContext`
548
- Represents the available methods for native-based interactions.
536
+ **Type: `NativeContext`**
549
537
 
550
- - **`login(options?: LoginOptions): Promise<NativeFlowHandler>`**: Initiates the login process using a native flow.
551
- - `options` (optional): Configuration options for login.
552
- - **`register(options?: RegisterOptions): Promise<NativeFlowHandler>`**: Registers a new user using a native flow.
553
- - `options` (optional): Configuration options for registration.
538
+ - **`login(options?: LoginOptions): Promise<NativeFlowHandler>`**: Initiates login using the native flow.
539
+ - **`register(options?: RegisterOptions): Promise<NativeFlowHandler>`**: Initiates registration using the native flow.
554
540
  - **`refresh(): Promise<void>`**: Refreshes the user's session.
555
541
  - **`revoke(): Promise<void>`**: Revokes the current session tokens.
556
- - **`logout(options?: LogoutOptions): Promise<void>`**: Logs out the user by redirecting to the logout page.
557
- - `options` (optional): Configuration options for logout.
558
- - **`handleCallback(url?: string): Promise<void>`**: Handles the callback after a redirect-based authentication. This will be called automatically by the native flow handler during fallback.
559
- - `url` (optional): The URL to handle for the callback.
560
-
561
- #### `StyLoginRenderer` component
562
-
563
- The `StyLoginRenderer` component is used in native mode to render the authentication UI directly within your application. It provides a fully customizable login experience using your own UI components.
542
+ - **`logout(options?: LogoutOptions): Promise<void>`**: Logs the user out via redirect.
543
+ - **`handleCallback(url?: string): Promise<void>`**: Processes the authorization callback.
544
+ - **`entry(): Promise<Record<string, string>>`**: Processes an externally-initiated flow URL.
564
545
 
565
- ```typescript
566
- StyLoginRenderer: React.FC<{
567
- params?: NativeParams;
568
- widgets?: PartialRecord<WidgetType, React.ComponentType<any>>;
569
- sessionId?: string | null;
570
- onLogin?: (claims?: IdTokenClaims | null) => void;
571
- onFallback?: (error: FallbackError) => void;
572
- onError?: (error: any) => void;
573
- onGlobalMessage?: (message: string) => void;
574
- onBlockReady?: ({ previousState, state }: { previousState: LoginFlowState; state: LoginFlowState }) => void;
575
- }>;
576
- ```
577
-
578
- **Properties**
579
-
580
- - **`params?: NativeParams`** (optional): Additional parameters to pass to the native login flow. These parameters can include custom configuration options for the authentication process.
581
-
582
- - **`widgets?: PartialRecord<WidgetType, React.ComponentType<any>>`** (optional): A collection of React components that define the UI widgets used in the authentication flow. Each widget type (input, button, layout, etc.) can be customized with your own components.
546
+ ---
583
547
 
584
- - **`sessionId?: string | null`** (optional): The session ID for continuing an existing authentication session. This is typically extracted from URL parameters when returning from external identity providers.
548
+ ### `StyLoginRenderer` component
585
549
 
586
- - **`onLogin?: (claims?: IdTokenClaims | null) => void`** (optional): Callback function called when authentication is successful. Receives the ID token claims as a parameter.
550
+ Used in `native` mode to render the authentication UI with your own widget components.
587
551
 
588
- - **`onFallback?: (error: FallbackError) => void`** (optional): Callback function called when the native flow cannot handle the authentication and needs to fall back to redirect mode. The error parameter contains the fallback URL.
552
+ **Props**
589
553
 
590
- - **`onError?: (error: any) => void`** (optional): Callback function called when an error occurs during the authentication process. Use this to handle and display error messages to users.
554
+ - **`params?: NativeParams`**: Additional parameters for the native login flow.
555
+ - **`widgets?: PartialRecord<WidgetType, React.ComponentType>`**: Custom React components for each widget type used in the flow.
556
+ - **`sessionId?: string | null`**: Session ID for resuming an existing authentication session.
591
557
 
592
- - **`onGlobalMessage?: (message: string) => void`** (optional): Callback function called when the authentication flow wants to display a global message to the user (e.g., account lockout warnings, validation messages).
558
+ **Event callbacks**
593
559
 
594
- - **`onBlockReady?: ({ previousState, state }: { previousState: LoginFlowState; state: LoginFlowState }) => void`** (optional): Callback function called when the authentication flow transitions between states. Useful for tracking progress, implementing custom logging, or injecting analytics. Receives both the previous and current flow states.
560
+ - **`onLogin`**: Called on successful authentication. Receives `IdTokenClaims | null`.
561
+ - **`onFallback`**: Called when the native flow needs to fall back to redirect. Receives `FallbackError` with a fallback URL.
562
+ - **`onError`**: Called when an error occurs during authentication.
563
+ - **`onGlobalMessage`**: Called when the flow wants to display a global message (e.g. account lockout warning).
564
+ - **`onBlockReady`**: Called on flow state transitions. Receives `{ previousState: LoginFlowState; state: LoginFlowState }`. Useful for analytics and custom logging.
595
565
 
596
- **Widget Types**
566
+ ## Vulnerability Reporting
597
567
 
598
- The `widgets` prop accepts the following widget types:
568
+ The [Guidelines for responsible disclosure](https://www.strivacity.com/report-a-security-issue) details the procedure for disclosing security issues. Please do not report security vulnerabilities on the public issue tracker.
599
569
 
600
- - `checkbox`: For checkbox input fields
601
- - `date`: For date input fields
602
- - `input`: For text input fields
603
- - `layout`: For layout containers and form structure
604
- - `loading`: For loading indicators
605
- - `multiSelect`: For multi-select dropdown fields
606
- - `passcode`: For passcode input fields
607
- - `password`: For password input fields
608
- - `phone`: For phone number input fields
609
- - `select`: For single-select dropdown fields
610
- - `static`: For static text and display elements
611
- - `submit`: For form submission buttons
570
+ ## License
612
571
 
613
- Each widget component receives props specific to its type and function within the authentication flow.
572
+ @strivacity/sdk-remix is available under the MIT License. See the [LICENSE](https://github.com/Strivacity/sdk-js/blob/main/LICENSE) file for more info.
614
573
 
615
- ### Links
574
+ ## Contributing
616
575
 
617
- [Example app](https://github.com/Strivacity/sdk-js/tree/main/apps/remix)
576
+ Please see our [contributing guide](https://github.com/Strivacity/sdk-js/blob/main/CONTRIBUTING.md).
618
577
 
619
578
  ## Migrating to v3.0
620
579
 
621
580
  ### Entry API Major Changes
622
581
 
623
- Strivacity SDK's `entry()` API now returns a structured object instead of a plain string. To see examples of these changes, check the apps folder in this repository.
582
+ Strivacity SDK's `entry()` API now returns a structured object instead of a plain string. Check the example above in the usage section for more details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strivacity/sdk-remix",
3
- "version": "3.0.0-rc.0",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "description": "Strivacity Remix SDK client",
6
6
  "author": "strivacity <opensource@strivacity.com>",
@@ -9,7 +9,7 @@
9
9
  "url": "https://github.com/Strivacity/sdk-js"
10
10
  },
11
11
  "dependencies": {
12
- "@strivacity/sdk-core": "3.0.0-rc.0"
12
+ "@strivacity/sdk-core": "3.0.1"
13
13
  },
14
14
  "peerDependencies": {
15
15
  "react": ">=18"