@forgerock/login-widget 1.0.0-beta.14 → 1.0.0-beta.16

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
  /**
@@ -23098,7 +23112,7 @@ function get_each_context$7(ctx, list, i) {
23098
23112
  return child_ctx;
23099
23113
  }
23100
23114
 
23101
- // (40:0) {#if labelOrder === 'first'}
23115
+ // (39:0) {#if labelOrder === 'first'}
23102
23116
  function create_if_block_1$a(ctx) {
23103
23117
  let label_1;
23104
23118
  let current;
@@ -23146,7 +23160,7 @@ function create_if_block_1$a(ctx) {
23146
23160
  };
23147
23161
  }
23148
23162
 
23149
- // (41:2) <Label {key} classes={`${labelClasses}`}>
23163
+ // (40:2) <Label {key} classes={`${labelClasses}`}>
23150
23164
  function create_default_slot_1$b(ctx) {
23151
23165
  let t;
23152
23166
 
@@ -23166,7 +23180,7 @@ function create_default_slot_1$b(ctx) {
23166
23180
  };
23167
23181
  }
23168
23182
 
23169
- // (55:2) {#each options as option}
23183
+ // (54:2) {#each options as option}
23170
23184
  function create_each_block$7(ctx) {
23171
23185
  let option;
23172
23186
  let t0_value = /*option*/ ctx[15].text + "";
@@ -23207,7 +23221,7 @@ function create_each_block$7(ctx) {
23207
23221
  };
23208
23222
  }
23209
23223
 
23210
- // (62:0) {#if labelOrder === 'last'}
23224
+ // (61:0) {#if labelOrder === 'last'}
23211
23225
  function create_if_block$g(ctx) {
23212
23226
  let label_1;
23213
23227
  let current;
@@ -23260,7 +23274,7 @@ function create_if_block$g(ctx) {
23260
23274
  };
23261
23275
  }
23262
23276
 
23263
- // (63:2) <Label {key} classes={`${shouldDisplayOption ? labelClasses : 'tw_sr-only'}`}>
23277
+ // (62:2) <Label {key} classes={`${shouldDisplayOption ? labelClasses : 'tw_sr-only'}`}>
23264
23278
  function create_default_slot$i(ctx) {
23265
23279
  let t;
23266
23280
 
@@ -23499,8 +23513,6 @@ function instance$E($$self, $$props, $$invalidate) {
23499
23513
  // Check if text is same as label
23500
23514
  $$invalidate(10, shouldDisplayOption = !(label === selectedOption?.text));
23501
23515
 
23502
- console.log(shouldDisplayOption);
23503
-
23504
23516
  // Continue with calling onChange parameter
23505
23517
  onChange(event);
23506
23518
  }
@@ -27387,8 +27399,8 @@ class Eye_icon extends SvelteComponent {
27387
27399
 
27388
27400
  function create_default_slot_1$8(ctx) {
27389
27401
  let current;
27390
- const default_slot_template = /*#slots*/ ctx[14].default;
27391
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[15], null);
27402
+ const default_slot_template = /*#slots*/ ctx[15].default;
27403
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[16], null);
27392
27404
 
27393
27405
  return {
27394
27406
  c() {
@@ -27403,15 +27415,15 @@ function create_default_slot_1$8(ctx) {
27403
27415
  },
27404
27416
  p(ctx, dirty) {
27405
27417
  if (default_slot) {
27406
- if (default_slot.p && (!current || dirty & /*$$scope*/ 32768)) {
27418
+ if (default_slot.p && (!current || dirty & /*$$scope*/ 65536)) {
27407
27419
  update_slot_base(
27408
27420
  default_slot,
27409
27421
  default_slot_template,
27410
27422
  ctx,
27411
- /*$$scope*/ ctx[15],
27423
+ /*$$scope*/ ctx[16],
27412
27424
  !current
27413
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[15])
27414
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[15], dirty, null),
27425
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[16])
27426
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[16], dirty, null),
27415
27427
  null
27416
27428
  );
27417
27429
  }
@@ -27432,7 +27444,7 @@ function create_default_slot_1$8(ctx) {
27432
27444
  };
27433
27445
  }
27434
27446
 
27435
- // (59:4) <EyeIcon classes="tw_password-icon dark:tw_password-icon_dark" visible={isVisible}>
27447
+ // (69:4) <EyeIcon classes="tw_password-icon dark:tw_password-icon_dark" visible={isVisible}>
27436
27448
  function create_default_slot$f(ctx) {
27437
27449
  let t;
27438
27450
  let current;
@@ -27462,7 +27474,7 @@ function create_default_slot$f(ctx) {
27462
27474
  };
27463
27475
  }
27464
27476
 
27465
- // (53:2)
27477
+ // (63:2)
27466
27478
  function create_input_button_slot$1(ctx) {
27467
27479
  let button;
27468
27480
  let eyeicon;
@@ -27493,7 +27505,7 @@ function create_input_button_slot$1(ctx) {
27493
27505
  current = true;
27494
27506
 
27495
27507
  if (!mounted) {
27496
- dispose = listen(button, "click", /*toggleVisibility*/ ctx[10]);
27508
+ dispose = listen(button, "click", /*toggleVisibility*/ ctx[11]);
27497
27509
  mounted = true;
27498
27510
  }
27499
27511
  },
@@ -27501,7 +27513,7 @@ function create_input_button_slot$1(ctx) {
27501
27513
  const eyeicon_changes = {};
27502
27514
  if (dirty & /*isVisible*/ 64) eyeicon_changes.visible = /*isVisible*/ ctx[6];
27503
27515
 
27504
- if (dirty & /*$$scope*/ 32768) {
27516
+ if (dirty & /*$$scope*/ 65536) {
27505
27517
  eyeicon_changes.$$scope = { dirty, ctx };
27506
27518
  }
27507
27519
 
@@ -27529,18 +27541,16 @@ function create_fragment$q(ctx) {
27529
27541
  let input;
27530
27542
  let current;
27531
27543
 
27532
- input = new /*Input*/ ctx[8]({
27544
+ input = new /*Input*/ ctx[9]({
27533
27545
  props: {
27534
27546
  forceValidityFailure: /*forceValidityFailure*/ ctx[0],
27535
27547
  isFirstInvalidInput: false,
27536
27548
  hasRightIcon: true,
27537
27549
  key: `${/*key*/ ctx[3]}-confirm`,
27538
27550
  label: interpolate('confirmPassword', null, 'Confirm Password'),
27539
- message: /*isInvalid*/ ctx[1]
27540
- ? interpolate('passwordConfirmationError', null, 'Passwords do not match')
27541
- : undefined,
27542
- onChange: /*onChangeWrapper*/ ctx[9],
27543
- isInvalid: /*isInvalid*/ ctx[1],
27551
+ message: /*message*/ ctx[8],
27552
+ onChange: /*onChangeWrapper*/ ctx[10],
27553
+ isInvalid: /*passwordsDoNotMatch*/ ctx[1],
27544
27554
  isRequired: /*isRequired*/ ctx[2],
27545
27555
  showMessage: /*showMessage*/ ctx[4],
27546
27556
  type: /*type*/ ctx[7],
@@ -27567,12 +27577,8 @@ function create_fragment$q(ctx) {
27567
27577
  const input_changes = {};
27568
27578
  if (dirty & /*forceValidityFailure*/ 1) input_changes.forceValidityFailure = /*forceValidityFailure*/ ctx[0];
27569
27579
  if (dirty & /*key*/ 8) input_changes.key = `${/*key*/ ctx[3]}-confirm`;
27570
-
27571
- if (dirty & /*isInvalid*/ 2) input_changes.message = /*isInvalid*/ ctx[1]
27572
- ? interpolate('passwordConfirmationError', null, 'Passwords do not match')
27573
- : undefined;
27574
-
27575
- if (dirty & /*isInvalid*/ 2) input_changes.isInvalid = /*isInvalid*/ ctx[1];
27580
+ if (dirty & /*message*/ 256) input_changes.message = /*message*/ ctx[8];
27581
+ if (dirty & /*passwordsDoNotMatch*/ 2) input_changes.isInvalid = /*passwordsDoNotMatch*/ ctx[1];
27576
27582
  if (dirty & /*isRequired*/ 4) input_changes.isRequired = /*isRequired*/ ctx[2];
27577
27583
  if (dirty & /*showMessage*/ 16) input_changes.showMessage = /*showMessage*/ ctx[4];
27578
27584
  if (dirty & /*type*/ 128) input_changes.type = /*type*/ ctx[7];
@@ -27581,7 +27587,7 @@ function create_fragment$q(ctx) {
27581
27587
  ? /*value*/ ctx[5]
27582
27588
  : '';
27583
27589
 
27584
- if (dirty & /*$$scope, isVisible*/ 32832) {
27590
+ if (dirty & /*$$scope, isVisible*/ 65600) {
27585
27591
  input_changes.$$scope = { dirty, ctx };
27586
27592
  }
27587
27593
 
@@ -27605,8 +27611,8 @@ function create_fragment$q(ctx) {
27605
27611
  function instance$q($$self, $$props, $$invalidate) {
27606
27612
  let { $$slots: slots = {}, $$scope } = $$props;
27607
27613
  let { forceValidityFailure = false } = $$props;
27608
- let { isInvalid = false } = $$props;
27609
- let { isRequired = true } = $$props;
27614
+ let { passwordsDoNotMatch = false } = $$props;
27615
+ let { isRequired = false } = $$props;
27610
27616
  let { key } = $$props;
27611
27617
  let { onChange } = $$props;
27612
27618
  let { resetValue } = $$props;
@@ -27616,6 +27622,7 @@ function instance$q($$self, $$props, $$invalidate) {
27616
27622
  let isVisible = false;
27617
27623
  let type = 'password';
27618
27624
  let value;
27625
+ let message = '';
27619
27626
 
27620
27627
  function onChangeWrapper(event) {
27621
27628
  $$invalidate(5, value = event.target?.value);
@@ -27634,36 +27641,45 @@ function instance$q($$self, $$props, $$invalidate) {
27634
27641
 
27635
27642
  $$self.$$set = $$props => {
27636
27643
  if ('forceValidityFailure' in $$props) $$invalidate(0, forceValidityFailure = $$props.forceValidityFailure);
27637
- if ('isInvalid' in $$props) $$invalidate(1, isInvalid = $$props.isInvalid);
27644
+ if ('passwordsDoNotMatch' in $$props) $$invalidate(1, passwordsDoNotMatch = $$props.passwordsDoNotMatch);
27638
27645
  if ('isRequired' in $$props) $$invalidate(2, isRequired = $$props.isRequired);
27639
27646
  if ('key' in $$props) $$invalidate(3, key = $$props.key);
27640
- if ('onChange' in $$props) $$invalidate(11, onChange = $$props.onChange);
27641
- if ('resetValue' in $$props) $$invalidate(12, resetValue = $$props.resetValue);
27642
- if ('style' in $$props) $$invalidate(13, style = $$props.style);
27647
+ if ('onChange' in $$props) $$invalidate(12, onChange = $$props.onChange);
27648
+ if ('resetValue' in $$props) $$invalidate(13, resetValue = $$props.resetValue);
27649
+ if ('style' in $$props) $$invalidate(14, style = $$props.style);
27643
27650
  if ('showMessage' in $$props) $$invalidate(4, showMessage = $$props.showMessage);
27644
- if ('$$scope' in $$props) $$invalidate(15, $$scope = $$props.$$scope);
27651
+ if ('$$scope' in $$props) $$invalidate(16, $$scope = $$props.$$scope);
27645
27652
  };
27646
27653
 
27647
27654
  $$self.$$.update = () => {
27648
- if ($$self.$$.dirty & /*resetValue, onChange, value*/ 6176) {
27655
+ if ($$self.$$.dirty & /*resetValue, onChange, value, passwordsDoNotMatch, isRequired*/ 12326) {
27649
27656
  {
27650
27657
  if (resetValue) {
27651
27658
  $$invalidate(5, value = undefined);
27652
27659
  onChange(value);
27653
27660
  }
27661
+
27662
+ if (passwordsDoNotMatch) {
27663
+ $$invalidate(8, message = interpolate('passwordConfirmationError', null, 'Passwords do not match'));
27664
+ } else if (isRequired) {
27665
+ $$invalidate(8, message = interpolate('requiredField', null, 'This field is required'));
27666
+ } else {
27667
+ $$invalidate(8, message = '');
27668
+ }
27654
27669
  }
27655
27670
  }
27656
27671
  };
27657
27672
 
27658
27673
  return [
27659
27674
  forceValidityFailure,
27660
- isInvalid,
27675
+ passwordsDoNotMatch,
27661
27676
  isRequired,
27662
27677
  key,
27663
27678
  showMessage,
27664
27679
  value,
27665
27680
  isVisible,
27666
27681
  type,
27682
+ message,
27667
27683
  Input,
27668
27684
  onChangeWrapper,
27669
27685
  toggleVisibility,
@@ -27681,12 +27697,12 @@ class Confirm_input extends SvelteComponent {
27681
27697
 
27682
27698
  init(this, options, instance$q, create_fragment$q, safe_not_equal, {
27683
27699
  forceValidityFailure: 0,
27684
- isInvalid: 1,
27700
+ passwordsDoNotMatch: 1,
27685
27701
  isRequired: 2,
27686
27702
  key: 3,
27687
- onChange: 11,
27688
- resetValue: 12,
27689
- style: 13,
27703
+ onChange: 12,
27704
+ resetValue: 13,
27705
+ style: 14,
27690
27706
  showMessage: 4
27691
27707
  });
27692
27708
  }
@@ -27842,8 +27858,9 @@ function create_if_block$a(ctx) {
27842
27858
  confirminput = new Confirm_input({
27843
27859
  props: {
27844
27860
  forceValidityFailure: /*doPasswordsMatch*/ ctx[9] === false,
27845
- isInvalid: /*doPasswordsMatch*/ ctx[9] === false,
27861
+ passwordsDoNotMatch: /*doPasswordsMatch*/ ctx[9] === false,
27846
27862
  key: /*key*/ ctx[0],
27863
+ isRequired: /*value*/ ctx[7].length > 0,
27847
27864
  onChange: /*confirmInput*/ ctx[15],
27848
27865
  resetValue: /*resetValue*/ ctx[11],
27849
27866
  showMessage: /*doPasswordsMatch*/ ctx[9] === false,
@@ -27862,8 +27879,9 @@ function create_if_block$a(ctx) {
27862
27879
  p(ctx, dirty) {
27863
27880
  const confirminput_changes = {};
27864
27881
  if (dirty & /*doPasswordsMatch*/ 512) confirminput_changes.forceValidityFailure = /*doPasswordsMatch*/ ctx[9] === false;
27865
- if (dirty & /*doPasswordsMatch*/ 512) confirminput_changes.isInvalid = /*doPasswordsMatch*/ ctx[9] === false;
27882
+ if (dirty & /*doPasswordsMatch*/ 512) confirminput_changes.passwordsDoNotMatch = /*doPasswordsMatch*/ ctx[9] === false;
27866
27883
  if (dirty & /*key*/ 1) confirminput_changes.key = /*key*/ ctx[0];
27884
+ if (dirty & /*value*/ 128) confirminput_changes.isRequired = /*value*/ ctx[7].length > 0;
27867
27885
  if (dirty & /*resetValue*/ 2048) confirminput_changes.resetValue = /*resetValue*/ ctx[11];
27868
27886
  if (dirty & /*doPasswordsMatch*/ 512) confirminput_changes.showMessage = /*doPasswordsMatch*/ ctx[9] === false;
27869
27887
  if (dirty & /*style*/ 16) confirminput_changes.style = /*style*/ ctx[4];