@forgerock/login-widget 1.0.0-beta.1 → 1.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.
package/modal.d.ts CHANGED
@@ -234,6 +234,173 @@ interface OAuth2Tokens {
234
234
  tokenExpiry?: number;
235
235
  }
236
236
 
237
+ interface GetTokensOptions extends ConfigOptions {
238
+ forceRenew?: boolean;
239
+ login?: 'embedded' | 'redirect' | undefined;
240
+ query?: StringDict<string>;
241
+ }
242
+
243
+ /**
244
+ * Types of steps returned by the authentication tree.
245
+ */
246
+ declare enum StepType {
247
+ LoginFailure = "LoginFailure",
248
+ LoginSuccess = "LoginSuccess",
249
+ Step = "Step"
250
+ }
251
+
252
+ /**
253
+ * Base interface for all types of authentication step responses.
254
+ */
255
+ interface AuthResponse {
256
+ type: StepType;
257
+ }
258
+ /**
259
+ * Represents details of a failure in an authentication step.
260
+ */
261
+ interface FailureDetail {
262
+ failureUrl?: string;
263
+ }
264
+
265
+ /**
266
+ * Represents a single step of an authentication tree.
267
+ */
268
+ declare class FRStep implements AuthResponse {
269
+ payload: Step;
270
+ /**
271
+ * The type of step.
272
+ */
273
+ readonly type = StepType.Step;
274
+ /**
275
+ * The callbacks contained in this step.
276
+ */
277
+ callbacks: FRCallback[];
278
+ /**
279
+ * @param payload The raw payload returned by OpenAM
280
+ * @param callbackFactory A function that returns am implementation of FRCallback
281
+ */
282
+ constructor(payload: Step, callbackFactory?: FRCallbackFactory);
283
+ /**
284
+ * Gets the first callback of the specified type in this step.
285
+ *
286
+ * @param type The type of callback to find.
287
+ */
288
+ getCallbackOfType<T extends FRCallback>(type: CallbackType): T;
289
+ /**
290
+ * Gets all callbacks of the specified type in this step.
291
+ *
292
+ * @param type The type of callback to find.
293
+ */
294
+ getCallbacksOfType<T extends FRCallback>(type: CallbackType): T[];
295
+ /**
296
+ * Sets the value of the first callback of the specified type in this step.
297
+ *
298
+ * @param type The type of callback to find.
299
+ * @param value The value to set for the callback.
300
+ */
301
+ setCallbackValue(type: CallbackType, value: unknown): void;
302
+ /**
303
+ * Gets the step's description.
304
+ */
305
+ getDescription(): string | undefined;
306
+ /**
307
+ * Gets the step's header.
308
+ */
309
+ getHeader(): string | undefined;
310
+ /**
311
+ * Gets the step's stage.
312
+ */
313
+ getStage(): string | undefined;
314
+ private convertCallbacks;
315
+ }
316
+
317
+ declare type HandleStep = (step: FRStep) => Promise<FRStep>;
318
+ /**
319
+ * Options to use when making an HTTP call.
320
+ */
321
+ interface HttpClientRequestOptions {
322
+ bypassAuthentication?: boolean;
323
+ authorization?: {
324
+ config?: ConfigOptions;
325
+ handleStep: HandleStep;
326
+ idToken?: string;
327
+ txnID?: string;
328
+ };
329
+ init: RequestInit;
330
+ requiresNewToken?: RequiresNewTokenFn;
331
+ timeout: number;
332
+ url: string;
333
+ }
334
+ /**
335
+ * A function that determines whether a new token is required based on a HTTP response.
336
+ */
337
+ declare type RequiresNewTokenFn = (res: Response) => boolean;
338
+
339
+ interface MessageCreator {
340
+ [key: string]: (propertyName: string, params?: {
341
+ [key: string]: unknown;
342
+ }) => string;
343
+ }
344
+ interface ProcessedPropertyError {
345
+ detail: FailedPolicyRequirement;
346
+ messages: string[];
347
+ }
348
+
349
+ declare class FRLoginFailure implements AuthResponse {
350
+ payload: Step;
351
+ /**
352
+ * The type of step.
353
+ */
354
+ readonly type = StepType.LoginFailure;
355
+ /**
356
+ * @param payload The raw payload returned by OpenAM
357
+ */
358
+ constructor(payload: Step);
359
+ /**
360
+ * Gets the error code.
361
+ */
362
+ getCode(): number;
363
+ /**
364
+ * Gets the failure details.
365
+ */
366
+ getDetail(): FailureDetail | undefined;
367
+ /**
368
+ * Gets the failure message.
369
+ */
370
+ getMessage(): string | undefined;
371
+ /**
372
+ * Gets processed failure message.
373
+ */
374
+ getProcessedMessage(messageCreator?: MessageCreator): ProcessedPropertyError[];
375
+ /**
376
+ * Gets the failure reason.
377
+ */
378
+ getReason(): string | undefined;
379
+ }
380
+
381
+ declare class FRLoginSuccess implements AuthResponse {
382
+ payload: Step;
383
+ /**
384
+ * The type of step.
385
+ */
386
+ readonly type = StepType.LoginSuccess;
387
+ /**
388
+ * @param payload The raw payload returned by OpenAM
389
+ */
390
+ constructor(payload: Step);
391
+ /**
392
+ * Gets the step's realm.
393
+ */
394
+ getRealm(): string | undefined;
395
+ /**
396
+ * Gets the step's session token.
397
+ */
398
+ getSessionToken(): string | undefined;
399
+ /**
400
+ * Gets the step's success URL.
401
+ */
402
+ getSuccessUrl(): string | undefined;
403
+ }
237
404
 
238
405
  declare function noop(): void;
239
406
 
@@ -392,174 +559,6 @@ declare class SvelteComponentTyped<Props extends Record<string, any> = any, Even
392
559
  constructor(options: ComponentConstructorOptions<Props>);
393
560
  }
394
561
 
395
- interface MessageCreator {
396
- [key: string]: (propertyName: string, params?: {
397
- [key: string]: unknown;
398
- }) => string;
399
- }
400
- interface ProcessedPropertyError {
401
- detail: FailedPolicyRequirement;
402
- messages: string[];
403
- }
404
-
405
- /**
406
- * Types of steps returned by the authentication tree.
407
- */
408
- declare enum StepType {
409
- LoginFailure = "LoginFailure",
410
- LoginSuccess = "LoginSuccess",
411
- Step = "Step"
412
- }
413
-
414
- /**
415
- * Base interface for all types of authentication step responses.
416
- */
417
- interface AuthResponse {
418
- type: StepType;
419
- }
420
- /**
421
- * Represents details of a failure in an authentication step.
422
- */
423
- interface FailureDetail {
424
- failureUrl?: string;
425
- }
426
-
427
- declare class FRLoginFailure implements AuthResponse {
428
- payload: Step;
429
- /**
430
- * The type of step.
431
- */
432
- readonly type = StepType.LoginFailure;
433
- /**
434
- * @param payload The raw payload returned by OpenAM
435
- */
436
- constructor(payload: Step);
437
- /**
438
- * Gets the error code.
439
- */
440
- getCode(): number;
441
- /**
442
- * Gets the failure details.
443
- */
444
- getDetail(): FailureDetail | undefined;
445
- /**
446
- * Gets the failure message.
447
- */
448
- getMessage(): string | undefined;
449
- /**
450
- * Gets processed failure message.
451
- */
452
- getProcessedMessage(messageCreator?: MessageCreator): ProcessedPropertyError[];
453
- /**
454
- * Gets the failure reason.
455
- */
456
- getReason(): string | undefined;
457
- }
458
-
459
- declare class FRLoginSuccess implements AuthResponse {
460
- payload: Step;
461
- /**
462
- * The type of step.
463
- */
464
- readonly type = StepType.LoginSuccess;
465
- /**
466
- * @param payload The raw payload returned by OpenAM
467
- */
468
- constructor(payload: Step);
469
- /**
470
- * Gets the step's realm.
471
- */
472
- getRealm(): string | undefined;
473
- /**
474
- * Gets the step's session token.
475
- */
476
- getSessionToken(): string | undefined;
477
- /**
478
- * Gets the step's success URL.
479
- */
480
- getSuccessUrl(): string | undefined;
481
- }
482
-
483
- /**
484
- * Represents a single step of an authentication tree.
485
- */
486
- declare class FRStep implements AuthResponse {
487
- payload: Step;
488
- /**
489
- * The type of step.
490
- */
491
- readonly type = StepType.Step;
492
- /**
493
- * The callbacks contained in this step.
494
- */
495
- callbacks: FRCallback[];
496
- /**
497
- * @param payload The raw payload returned by OpenAM
498
- * @param callbackFactory A function that returns am implementation of FRCallback
499
- */
500
- constructor(payload: Step, callbackFactory?: FRCallbackFactory);
501
- /**
502
- * Gets the first callback of the specified type in this step.
503
- *
504
- * @param type The type of callback to find.
505
- */
506
- getCallbackOfType<T extends FRCallback>(type: CallbackType): T;
507
- /**
508
- * Gets all callbacks of the specified type in this step.
509
- *
510
- * @param type The type of callback to find.
511
- */
512
- getCallbacksOfType<T extends FRCallback>(type: CallbackType): T[];
513
- /**
514
- * Sets the value of the first callback of the specified type in this step.
515
- *
516
- * @param type The type of callback to find.
517
- * @param value The value to set for the callback.
518
- */
519
- setCallbackValue(type: CallbackType, value: unknown): void;
520
- /**
521
- * Gets the step's description.
522
- */
523
- getDescription(): string | undefined;
524
- /**
525
- * Gets the step's header.
526
- */
527
- getHeader(): string | undefined;
528
- /**
529
- * Gets the step's stage.
530
- */
531
- getStage(): string | undefined;
532
- private convertCallbacks;
533
- }
534
-
535
- declare type HandleStep = (step: FRStep) => Promise<FRStep>;
536
- /**
537
- * Options to use when making an HTTP call.
538
- */
539
- interface HttpClientRequestOptions {
540
- bypassAuthentication?: boolean;
541
- authorization?: {
542
- config?: ConfigOptions;
543
- handleStep: HandleStep;
544
- idToken?: string;
545
- txnID?: string;
546
- };
547
- init: RequestInit;
548
- requiresNewToken?: RequiresNewTokenFn;
549
- timeout: number;
550
- url: string;
551
- }
552
- /**
553
- * A function that determines whether a new token is required based on a HTTP response.
554
- */
555
- declare type RequiresNewTokenFn = (res: Response) => boolean;
556
-
557
- interface GetTokensOptions extends ConfigOptions {
558
- forceRenew?: boolean;
559
- login?: 'embedded' | 'redirect' | undefined;
560
- query?: StringDict<string>;
561
- }
562
-
563
562
  type Maybe<T> = T | null | undefined;
564
563
 
565
564
  interface CallbackMetadata {
@@ -623,11 +622,6 @@ interface UserStoreValue {
623
622
  response: unknown;
624
623
  }
625
624
 
626
- interface Response$1 {
627
- journey?: JourneyStoreValue;
628
- oauth?: OAuthTokenStoreValue;
629
- user?: UserStoreValue;
630
- }
631
625
  interface JourneyOptions {
632
626
  config?: StepOptions;
633
627
  journey?: string;
@@ -635,6 +629,12 @@ interface JourneyOptions {
635
629
  resumeUrl?: string;
636
630
  user?: boolean;
637
631
  }
632
+ interface Response$1 {
633
+ journey?: JourneyStoreValue;
634
+ oauth?: OAuthTokenStoreValue;
635
+ user?: UserStoreValue;
636
+ }
637
+
638
638
 
639
639
  declare type Primitive = string | number | bigint | boolean | null | undefined;
640
640
 
@@ -1109,6 +1109,13 @@ declare class ZodNumber extends ZodType<number, ZodNumberDef> {
1109
1109
  get maxValue(): number | null;
1110
1110
  get isInt(): boolean;
1111
1111
  }
1112
+ interface ZodBooleanDef extends ZodTypeDef {
1113
+ typeName: ZodFirstPartyTypeKind.ZodBoolean;
1114
+ }
1115
+ declare class ZodBoolean extends ZodType<boolean, ZodBooleanDef> {
1116
+ _parse(input: ParseInput): ParseReturnType<boolean>;
1117
+ static create: (params?: RawCreateParams) => ZodBoolean;
1118
+ }
1112
1119
  interface ZodUnknownDef extends ZodTypeDef {
1113
1120
  typeName: ZodFirstPartyTypeKind.ZodUnknown;
1114
1121
  }
@@ -1474,24 +1481,6 @@ declare const partialLinksSchema: ZodObject<{
1474
1481
  termsAndConditions?: string | undefined;
1475
1482
  }>;
1476
1483
 
1477
- interface Logo {
1478
- dark?: string;
1479
- height?: number;
1480
- light: string;
1481
- width?: number;
1482
- }
1483
- interface Style {
1484
- checksAndRadios?: 'animated' | 'standard';
1485
- labels?: 'floating' | 'stacked';
1486
- logo?: Logo;
1487
- sections?: {
1488
- header?: boolean;
1489
- };
1490
- stage?: {
1491
- icon: boolean;
1492
- };
1493
- }
1494
-
1495
1484
  declare const partialConfigSchema: ZodObject<{
1496
1485
  callbackFactory: ZodOptional<ZodOptional<ZodFunction<ZodTuple<[ZodObject<{
1497
1486
  _id: ZodOptional<ZodNumber>;
@@ -2005,36 +1994,140 @@ declare const partialStringsSchema: ZodObject<{
2005
1994
  valueRequirements?: string | undefined;
2006
1995
  }>;
2007
1996
 
1997
+ declare const partialStyleSchema: ZodObject<{
1998
+ checksAndRadios: ZodOptional<ZodOptional<ZodUnion<[ZodLiteral<"animated">, ZodLiteral<"standard">]>>>;
1999
+ labels: ZodOptional<ZodOptional<ZodUnion<[ZodOptional<ZodLiteral<"floating">>, ZodLiteral<"stacked">]>>>;
2000
+ logo: ZodOptional<ZodOptional<ZodObject<{
2001
+ dark: ZodOptional<ZodString>;
2002
+ height: ZodOptional<ZodNumber>;
2003
+ light: ZodOptional<ZodString>;
2004
+ width: ZodOptional<ZodNumber>;
2005
+ }, "strict", ZodTypeAny, {
2006
+ height?: number | undefined;
2007
+ width?: number | undefined;
2008
+ dark?: string | undefined;
2009
+ light?: string | undefined;
2010
+ }, {
2011
+ height?: number | undefined;
2012
+ width?: number | undefined;
2013
+ dark?: string | undefined;
2014
+ light?: string | undefined;
2015
+ }>>>;
2016
+ sections: ZodOptional<ZodOptional<ZodObject<{
2017
+ header: ZodOptional<ZodBoolean>;
2018
+ }, "strip", ZodTypeAny, {
2019
+ header?: boolean | undefined;
2020
+ }, {
2021
+ header?: boolean | undefined;
2022
+ }>>>;
2023
+ stage: ZodOptional<ZodOptional<ZodObject<{
2024
+ icon: ZodOptional<ZodBoolean>;
2025
+ }, "strip", ZodTypeAny, {
2026
+ icon?: boolean | undefined;
2027
+ }, {
2028
+ icon?: boolean | undefined;
2029
+ }>>>;
2030
+ }, "strict", ZodTypeAny, {
2031
+ labels?: "floating" | "stacked" | undefined;
2032
+ checksAndRadios?: "standard" | "animated" | undefined;
2033
+ logo?: {
2034
+ height?: number | undefined;
2035
+ width?: number | undefined;
2036
+ dark?: string | undefined;
2037
+ light?: string | undefined;
2038
+ } | undefined;
2039
+ sections?: {
2040
+ header?: boolean | undefined;
2041
+ } | undefined;
2042
+ stage?: {
2043
+ icon?: boolean | undefined;
2044
+ } | undefined;
2045
+ }, {
2046
+ labels?: "floating" | "stacked" | undefined;
2047
+ checksAndRadios?: "standard" | "animated" | undefined;
2048
+ logo?: {
2049
+ height?: number | undefined;
2050
+ width?: number | undefined;
2051
+ dark?: string | undefined;
2052
+ light?: string | undefined;
2053
+ } | undefined;
2054
+ sections?: {
2055
+ header?: boolean | undefined;
2056
+ } | undefined;
2057
+ stage?: {
2058
+ icon?: boolean | undefined;
2059
+ } | undefined;
2060
+ }>;
2061
+
2062
+ declare const configuration: {
2063
+ set(options: {
2064
+ type?: string | undefined;
2065
+ callbackFactory?: ((args_0: {
2066
+ input?: {
2067
+ value?: unknown;
2068
+ name: string;
2069
+ }[] | undefined;
2070
+ _id?: number | undefined;
2071
+ type: CallbackType;
2072
+ output: {
2073
+ value?: unknown;
2074
+ name: string;
2075
+ }[];
2076
+ }, ...args_1: unknown[]) => FRCallback) | undefined;
2077
+ clientId?: string | undefined;
2078
+ middleware?: ((...args: unknown[]) => unknown)[] | undefined;
2079
+ realmPath?: string | undefined;
2080
+ redirectUri?: string | undefined;
2081
+ scope?: string | undefined;
2082
+ serverConfig?: {
2083
+ paths?: {
2084
+ authenticate: string;
2085
+ authorize: string;
2086
+ accessToken: string;
2087
+ endSession: string;
2088
+ userInfo: string;
2089
+ revoke: string;
2090
+ sessions: string;
2091
+ } | undefined;
2092
+ timeout: number;
2093
+ baseUrl: string;
2094
+ } | undefined;
2095
+ support?: "modern" | "legacy" | undefined;
2096
+ tokenStore?: "localStorage" | "indexedDB" | "sessionStorage" | {
2097
+ set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
2098
+ remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
2099
+ get: (args_0: string, ...args_1: unknown[]) => Promise<{
2100
+ idToken?: string | undefined;
2101
+ refreshToken?: string | undefined;
2102
+ tokenExpiry?: number | undefined;
2103
+ accessToken: string;
2104
+ }>;
2105
+ } | undefined;
2106
+ tree?: string | undefined;
2107
+ oauthThreshold?: number | undefined;
2108
+ }): void;
2109
+ };
2008
2110
  declare const journey: {
2009
- start(options?: JourneyOptions): void;
2111
+ start(options?: JourneyOptions | undefined): void;
2010
2112
  onFailure(fn: (response: Response$1) => void): void;
2011
2113
  onSuccess(fn: (response: Response$1) => void): void;
2012
2114
  };
2013
- declare const modal: {
2014
- close(args?: {
2015
- reason: 'auto' | 'external' | 'user';
2016
- }): void;
2017
- onClose(fn: (args: {
2018
- reason: 'auto' | 'external' | 'user';
2019
- }) => void): void;
2020
- onMount(fn: (dialog: HTMLDialogElement, form: HTMLFormElement) => void): void;
2021
- open(options?: JourneyOptions): void;
2022
- };
2023
- declare const request: (options: HttpClientRequestOptions) => Promise<globalThis.Response>;
2115
+ declare const modal: Modal;
2116
+ declare const request: (options: HttpClientRequestOptions) => Promise<Response>;
2024
2117
  declare const user: {
2025
- authorized(remote?: boolean): Promise<boolean>;
2118
+ authorized(remote?: boolean): Promise<unknown>;
2026
2119
  info(remote?: boolean): Promise<unknown>;
2027
- logout(): Promise<void>;
2028
- tokens(options?: GetTokensOptions): Promise<void | OAuth2Tokens>;
2120
+ logout: () => Promise<void>;
2121
+ tokens(options?: GetTokensOptions | undefined): Promise<void | OAuth2Tokens>;
2029
2122
  };
2030
2123
 
2031
2124
  declare const __propDef: {
2032
2125
  props: {
2033
- config: TypeOf<typeof partialConfigSchema>;
2034
- content: TypeOf<typeof partialStringsSchema>;
2126
+ config?: TypeOf<typeof partialConfigSchema> | undefined;
2127
+ content?: TypeOf<typeof partialStringsSchema> | undefined;
2035
2128
  journeys?: TypeOf<typeof journeyConfigSchema> | undefined;
2036
2129
  links?: TypeOf<typeof partialLinksSchema> | undefined;
2037
- style?: Style | undefined;
2130
+ style?: TypeOf<typeof partialStyleSchema> | undefined;
2038
2131
  };
2039
2132
  events: {
2040
2133
  'modal-mount': CustomEvent<any>;
@@ -2049,4 +2142,4 @@ type ModalSlots = typeof __propDef.slots;
2049
2142
  declare class Modal extends SvelteComponentTyped<ModalProps, ModalEvents, ModalSlots> {
2050
2143
  }
2051
2144
 
2052
- export { ModalEvents, ModalProps, ModalSlots, Modal as default, journey, modal, request, user };
2145
+ export { ModalEvents, ModalProps, ModalSlots, configuration, Modal as default, journey, modal, request, user };