keycloakify 11.2.6 → 11.2.9-rc.0

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.
@@ -434,9 +434,7 @@ function AddRemoveButtonsMultiValuedAttribute(props: {
434
434
  }
435
435
 
436
436
  function InputTagSelects(props: InputFieldByTypeProps) {
437
- const { attribute, dispatchFormAction, kcClsx, valueOrValues } = props;
438
-
439
- const { advancedMsg } = props.i18n;
437
+ const { attribute, dispatchFormAction, kcClsx, i18n, valueOrValues } = props;
440
438
 
441
439
  const { classDiv, classInput, classLabel, inputType } = (() => {
442
440
  const { inputType } = attribute.annotations;
@@ -533,7 +531,7 @@ function InputTagSelects(props: InputFieldByTypeProps) {
533
531
  htmlFor={`${attribute.name}-${option}`}
534
532
  className={`${classLabel}${attribute.readOnly ? ` ${kcClsx("kcInputClassRadioCheckboxLabelDisabled")}` : ""}`}
535
533
  >
536
- {advancedMsg(option)}
534
+ {inputLabel(i18n, attribute, option)}
537
535
  </label>
538
536
  </div>
539
537
  ))}
@@ -580,8 +578,6 @@ function TextareaTag(props: InputFieldByTypeProps) {
580
578
  function SelectTag(props: InputFieldByTypeProps) {
581
579
  const { attribute, dispatchFormAction, kcClsx, displayableErrors, i18n, valueOrValues } = props;
582
580
 
583
- const { advancedMsgStr } = i18n;
584
-
585
581
  const isMultiple = attribute.annotations.inputType === "multiselect";
586
582
 
587
583
  return (
@@ -645,22 +641,26 @@ function SelectTag(props: InputFieldByTypeProps) {
645
641
 
646
642
  return options.map(option => (
647
643
  <option key={option} value={option}>
648
- {(() => {
649
- if (attribute.annotations.inputOptionLabels !== undefined) {
650
- const { inputOptionLabels } = attribute.annotations;
651
-
652
- return advancedMsgStr(inputOptionLabels[option] ?? option);
653
- }
654
-
655
- if (attribute.annotations.inputOptionLabelsI18nPrefix !== undefined) {
656
- return advancedMsgStr(`${attribute.annotations.inputOptionLabelsI18nPrefix}.${option}`);
657
- }
658
-
659
- return option;
660
- })()}
644
+ {inputLabel(i18n, attribute, option)}
661
645
  </option>
662
646
  ));
663
647
  })()}
664
648
  </select>
665
649
  );
666
650
  }
651
+
652
+ function inputLabel(i18n: I18n, attribute: Attribute, option: string) {
653
+ const { advancedMsg } = i18n;
654
+
655
+ if (attribute.annotations.inputOptionLabels !== undefined) {
656
+ const { inputOptionLabels } = attribute.annotations;
657
+
658
+ return advancedMsg(inputOptionLabels[option] ?? option);
659
+ }
660
+
661
+ if (attribute.annotations.inputOptionLabelsI18nPrefix !== undefined) {
662
+ return advancedMsg(`${attribute.annotations.inputOptionLabelsI18nPrefix}.${option}`);
663
+ }
664
+
665
+ return option;
666
+ }
@@ -115,6 +115,38 @@ export const WithFavoritePet: Story = {
115
115
  )
116
116
  };
117
117
 
118
+
119
+ export const WithNewsletter: Story = {
120
+ render: () => (
121
+ <KcPageStory
122
+ kcContext={{
123
+ profile: {
124
+ attributesByName: {
125
+ newsletter: {
126
+ name: "newsletter",
127
+ displayName: "Sign up to the newsletter",
128
+ validators: {
129
+ options: {
130
+ options: ["yes"]
131
+ }
132
+ },
133
+ annotations: {
134
+ inputOptionLabels: {
135
+ "yes": "I want my email inbox filled with spam"
136
+ },
137
+ inputType: "multiselect-checkboxes"
138
+ },
139
+ required: false,
140
+ readOnly: false
141
+ } satisfies Attribute
142
+ }
143
+ },
144
+ }}
145
+ />
146
+ )
147
+ };
148
+
149
+
118
150
  export const WithEmailAsUsername: Story = {
119
151
  render: () => (
120
152
  <KcPageStory
@@ -229,6 +229,7 @@ function ensureSingleOrNone(arg0) {
229
229
 
230
230
 
231
231
 
232
+
232
233
  (0,assert/* assert */.h)();
233
234
  function getBuildContext(params) {
234
235
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
@@ -334,8 +335,8 @@ function getBuildContext(params) {
334
335
  lib.z.literal("none")
335
336
  ]),
336
337
  keycloakVersionTargets: lib.z.object({
337
- "21-and-below": lib.z.union([lib.z.boolean(), lib.z.string()]),
338
- "22-and-above": lib.z.union([lib.z.boolean(), lib.z.string()])
338
+ "22-to-25": lib.z.union([lib.z.boolean(), lib.z.string()]),
339
+ "all-other-versions": lib.z.union([lib.z.boolean(), lib.z.string()])
339
340
  })
340
341
  .optional()
341
342
  });
@@ -667,10 +668,11 @@ function getBuildContext(params) {
667
668
  }
668
669
  else {
669
670
  const keycloakVersionRange = (() => {
670
- if (buildForKeycloakMajorVersionNumber <= 21) {
671
- return "21-and-below";
671
+ if (buildForKeycloakMajorVersionNumber <= 21 ||
672
+ buildForKeycloakMajorVersionNumber >= 26) {
673
+ return "all-other-versions";
672
674
  }
673
- return "22-and-above";
675
+ return "22-to-25";
674
676
  })();
675
677
  (0,assert/* assert */.h)();
676
678
  return keycloakVersionRange;
@@ -679,6 +681,7 @@ function getBuildContext(params) {
679
681
  const jarFileBasename = (() => {
680
682
  use_custom_jar_basename: {
681
683
  const { keycloakVersionTargets } = buildOptions;
684
+ (0,assert/* assert */.h)(is(keycloakVersionTargets));
682
685
  if (keycloakVersionTargets === undefined) {
683
686
  break use_custom_jar_basename;
684
687
  }
@@ -720,8 +723,8 @@ function getBuildContext(params) {
720
723
  }
721
724
  else {
722
725
  for (const keycloakVersionRange of [
723
- "21-and-below",
724
- "22-and-above"
726
+ "22-to-25",
727
+ "all-other-versions"
725
728
  ]) {
726
729
  (0,assert/* assert */.h)(true);
727
730
  jarTargets.push({
@@ -736,7 +739,11 @@ function getBuildContext(params) {
736
739
  return jarTargets_default;
737
740
  }
738
741
  const jarTargets = [];
739
- for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries(buildOptions.keycloakVersionTargets)) {
742
+ for (const [keycloakVersionRange, jarNameOrBoolean] of objectEntries((() => {
743
+ const { keycloakVersionTargets } = buildOptions;
744
+ (0,assert/* assert */.h)(is(keycloakVersionTargets));
745
+ return keycloakVersionTargets;
746
+ })())) {
740
747
  if (jarNameOrBoolean === false) {
741
748
  continue;
742
749
  }