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

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/index.d.ts CHANGED
@@ -2115,6 +2115,7 @@ declare const partialStringsSchema: ZodObject<{
2115
2115
  twoFactorAuthentication: ZodOptional<ZodString>;
2116
2116
  useValidEmail: ZodOptional<ZodString>;
2117
2117
  unrecoverableError: ZodOptional<ZodString>;
2118
+ unknownLoginError: ZodOptional<ZodString>;
2118
2119
  unknownNetworkError: ZodOptional<ZodString>;
2119
2120
  userName: ZodOptional<ZodString>;
2120
2121
  usernameRequirements: ZodOptional<ZodString>;
@@ -2193,6 +2194,7 @@ declare const partialStringsSchema: ZodObject<{
2193
2194
  twoFactorAuthentication?: string | undefined;
2194
2195
  useValidEmail?: string | undefined;
2195
2196
  unrecoverableError?: string | undefined;
2197
+ unknownLoginError?: string | undefined;
2196
2198
  unknownNetworkError?: string | undefined;
2197
2199
  userName?: string | undefined;
2198
2200
  usernameRequirements?: string | undefined;
@@ -2271,6 +2273,7 @@ declare const partialStringsSchema: ZodObject<{
2271
2273
  twoFactorAuthentication?: string | undefined;
2272
2274
  useValidEmail?: string | undefined;
2273
2275
  unrecoverableError?: string | undefined;
2276
+ unknownLoginError?: string | undefined;
2274
2277
  unknownNetworkError?: string | undefined;
2275
2278
  userName?: string | undefined;
2276
2279
  usernameRequirements?: string | undefined;
package/index.js CHANGED
@@ -16825,6 +16825,7 @@ var tryAgain = "Please try again";
16825
16825
  var twoFactorAuthentication = "Two factor authentication";
16826
16826
  var useValidEmail = "Please use a valid email address.";
16827
16827
  var unrecoverableError = "There was an error in the form submission.";
16828
+ var unknownLoginError = "Unknown login failure has occurred.";
16828
16829
  var unknownNetworkError = "Unknown network request failure has occurred.";
16829
16830
  var userName = "Username";
16830
16831
  var usernameRequirements = "Username requirements:";
@@ -16903,6 +16904,7 @@ var fallback = {
16903
16904
  twoFactorAuthentication: twoFactorAuthentication,
16904
16905
  useValidEmail: useValidEmail,
16905
16906
  unrecoverableError: unrecoverableError,
16907
+ unknownLoginError: unknownLoginError,
16906
16908
  unknownNetworkError: unknownNetworkError,
16907
16909
  userName: userName,
16908
16910
  usernameRequirements: usernameRequirements,
@@ -16984,6 +16986,7 @@ const stringsSchema = z
16984
16986
  twoFactorAuthentication: z.string(),
16985
16987
  useValidEmail: z.string(),
16986
16988
  unrecoverableError: z.string(),
16989
+ unknownLoginError: z.string(),
16987
16990
  unknownNetworkError: z.string(),
16988
16991
  userName: z.string(),
16989
16992
  usernameRequirements: z.string(),
@@ -16998,9 +17001,10 @@ stringsSchema.partial();
16998
17001
  stringsSchema.parse(fallback);
16999
17002
  const stringsStore = writable(null);
17000
17003
  /**
17001
- * initialize locale information for Login Widget
17002
- * @param: userLocale - optional locale object to override default locale
17003
- * @returns: a schema which represents the user locale schema
17004
+ * @function initialize - Initialize the locale store
17005
+ * @param {object} userLocale - An object of custom locale strings to merge with the default
17006
+ * @returns {object} - The locale store
17007
+ * @example initialize({ loginHeader: 'Welcome to the login page' });
17004
17008
  */
17005
17009
  function initialize$5(userLocale) {
17006
17010
  if (userLocale) {
@@ -17452,6 +17456,11 @@ function buildStepMetadata(callbackMetadataArray, stageJson, stageName) {
17452
17456
  };
17453
17457
  }
17454
17458
 
17459
+ /**
17460
+ * @function initializeJourney - Initializes the journey stack for tracking journey switches
17461
+ * @param {object} initOptions - The initial options to set
17462
+ * @returns {object} - The journey stack store with stack methods
17463
+ */
17455
17464
  function initializeStack(initOptions) {
17456
17465
  const initialValue = initOptions ? [initOptions] : [];
17457
17466
  const { update, set, subscribe } = writable(initialValue);
@@ -17515,6 +17524,11 @@ const journeyStore = writable({
17515
17524
  successful: false,
17516
17525
  response: null,
17517
17526
  });
17527
+ /**
17528
+ * @function initialize - Initializes the journey store
17529
+ * @param {object} initOptions - The initial options to set
17530
+ * @returns {object} - The journey store
17531
+ */
17518
17532
  function initialize$4(initOptions) {
17519
17533
  const stack = initializeStack();
17520
17534
  let stepNumber = 0;
@@ -17634,7 +17648,7 @@ function initialize$4(initOptions) {
17634
17648
  *
17635
17649
  * Grab failure message, which may contain encoded HTML
17636
17650
  */
17637
- const failureMessageStr = htmlDecode(nextStep.payload.message || '');
17651
+ const failureMessageStr = htmlDecode(nextStep.payload.message || 'Unknown login error');
17638
17652
  let restartedStep = null;
17639
17653
  try {
17640
17654
  /**
@@ -35407,7 +35421,7 @@ function create_else_block$1(ctx) {
35407
35421
  };
35408
35422
  }
35409
35423
 
35410
- // (53:36)
35424
+ // (56:52)
35411
35425
  function create_if_block_3(ctx) {
35412
35426
  let div;
35413
35427
  let spinner;
@@ -35448,7 +35462,7 @@ function create_if_block_3(ctx) {
35448
35462
  };
35449
35463
  }
35450
35464
 
35451
- // (27:0) {#if !$journeyStore?.completed}
35465
+ // (30:0) {#if $journeyStore && !$journeyStore.completed}
35452
35466
  function create_if_block$1(ctx) {
35453
35467
  let current_block_type_index;
35454
35468
  let if_block;
@@ -35458,8 +35472,8 @@ function create_if_block$1(ctx) {
35458
35472
  const if_blocks = [];
35459
35473
 
35460
35474
  function select_block_type_1(ctx, dirty) {
35461
- if (!/*$journeyStore*/ ctx[5].step) return 0;
35462
- if (/*$journeyStore*/ ctx[5].step.type === StepType$1.Step) return 1;
35475
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].step) return 0;
35476
+ if (/*$journeyStore*/ ctx[5].step?.type === StepType$1.Step) return 1;
35463
35477
  return -1;
35464
35478
  }
35465
35479
 
@@ -35535,7 +35549,7 @@ function create_if_block$1(ctx) {
35535
35549
  };
35536
35550
  }
35537
35551
 
35538
- // (58:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35552
+ // (61:2) <Alert id="unrecoverableStepError" needsFocus={alertNeedsFocus} type="error">
35539
35553
  function create_default_slot_1(ctx) {
35540
35554
  let t;
35541
35555
  let current;
@@ -35568,7 +35582,7 @@ function create_default_slot_1(ctx) {
35568
35582
  };
35569
35583
  }
35570
35584
 
35571
- // (61:2) <Button style="secondary" onClick={tryAgain}>
35585
+ // (64:2) <Button style="secondary" onClick={tryAgain}>
35572
35586
  function create_default_slot$1(ctx) {
35573
35587
  let t;
35574
35588
  let current;
@@ -35598,7 +35612,7 @@ function create_default_slot$1(ctx) {
35598
35612
  };
35599
35613
  }
35600
35614
 
35601
- // (32:54)
35615
+ // (35:55)
35602
35616
  function create_if_block_2(ctx) {
35603
35617
  let switch_instance;
35604
35618
  let updating_formEl;
@@ -35720,7 +35734,7 @@ function create_if_block_2(ctx) {
35720
35734
  };
35721
35735
  }
35722
35736
 
35723
- // (28:2) {#if !$journeyStore.step}
35737
+ // (31:2) {#if $journeyStore && !$journeyStore.step}
35724
35738
  function create_if_block_1(ctx) {
35725
35739
  let div;
35726
35740
  let spinner;
@@ -35770,8 +35784,8 @@ function create_fragment$1(ctx) {
35770
35784
  const if_blocks = [];
35771
35785
 
35772
35786
  function select_block_type(ctx, dirty) {
35773
- if (!/*$journeyStore*/ ctx[5]?.completed) return 0;
35774
- if (/*$journeyStore*/ ctx[5]?.successful) return 1;
35787
+ if (/*$journeyStore*/ ctx[5] && !/*$journeyStore*/ ctx[5].completed) return 0;
35788
+ if (/*$journeyStore*/ ctx[5] && /*$journeyStore*/ ctx[5].successful) return 1;
35775
35789
  return 2;
35776
35790
  }
35777
35791
 
@@ -35842,6 +35856,11 @@ function instance$1($$self, $$props, $$invalidate) {
35842
35856
  let { formEl = null } = $$props;
35843
35857
  let { journeyStore } = $$props;
35844
35858
  $$subscribe_journeyStore();
35859
+
35860
+ if (!$journeyStore) {
35861
+ console.error('Widget missing configuration. Import and call `configuration()`, then use `set()` to configure.');
35862
+ }
35863
+
35845
35864
  let alertNeedsFocus = false;
35846
35865
 
35847
35866
  function submitForm() {
@@ -35855,7 +35874,7 @@ function instance$1($$self, $$props, $$invalidate) {
35855
35874
  }
35856
35875
 
35857
35876
  afterUpdate(() => {
35858
- $$invalidate(4, alertNeedsFocus = !$journeyStore.successful);
35877
+ $$invalidate(4, alertNeedsFocus = $journeyStore && !$journeyStore.successful);
35859
35878
  });
35860
35879
 
35861
35880
  function switch_instance_formEl_binding(value) {