@forgerock/login-widget 1.0.0-beta.15 → 1.0.0-beta.17

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/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "require": "./widget.css"
12
12
  }
13
13
  },
14
- "types": "./index.d.ts",
14
+ "types": "./types.d.ts",
15
15
  "dependencies": {},
16
- "version": "1.0.0-beta.15"
16
+ "version": "1.0.0-beta.17"
17
17
  }
@@ -1,3 +1,44 @@
1
+ /**
2
+ * An event-handling function.
3
+ */
4
+ declare type Listener = (e: FREvent) => void;
5
+ interface FREvent {
6
+ type: string;
7
+ }
8
+
9
+ /**
10
+ * Event dispatcher for subscribing and publishing categorized events.
11
+ */
12
+ declare class Dispatcher {
13
+ private callbacks;
14
+ /**
15
+ * Subscribes to an event type.
16
+ *
17
+ * @param type The event type
18
+ * @param listener The function to subscribe to events of this type
19
+ */
20
+ addEventListener(type: string, listener: Listener): void;
21
+ /**
22
+ * Unsubscribes from an event type.
23
+ *
24
+ * @param type The event type
25
+ * @param listener The function to unsubscribe from events of this type
26
+ */
27
+ removeEventListener(type: string, listener: Listener): void;
28
+ /**
29
+ * Unsubscribes all listener functions to a single event type or all event types.
30
+ *
31
+ * @param type The event type, or all event types if not specified
32
+ */
33
+ clearEventListeners(type?: string): void;
34
+ /**
35
+ * Publishes an event.
36
+ *
37
+ * @param event The event object to publish
38
+ */
39
+ dispatchEvent<T extends FREvent>(event: T): void;
40
+ }
41
+
1
42
  declare enum ActionTypes {
2
43
  Authenticate = "AUTHENTICATE",
3
44
  Authorize = "AUTHORIZE",
@@ -51,7 +92,7 @@ declare enum CallbackType {
51
92
  /**
52
93
  * Represents the authentication tree API payload schema.
53
94
  */
54
- interface Step {
95
+ interface Step$1 {
55
96
  authId?: string;
56
97
  callbacks?: Callback[];
57
98
  code?: number;
@@ -79,7 +120,7 @@ interface StepDetail {
79
120
  * Represents configuration overrides used when requesting the next
80
121
  * step in an authentication tree.
81
122
  */
82
- interface StepOptions extends ConfigOptions {
123
+ interface StepOptions extends ConfigOptions$1 {
83
124
  query?: StringDict<string>;
84
125
  }
85
126
  /**
@@ -176,7 +217,7 @@ interface Action {
176
217
  /**
177
218
  * Configuration options.
178
219
  */
179
- interface ConfigOptions {
220
+ interface ConfigOptions$1 {
180
221
  callbackFactory?: FRCallbackFactory;
181
222
  clientId?: string;
182
223
  middleware?: RequestMiddleware[];
@@ -224,47 +265,6 @@ interface TokenStoreObject {
224
265
  remove: (clientId: string) => Promise<void>;
225
266
  }
226
267
 
227
- /**
228
- * An event-handling function.
229
- */
230
- declare type Listener = (e: FREvent) => void;
231
- interface FREvent {
232
- type: string;
233
- }
234
-
235
- /**
236
- * Event dispatcher for subscribing and publishing categorized events.
237
- */
238
- declare class Dispatcher {
239
- private callbacks;
240
- /**
241
- * Subscribes to an event type.
242
- *
243
- * @param type The event type
244
- * @param listener The function to subscribe to events of this type
245
- */
246
- addEventListener(type: string, listener: Listener): void;
247
- /**
248
- * Unsubscribes from an event type.
249
- *
250
- * @param type The event type
251
- * @param listener The function to unsubscribe from events of this type
252
- */
253
- removeEventListener(type: string, listener: Listener): void;
254
- /**
255
- * Unsubscribes all listener functions to a single event type or all event types.
256
- *
257
- * @param type The event type, or all event types if not specified
258
- */
259
- clearEventListeners(type?: string): void;
260
- /**
261
- * Publishes an event.
262
- *
263
- * @param event The event object to publish
264
- */
265
- dispatchEvent<T extends FREvent>(event: T): void;
266
- }
267
-
268
268
  /**
269
269
  * Types of steps returned by the authentication tree.
270
270
  */
@@ -291,7 +291,7 @@ interface FailureDetail {
291
291
  * Represents a single step of an authentication tree.
292
292
  */
293
293
  declare class FRStep implements AuthResponse {
294
- payload: Step;
294
+ payload: Step$1;
295
295
  /**
296
296
  * The type of step.
297
297
  */
@@ -304,7 +304,7 @@ declare class FRStep implements AuthResponse {
304
304
  * @param payload The raw payload returned by OpenAM
305
305
  * @param callbackFactory A function that returns am implementation of FRCallback
306
306
  */
307
- constructor(payload: Step, callbackFactory?: FRCallbackFactory);
307
+ constructor(payload: Step$1, callbackFactory?: FRCallbackFactory);
308
308
  /**
309
309
  * Gets the first callback of the specified type in this step.
310
310
  *
@@ -346,7 +346,7 @@ declare type HandleStep = (step: FRStep) => Promise<FRStep>;
346
346
  interface HttpClientRequestOptions {
347
347
  bypassAuthentication?: boolean;
348
348
  authorization?: {
349
- config?: ConfigOptions;
349
+ config?: ConfigOptions$1;
350
350
  handleStep: HandleStep;
351
351
  idToken?: string;
352
352
  txnID?: string;
@@ -490,67 +490,6 @@ declare class SvelteComponentDev$1 extends SvelteComponent {
490
490
  $capture_state(): void;
491
491
  $inject_state(): void;
492
492
  }
493
- interface SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> {
494
- $set(props?: Partial<Props>): void;
495
- $on<K extends Extract<keyof Events, string>>(type: K, callback: ((e: Events[K]) => void) | null | undefined): () => void;
496
- $destroy(): void;
497
- [accessor: string]: any;
498
- }
499
- /**
500
- * Base class to create strongly typed Svelte components.
501
- * This only exists for typing purposes and should be used in `.d.ts` files.
502
- *
503
- * ### Example:
504
- *
505
- * You have component library on npm called `component-library`, from which
506
- * you export a component called `MyComponent`. For Svelte+TypeScript users,
507
- * you want to provide typings. Therefore you create a `index.d.ts`:
508
- * ```ts
509
- * import { SvelteComponentTyped } from "svelte";
510
- * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}
511
- * ```
512
- * Typing this makes it possible for IDEs like VS Code with the Svelte extension
513
- * to provide intellisense and to use the component like this in a Svelte file
514
- * with TypeScript:
515
- * ```svelte
516
- * <script lang="ts">
517
- * import { MyComponent } from "component-library";
518
- * </script>
519
- * <MyComponent foo={'bar'} />
520
- * ```
521
- *
522
- * #### Why not make this part of `SvelteComponent(Dev)`?
523
- * Because
524
- * ```ts
525
- * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}
526
- * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;
527
- * ```
528
- * will throw a type error, so we need to separate the more strictly typed class.
529
- */
530
- declare class SvelteComponentTyped<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any> extends SvelteComponentDev$1 {
531
- /**
532
- * @private
533
- * For type checking capabilities only.
534
- * Does not exist at runtime.
535
- * ### DO NOT USE!
536
- */
537
- $$prop_def: Props;
538
- /**
539
- * @private
540
- * For type checking capabilities only.
541
- * Does not exist at runtime.
542
- * ### DO NOT USE!
543
- */
544
- $$events_def: Events;
545
- /**
546
- * @private
547
- * For type checking capabilities only.
548
- * Does not exist at runtime.
549
- * ### DO NOT USE!
550
- */
551
- $$slot_def: Slots;
552
- constructor(options: ComponentConstructorOptions<Props>);
553
- }
554
493
 
555
494
  /** Callback to inform of a value updates. */
556
495
  declare type Subscriber<T> = (value: T) => void;
@@ -594,7 +533,7 @@ interface ProcessedPropertyError {
594
533
  }
595
534
 
596
535
  declare class FRLoginFailure implements AuthResponse {
597
- payload: Step;
536
+ payload: Step$1;
598
537
  /**
599
538
  * The type of step.
600
539
  */
@@ -602,7 +541,7 @@ declare class FRLoginFailure implements AuthResponse {
602
541
  /**
603
542
  * @param payload The raw payload returned by OpenAM
604
543
  */
605
- constructor(payload: Step);
544
+ constructor(payload: Step$1);
606
545
  /**
607
546
  * Gets the error code.
608
547
  */
@@ -626,7 +565,7 @@ declare class FRLoginFailure implements AuthResponse {
626
565
  }
627
566
 
628
567
  declare class FRLoginSuccess implements AuthResponse {
629
- payload: Step;
568
+ payload: Step$1;
630
569
  /**
631
570
  * The type of step.
632
571
  */
@@ -634,7 +573,7 @@ declare class FRLoginSuccess implements AuthResponse {
634
573
  /**
635
574
  * @param payload The raw payload returned by OpenAM
636
575
  */
637
- constructor(payload: Step);
576
+ constructor(payload: Step$1);
638
577
  /**
639
578
  * Gets the step's realm.
640
579
  */
@@ -652,14 +591,14 @@ declare class FRLoginSuccess implements AuthResponse {
652
591
  /**
653
592
  * Tokens returned after successful authentication.
654
593
  */
655
- interface OAuth2Tokens {
594
+ interface OAuth2Tokens$1 {
656
595
  accessToken: string;
657
596
  idToken?: string;
658
597
  refreshToken?: string;
659
598
  tokenExpiry?: number;
660
599
  }
661
600
 
662
- interface GetTokensOptions extends ConfigOptions {
601
+ interface GetTokensOptions extends ConfigOptions$1 {
663
602
  forceRenew?: boolean;
664
603
  login?: 'embedded' | 'redirect' | undefined;
665
604
  query?: StringDict<string>;
@@ -667,11 +606,11 @@ interface GetTokensOptions extends ConfigOptions {
667
606
 
668
607
  type Maybe<T> = T | null | undefined;
669
608
 
670
- interface UserStore extends Pick<Writable<UserStoreValue>, 'subscribe'> {
671
- get: (getOptions?: ConfigOptions) => void;
609
+ interface UserStore extends Pick<Writable<UserStoreValue$1>, 'subscribe'> {
610
+ get: (getOptions?: ConfigOptions$1) => void;
672
611
  reset: () => void;
673
612
  }
674
- interface UserStoreValue {
613
+ interface UserStoreValue$1 {
675
614
  completed: boolean;
676
615
  error: Maybe<{
677
616
  code?: Maybe<number>;
@@ -683,11 +622,11 @@ interface UserStoreValue {
683
622
  response: unknown;
684
623
  }
685
624
 
686
- interface OAuthStore extends Pick<Writable<OAuthTokenStoreValue>, 'subscribe'> {
625
+ interface OAuthStore extends Pick<Writable<OAuthTokenStoreValue$1>, 'subscribe'> {
687
626
  get: (getOptions?: GetTokensOptions) => void;
688
627
  reset: () => void;
689
628
  }
690
- interface OAuthTokenStoreValue {
629
+ interface OAuthTokenStoreValue$1 {
691
630
  completed: boolean;
692
631
  error: Maybe<{
693
632
  code?: Maybe<number>;
@@ -696,7 +635,7 @@ interface OAuthTokenStoreValue {
696
635
  }>;
697
636
  loading: boolean;
698
637
  successful: boolean;
699
- response: Maybe<OAuth2Tokens> | void;
638
+ response: Maybe<OAuth2Tokens$1> | void;
700
639
  }
701
640
 
702
641
  interface CallbackMetadata {
@@ -710,7 +649,7 @@ interface CallbackMetadata {
710
649
  idx: number;
711
650
  platform?: Record<string, unknown>;
712
651
  }
713
- interface JourneyStore extends Pick<Writable<JourneyStoreValue>, 'subscribe'> {
652
+ interface JourneyStore extends Pick<Writable<JourneyStoreValue$1>, 'subscribe'> {
714
653
  next: (prevStep?: StepTypes, nextOptions?: StepOptions) => void;
715
654
  pop: () => void;
716
655
  push: (changeOptions: StepOptions) => void;
@@ -718,12 +657,12 @@ interface JourneyStore extends Pick<Writable<JourneyStoreValue>, 'subscribe'> {
718
657
  resume: (url: string, resumeOptions?: StepOptions) => void;
719
658
  start: (startOptions?: StepOptions) => void;
720
659
  }
721
- interface JourneyStoreValue {
660
+ interface JourneyStoreValue$1 {
722
661
  completed: boolean;
723
662
  error: Maybe<{
724
663
  code: Maybe<number>;
725
664
  message: Maybe<string>;
726
- step: Maybe<Step>;
665
+ stage: Maybe<string>;
727
666
  troubleshoot: Maybe<string>;
728
667
  }>;
729
668
  loading: boolean;
@@ -733,7 +672,7 @@ interface JourneyStoreValue {
733
672
  } | null;
734
673
  step: StepTypes;
735
674
  successful: boolean;
736
- response: Maybe<Step>;
675
+ response: Maybe<Step$1>;
737
676
  }
738
677
  interface StepMetadata {
739
678
  derived: {
@@ -747,6 +686,23 @@ interface StepMetadata {
747
686
  }
748
687
  type StepTypes = FRStep | FRLoginSuccess | FRLoginFailure | null;
749
688
 
689
+
690
+ interface ComponentStoreValue {
691
+ lastAction: 'close' | 'open' | 'mount' | null;
692
+ error: {
693
+ code: string;
694
+ message: string;
695
+ } | null;
696
+ modal: {
697
+ component: SvelteComponentDev$1;
698
+ element: HTMLDialogElement;
699
+ } | null;
700
+ mounted: boolean;
701
+ open: boolean | null;
702
+ reason: 'auto' | 'external' | 'user' | null;
703
+ type: 'inline' | 'modal' | null;
704
+ }
705
+
750
706
  declare type Primitive = string | number | symbol | bigint | boolean | null | undefined;
751
707
 
752
708
  declare namespace util {
@@ -2348,20 +2304,20 @@ declare const partialStyleSchema: ZodObject<{
2348
2304
  } | undefined;
2349
2305
  }>;
2350
2306
 
2351
- interface JourneyOptions {
2307
+ interface JourneyOptions$1 {
2352
2308
  oauth?: boolean;
2353
2309
  user?: boolean;
2354
2310
  }
2355
- interface JourneyOptionsChange {
2311
+ interface JourneyOptionsChange$1 {
2356
2312
  forgerock?: StepOptions;
2357
2313
  journey: string;
2358
2314
  }
2359
- interface JourneyOptionsStart {
2315
+ interface JourneyOptionsStart$1 {
2360
2316
  forgerock?: StepOptions;
2361
2317
  journey?: string;
2362
2318
  resumeUrl?: string;
2363
2319
  }
2364
- interface WidgetConfigOptions {
2320
+ interface WidgetConfigOptions$1 {
2365
2321
  forgerock?: TypeOf<typeof partialConfigSchema>;
2366
2322
  content?: TypeOf<typeof partialStringsSchema>;
2367
2323
  journeys?: TypeOf<typeof journeyConfigSchema>;
@@ -2369,23 +2325,6 @@ interface WidgetConfigOptions {
2369
2325
  style?: TypeOf<typeof partialStyleSchema>;
2370
2326
  }
2371
2327
 
2372
-
2373
- interface ComponentStoreValue {
2374
- lastAction: 'close' | 'open' | 'mount' | null;
2375
- error: {
2376
- code: string;
2377
- message: string;
2378
- } | null;
2379
- modal: {
2380
- component: SvelteComponentDev$1;
2381
- element: HTMLDialogElement;
2382
- } | null;
2383
- mounted: boolean;
2384
- open: boolean | null;
2385
- reason: 'auto' | 'external' | 'user' | null;
2386
- type: 'inline' | 'modal' | null;
2387
- }
2388
-
2389
2328
  declare const api: {
2390
2329
  component: {
2391
2330
  close: (args?: {
@@ -2394,92 +2333,53 @@ declare const api: {
2394
2333
  open: () => void;
2395
2334
  subscribe: (this: void, run: Subscriber<Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted">>, invalidate?: ((value?: Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted"> | undefined) => void) | undefined) => Unsubscriber;
2396
2335
  };
2397
- configuration: (options?: WidgetConfigOptions | undefined) => {
2398
- set(setOptions?: WidgetConfigOptions | undefined): void;
2336
+ configuration: (options?: WidgetConfigOptions$1 | undefined) => {
2337
+ set(setOptions?: WidgetConfigOptions$1 | undefined): void;
2399
2338
  };
2400
2339
  getStores: () => {
2401
2340
  journeyStore: JourneyStore;
2402
2341
  oauthStore: OAuthStore;
2403
2342
  userStore: UserStore;
2404
2343
  };
2405
- journey: (options?: JourneyOptions | undefined) => {
2406
- change: (changeOptions: JourneyOptionsChange) => Promise<unknown>;
2407
- start: (startOptions?: JourneyOptionsStart | undefined) => Promise<unknown>;
2344
+ journey: (options?: JourneyOptions$1 | undefined) => {
2345
+ change: (changeOptions: JourneyOptionsChange$1) => Promise<unknown>;
2346
+ start: (startOptions?: JourneyOptionsStart$1 | undefined) => Promise<unknown>;
2408
2347
  subscribe: (this: void, run: Subscriber<{
2409
- journey: JourneyStoreValue;
2410
- oauth: OAuthTokenStoreValue;
2411
- user: UserStoreValue;
2348
+ journey: JourneyStoreValue$1;
2349
+ oauth: OAuthTokenStoreValue$1;
2350
+ user: UserStoreValue$1;
2412
2351
  }>, invalidate?: ((value?: {
2413
- journey: JourneyStoreValue;
2414
- oauth: OAuthTokenStoreValue;
2415
- user: UserStoreValue;
2352
+ journey: JourneyStoreValue$1;
2353
+ oauth: OAuthTokenStoreValue$1;
2354
+ user: UserStoreValue$1;
2416
2355
  } | undefined) => void) | undefined) => Unsubscriber;
2417
2356
  };
2418
2357
  request: typeof HttpClient.request;
2419
2358
  user: {
2420
2359
  info(): {
2421
- get: (options?: ConfigOptions | undefined) => Promise<unknown>;
2422
- subscribe: (this: void, run: Subscriber<UserStoreValue>, invalidate?: ((value?: UserStoreValue | undefined) => void) | undefined) => Unsubscriber;
2360
+ get: (options?: ConfigOptions$1 | undefined) => Promise<unknown>;
2361
+ subscribe: (this: void, run: Subscriber<UserStoreValue$1>, invalidate?: ((value?: UserStoreValue$1 | undefined) => void) | undefined) => Unsubscriber;
2423
2362
  };
2424
2363
  logout(): Promise<void>;
2425
2364
  tokens(): {
2426
- get: (options?: ConfigOptions | undefined) => Promise<unknown>;
2427
- subscribe: (this: void, run: Subscriber<OAuthTokenStoreValue>, invalidate?: ((value?: OAuthTokenStoreValue | undefined) => void) | undefined) => Unsubscriber;
2365
+ get: (options?: ConfigOptions$1 | undefined) => Promise<unknown>;
2366
+ subscribe: (this: void, run: Subscriber<OAuthTokenStoreValue$1>, invalidate?: ((value?: OAuthTokenStoreValue$1 | undefined) => void) | undefined) => Unsubscriber;
2428
2367
  };
2429
2368
  };
2430
2369
  };
2431
- declare const configuration: (options?: WidgetConfigOptions | undefined) => {
2432
- set(setOptions?: WidgetConfigOptions | undefined): void;
2433
- };
2434
- declare const journey: (options?: JourneyOptions | undefined) => {
2435
- change: (changeOptions: JourneyOptionsChange) => Promise<unknown>;
2436
- start: (startOptions?: JourneyOptionsStart | undefined) => Promise<unknown>;
2437
- subscribe: (this: void, run: Subscriber<{
2438
- journey: JourneyStoreValue;
2439
- oauth: OAuthTokenStoreValue;
2440
- user: UserStoreValue;
2441
- }>, invalidate?: ((value?: {
2442
- journey: JourneyStoreValue;
2443
- oauth: OAuthTokenStoreValue;
2444
- user: UserStoreValue;
2445
- } | undefined) => void) | undefined) => Unsubscriber;
2446
- };
2447
- declare const component: () => {
2448
- close: (args?: {
2449
- reason: "auto" | "external" | "user";
2450
- } | undefined) => void;
2451
- open: () => void;
2452
- subscribe: (this: void, run: Subscriber<Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted">>, invalidate?: ((value?: Pick<ComponentStoreValue, "reason" | "error" | "open" | "lastAction" | "mounted"> | undefined) => void) | undefined) => Unsubscriber;
2453
- };
2454
- declare const request: typeof HttpClient.request;
2455
- declare const user: {
2456
- info(): {
2457
- get: (options?: ConfigOptions | undefined) => Promise<unknown>;
2458
- subscribe: (this: void, run: Subscriber<UserStoreValue>, invalidate?: ((value?: UserStoreValue | undefined) => void) | undefined) => Unsubscriber;
2459
- };
2460
- logout(): Promise<void>;
2461
- tokens(): {
2462
- get: (options?: ConfigOptions | undefined) => Promise<unknown>;
2463
- subscribe: (this: void, run: Subscriber<OAuthTokenStoreValue>, invalidate?: ((value?: OAuthTokenStoreValue | undefined) => void) | undefined) => Unsubscriber;
2464
- };
2465
- };
2466
2370
  type ConfigurationApi = ReturnType<typeof api.configuration>;
2467
2371
  type JourneyApi = ReturnType<typeof api.journey>;
2468
2372
  type UserInfoApi = ReturnType<typeof api.user.info>;
2469
2373
  type UserTokensApi = ReturnType<typeof api.user.tokens>;
2470
- declare const __propDef: {
2471
- props: {
2472
- type?: "inline" | "modal" | undefined;
2473
- };
2474
- events: {
2475
- [evt: string]: CustomEvent<any>;
2476
- };
2477
- slots: {};
2478
- };
2479
- type IndexProps = typeof __propDef.props;
2480
- type IndexEvents = typeof __propDef.events;
2481
- type IndexSlots = typeof __propDef.slots;
2482
- declare class Index extends SvelteComponentTyped<IndexProps, IndexEvents, IndexSlots> {
2483
- }
2374
+ type JourneyOptions = JourneyOptions$1;
2375
+ type JourneyOptionsChange = JourneyOptionsChange$1;
2376
+ type JourneyOptionsStart = JourneyOptionsStart$1;
2377
+ type WidgetConfigOptions = WidgetConfigOptions$1;
2378
+ type JourneyStoreValue = JourneyStoreValue$1;
2379
+ type OAuthTokenStoreValue = OAuthTokenStoreValue$1;
2380
+ type UserStoreValue = UserStoreValue$1;
2381
+ type ConfigOptions = ConfigOptions$1;
2382
+ type OAuth2Tokens = OAuth2Tokens$1;
2383
+ type Step = Step$1;
2484
2384
 
2485
- export { ConfigurationApi, IndexEvents, IndexProps, IndexSlots, JourneyApi, UserInfoApi, UserTokensApi, component, configuration, Index as default, journey, request, user };
2385
+ export { ConfigOptions, ConfigurationApi, JourneyApi, JourneyOptions, JourneyOptionsChange, JourneyOptionsStart, JourneyStoreValue, OAuth2Tokens, OAuthTokenStoreValue, Step, UserInfoApi, UserStoreValue, UserTokensApi, WidgetConfigOptions };