@forgerock/login-widget 1.0.0-beta.1 → 1.0.0-beta.3

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/inline.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,152 +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
- interface GetTokensOptions extends ConfigOptions {
536
- forceRenew?: boolean;
537
- login?: 'embedded' | 'redirect' | undefined;
538
- query?: StringDict<string>;
539
- }
540
-
541
562
  type Maybe<T> = T | null | undefined;
542
563
 
543
564
  interface CallbackMetadata {
@@ -601,11 +622,6 @@ interface UserStoreValue {
601
622
  response: unknown;
602
623
  }
603
624
 
604
- interface Response {
605
- journey?: JourneyStoreValue;
606
- oauth?: OAuthTokenStoreValue;
607
- user?: UserStoreValue;
608
- }
609
625
  interface JourneyOptions {
610
626
  config?: StepOptions;
611
627
  journey?: string;
@@ -613,6 +629,12 @@ interface JourneyOptions {
613
629
  resumeUrl?: string;
614
630
  user?: boolean;
615
631
  }
632
+ interface Response$1 {
633
+ journey?: JourneyStoreValue;
634
+ oauth?: OAuthTokenStoreValue;
635
+ user?: UserStoreValue;
636
+ }
637
+
616
638
 
617
639
  declare type Primitive = string | number | bigint | boolean | null | undefined;
618
640
 
@@ -1087,6 +1109,13 @@ declare class ZodNumber extends ZodType<number, ZodNumberDef> {
1087
1109
  get maxValue(): number | null;
1088
1110
  get isInt(): boolean;
1089
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
+ }
1090
1119
  interface ZodUnknownDef extends ZodTypeDef {
1091
1120
  typeName: ZodFirstPartyTypeKind.ZodUnknown;
1092
1121
  }
@@ -1452,24 +1481,6 @@ declare const partialLinksSchema: ZodObject<{
1452
1481
  termsAndConditions?: string | undefined;
1453
1482
  }>;
1454
1483
 
1455
- interface Logo {
1456
- dark?: string;
1457
- height?: number;
1458
- light: string;
1459
- width?: number;
1460
- }
1461
- interface Style {
1462
- checksAndRadios?: 'animated' | 'standard';
1463
- labels?: 'floating' | 'stacked';
1464
- logo?: Logo;
1465
- sections?: {
1466
- header?: boolean;
1467
- };
1468
- stage?: {
1469
- icon: boolean;
1470
- };
1471
- }
1472
-
1473
1484
  declare const partialConfigSchema: ZodObject<{
1474
1485
  callbackFactory: ZodOptional<ZodOptional<ZodFunction<ZodTuple<[ZodObject<{
1475
1486
  _id: ZodOptional<ZodNumber>;
@@ -1983,28 +1994,142 @@ declare const partialStringsSchema: ZodObject<{
1983
1994
  valueRequirements?: string | undefined;
1984
1995
  }>;
1985
1996
 
1986
- declare const journey: {
1987
- start(options?: JourneyOptions): void;
1988
- onFailure(fn: (response: Response) => void): void;
1989
- onSuccess(fn: (response: Response) => void): void;
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;
1990
2109
  };
1991
2110
  declare const form: {
1992
2111
  onMount(fn: (form: HTMLFormElement) => void): void;
1993
2112
  };
2113
+ declare const journey: {
2114
+ start(options?: JourneyOptions | undefined): void;
2115
+ onFailure(fn: (response: Response$1) => void): void;
2116
+ onSuccess(fn: (response: Response$1) => void): void;
2117
+ };
2118
+ declare const request: (options: HttpClientRequestOptions) => Promise<Response>;
1994
2119
  declare const user: {
1995
- authorized(remote?: boolean): Promise<boolean>;
2120
+ authorized(remote?: boolean): Promise<unknown>;
1996
2121
  info(remote?: boolean): Promise<unknown>;
1997
- logout(): Promise<void>;
1998
- tokens(options?: GetTokensOptions): Promise<void | OAuth2Tokens>;
2122
+ logout: () => Promise<void>;
2123
+ tokens(options?: GetTokensOptions | undefined): Promise<void | OAuth2Tokens>;
1999
2124
  };
2000
2125
 
2001
2126
  declare const __propDef: {
2002
2127
  props: {
2003
- config: TypeOf<typeof partialConfigSchema>;
2004
- content: TypeOf<typeof partialStringsSchema>;
2128
+ config?: TypeOf<typeof partialConfigSchema> | undefined;
2129
+ content?: TypeOf<typeof partialStringsSchema> | undefined;
2005
2130
  journeys?: TypeOf<typeof journeyConfigSchema> | undefined;
2006
2131
  links?: TypeOf<typeof partialLinksSchema> | undefined;
2007
- style?: Style | undefined;
2132
+ style?: TypeOf<typeof partialStyleSchema> | undefined;
2008
2133
  };
2009
2134
  events: {
2010
2135
  'form-mount': CustomEvent<any>;
@@ -2019,4 +2144,4 @@ type InlineSlots = typeof __propDef.slots;
2019
2144
  declare class Inline extends SvelteComponentTyped<InlineProps, InlineEvents, InlineSlots> {
2020
2145
  }
2021
2146
 
2022
- export { InlineEvents, InlineProps, InlineSlots, Inline as default, form, journey, user };
2147
+ export { InlineEvents, InlineProps, InlineSlots, configuration, Inline as default, form, journey, request, user };