@asgardeo/react 0.25.5 → 0.25.7

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/dist/cjs/index.js CHANGED
@@ -2405,6 +2405,17 @@ var AsgardeoProvider = ({
2405
2405
  }
2406
2406
  };
2407
2407
  }, [asgardeo]);
2408
+ (0, import_react21.useEffect)(() => {
2409
+ const handleRefreshTokenError = (event) => {
2410
+ if (event?.data?.type === "refresh-access-token-error") {
2411
+ setIsSignedInSync(false);
2412
+ }
2413
+ };
2414
+ window.addEventListener("message", handleRefreshTokenError);
2415
+ return () => {
2416
+ window.removeEventListener("message", handleRefreshTokenError);
2417
+ };
2418
+ }, []);
2408
2419
  (0, import_react21.useEffect)(() => {
2409
2420
  (async () => {
2410
2421
  try {
@@ -17079,6 +17090,23 @@ var useStyles30 = (theme, colorScheme) => (0, import_react104.useMemo)(() => {
17079
17090
  flex-direction: column;
17080
17091
  gap: calc(${theme.vars.spacing.unit} * 2);
17081
17092
  `;
17093
+ const headerContainer = import_css66.css`
17094
+ margin-bottom: calc(${theme.vars.spacing.unit} * 3);
17095
+ padding-bottom: calc(${theme.vars.spacing.unit} * 2);
17096
+ border-bottom: 1px solid ${theme.vars.colors.border};
17097
+ `;
17098
+ const title = import_css66.css`
17099
+ font-size: 1.75rem;
17100
+ font-weight: 700;
17101
+ color: ${theme.vars.colors.text.primary};
17102
+ margin: 0 0 6px 0;
17103
+ letter-spacing: -0.01em;
17104
+ `;
17105
+ const subtitle = import_css66.css`
17106
+ font-size: 0.875rem;
17107
+ color: ${theme.vars.colors.text.secondary};
17108
+ margin: 0;
17109
+ `;
17082
17110
  const form = import_css66.css`
17083
17111
  display: flex;
17084
17112
  flex-direction: column;
@@ -17093,12 +17121,25 @@ var useStyles30 = (theme, colorScheme) => (0, import_react104.useMemo)(() => {
17093
17121
  `;
17094
17122
  const field = import_css66.css`
17095
17123
  display: flex;
17096
- align-items: center;
17124
+ align-items: flex-start;
17097
17125
  padding: ${theme.vars.spacing.unit} 0;
17098
- border-bottom: 1px solid ${theme.vars.colors.border};
17099
17126
  min-height: 32px;
17100
17127
  `;
17128
+ const label = import_css66.css`
17129
+ font-size: 0.875rem;
17130
+ font-weight: 600;
17131
+ color: ${theme.vars.colors.text.primary};
17132
+ width: 200px;
17133
+ min-width: 200px;
17134
+ flex-shrink: 0;
17135
+ text-align: left;
17136
+ padding-right: calc(${theme.vars.spacing.unit} * 2);
17137
+ padding-top: calc(${theme.vars.spacing.unit} * 0.75);
17138
+ white-space: nowrap;
17139
+ line-height: 1.4;
17140
+ `;
17101
17141
  const fieldGroup = import_css66.css`
17142
+ flex: 1;
17102
17143
  display: flex;
17103
17144
  flex-direction: column;
17104
17145
  gap: calc(${theme.vars.spacing.unit} * 0.5);
@@ -17115,6 +17156,8 @@ var useStyles30 = (theme, colorScheme) => (0, import_react104.useMemo)(() => {
17115
17156
  min-height: 80px;
17116
17157
  resize: vertical;
17117
17158
  outline: none;
17159
+ box-sizing: border-box;
17160
+ transition: border-color 0.2s, box-shadow 0.2s;
17118
17161
  &:focus {
17119
17162
  border-color: ${theme.vars.colors.primary.main};
17120
17163
  box-shadow: 0 0 0 2px ${theme.vars.colors.primary.main}20;
@@ -17172,12 +17215,16 @@ var useStyles30 = (theme, colorScheme) => (0, import_react104.useMemo)(() => {
17172
17215
  fieldGroup,
17173
17216
  form,
17174
17217
  header,
17218
+ headerContainer,
17175
17219
  infoContainer,
17176
17220
  input,
17221
+ label,
17177
17222
  popup,
17178
17223
  root,
17224
+ subtitle,
17179
17225
  textarea,
17180
17226
  textareaError,
17227
+ title,
17181
17228
  value
17182
17229
  };
17183
17230
  }, [
@@ -17288,53 +17335,68 @@ var BaseCreateOrganization = ({
17288
17335
  logger11.error("Form submission error:");
17289
17336
  }
17290
17337
  };
17338
+ const getTranslation = (key, fallback) => {
17339
+ const text = t(key);
17340
+ return text && text !== key ? text : fallback;
17341
+ };
17291
17342
  const createOrganizationContent = /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["root"], cardLayout && styles["card"], className), style, children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["content"]), children: [
17343
+ mode !== "popup" && /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["headerContainer"]), children: [
17344
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Typography_default, { variant: "h5", component: "h1", className: (0, import_css67.cx)(styles["title"]), children: getTranslation("organization.create.heading", title || "Create organization") }),
17345
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css67.cx)(styles["subtitle"]), children: getTranslation("organization.create.subheading", "Set up a new organization workspace.") })
17346
+ ] }),
17292
17347
  /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("form", { id: "create-organization-form", className: (0, import_css67.cx)(styles["form"]), onSubmit: handleSubmit, children: [
17293
17348
  error && /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(Alert_default, { variant: "error", className: styles["errorAlert"], children: [
17294
17349
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Alert_default.Title, { children: "Error" }),
17295
17350
  /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(Alert_default.Description, { children: error })
17296
17351
  ] }),
17297
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17298
- TextField_default,
17299
- {
17300
- label: `${t("elements.fields.organization.name.label")}`,
17301
- placeholder: t("elements.fields.organization.name.placeholder"),
17302
- value: formData.name,
17303
- onChange: (e) => handleNameChange(e.target.value),
17304
- disabled: loading,
17305
- required: true,
17306
- error: formErrors.name,
17307
- className: (0, import_css67.cx)(styles["input"])
17308
- }
17309
- ) }),
17310
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17311
- TextField_default,
17312
- {
17313
- label: `${t("elements.fields.organization.handle.label") || "Organization Handle"}`,
17314
- placeholder: t("elements.fields.organization.handle.placeholder") || "my-organization",
17315
- value: formData.handle,
17316
- onChange: (e) => handleInputChange("handle", e.target.value),
17317
- disabled: loading,
17318
- required: true,
17319
- error: formErrors.handle,
17320
- helperText: "This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.",
17321
- className: (0, import_css67.cx)(styles["input"])
17322
- }
17323
- ) }),
17324
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(FormControl_default, { error: formErrors.description, children: [
17325
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(InputLabel_default, { required: true, children: t("elements.fields.organization.description.label") }),
17326
- /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17352
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["field"]), children: [
17353
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(InputLabel_default, { required: true, className: (0, import_css67.cx)(styles["label"]), children: getTranslation("elements.fields.organization.name.label", "Organization Name") }),
17354
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17355
+ TextField_default,
17356
+ {
17357
+ placeholder: getTranslation("elements.fields.organization.name.placeholder", "Organization Name"),
17358
+ value: formData.name,
17359
+ onChange: (e) => handleNameChange(e.target.value),
17360
+ disabled: loading,
17361
+ required: true,
17362
+ error: formErrors.name,
17363
+ className: (0, import_css67.cx)(styles["input"])
17364
+ }
17365
+ ) })
17366
+ ] }),
17367
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["field"]), children: [
17368
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(InputLabel_default, { required: true, className: (0, import_css67.cx)(styles["label"]), children: getTranslation("elements.fields.organization.handle.label", "Organization Handle") }),
17369
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17370
+ TextField_default,
17371
+ {
17372
+ placeholder: getTranslation("elements.fields.organization.handle.placeholder", "my-organization"),
17373
+ value: formData.handle,
17374
+ onChange: (e) => handleInputChange("handle", e.target.value),
17375
+ disabled: loading,
17376
+ required: true,
17377
+ error: formErrors.handle,
17378
+ helperText: "This will be your organization's unique identifier. Only lowercase letters, numbers, and hyphens are allowed.",
17379
+ className: (0, import_css67.cx)(styles["input"])
17380
+ }
17381
+ ) })
17382
+ ] }),
17383
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["field"]), children: [
17384
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(InputLabel_default, { required: true, className: (0, import_css67.cx)(styles["label"]), children: getTranslation("elements.fields.organization.description.label", "Organization Description") }),
17385
+ /* @__PURE__ */ (0, import_jsx_runtime118.jsx)("div", { className: (0, import_css67.cx)(styles["fieldGroup"]), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(FormControl_default, { error: formErrors.description, children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
17327
17386
  "textarea",
17328
17387
  {
17329
17388
  className: (0, import_css67.cx)(styles["textarea"], formErrors.description && styles["textareaError"]),
17330
- placeholder: t("organization.create.description.placeholder"),
17389
+ placeholder: getTranslation(
17390
+ "organization.create.description.placeholder",
17391
+ "Enter organization description"
17392
+ ),
17331
17393
  value: formData.description,
17332
17394
  onChange: (e) => handleInputChange("description", e.target.value),
17333
17395
  disabled: loading,
17334
17396
  required: true
17335
17397
  }
17336
- )
17337
- ] }) }),
17398
+ ) }) })
17399
+ ] }),
17338
17400
  renderAdditionalFields && renderAdditionalFields()
17339
17401
  ] }),
17340
17402
  /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: (0, import_css67.cx)(styles["actions"]), children: [
@@ -17475,14 +17537,19 @@ var useStyles31 = (theme, colorScheme) => (0, import_react107.useMemo)(() => {
17475
17537
  padding-bottom: calc(${theme.vars.spacing.unit} * 2);
17476
17538
  border-bottom: 1px solid ${theme.vars.colors.border};
17477
17539
  `;
17540
+ const headerContainer = import_css68.css`
17541
+ margin-bottom: calc(${theme.vars.spacing.unit} * 3);
17542
+ padding-bottom: calc(${theme.vars.spacing.unit} * 2);
17543
+ border-bottom: 1px solid ${theme.vars.colors.border};
17544
+ `;
17478
17545
  const headerInfo = import_css68.css`
17479
17546
  flex: 1;
17480
17547
  `;
17481
17548
  const title = import_css68.css`
17482
- font-size: 1.5rem;
17483
- font-weight: 600;
17484
- margin: 0 0 8px 0;
17549
+ font-size: 1.75rem;
17550
+ font-weight: 700;
17485
17551
  color: ${theme.vars.colors.text.primary};
17552
+ margin: 0 0 calc(${theme.vars.spacing.unit} * 0.5) 0;
17486
17553
  `;
17487
17554
  const subtitle = import_css68.css`
17488
17555
  color: ${theme.vars.colors.text.secondary};
@@ -17641,7 +17708,7 @@ var useStyles31 = (theme, colorScheme) => (0, import_react107.useMemo)(() => {
17641
17708
  errorContainer,
17642
17709
  errorMargin,
17643
17710
  header,
17644
- headerInfo,
17711
+ headerContainer,
17645
17712
  listContainer,
17646
17713
  loadMoreButton,
17647
17714
  loadMoreMargin,
@@ -17752,7 +17819,8 @@ var BaseOrganizationList = ({
17752
17819
  renderLoadMore,
17753
17820
  renderOrganization,
17754
17821
  style,
17755
- title = "Organizations",
17822
+ title,
17823
+ subheading,
17756
17824
  showStatus,
17757
17825
  preferences
17758
17826
  }) => {
@@ -17804,7 +17872,15 @@ var BaseOrganizationList = ({
17804
17872
  }
17805
17873
  return emptyContent;
17806
17874
  }
17875
+ const getTranslation = (key, fallback) => {
17876
+ const text = t(key);
17877
+ return text && text !== key ? text : fallback;
17878
+ };
17807
17879
  const organizationListContent = /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: (0, import_css69.cx)(styles["root"], className), style, children: [
17880
+ mode !== "popup" && /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: (0, import_css69.cx)(styles["headerContainer"]), children: [
17881
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Typography_default, { variant: "h5", component: "h1", className: (0, import_css69.cx)(styles["title"]), children: getTranslation("organization.list.heading", title || "Organizations List") }),
17882
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css69.cx)(styles["subtitle"]), children: getTranslation("organization.list.subheading", subheading || "View list of organizations.") })
17883
+ ] }),
17808
17884
  /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: (0, import_css69.cx)(styles["header"]), children: [
17809
17885
  /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: (0, import_css69.cx)(styles["headerInfo"]), children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css69.cx)(styles["subtitle"]), children: t("organization.switcher.showing.count", {
17810
17886
  showing: organizationsWithSwitchAccess?.length,
@@ -18007,6 +18083,7 @@ var useStyles33 = (theme, colorScheme) => (0, import_react111.useMemo)(
18007
18083
  color: ${theme.vars.colors.text.secondary};
18008
18084
  margin: 0;
18009
18085
  font-family: monospace;
18086
+ text-align: left;
18010
18087
  `,
18011
18088
  header: import_css72.css`
18012
18089
  display: flex;
@@ -18015,6 +18092,11 @@ var useStyles33 = (theme, colorScheme) => (0, import_react111.useMemo)(
18015
18092
  margin-bottom: calc(${theme.vars.spacing.unit} * 3);
18016
18093
  padding-bottom: calc(${theme.vars.spacing.unit} * 2);
18017
18094
  `,
18095
+ headerContainer: import_css72.css`
18096
+ margin-bottom: calc(${theme.vars.spacing.unit} * 3);
18097
+ padding-bottom: calc(${theme.vars.spacing.unit} * 2);
18098
+ border-bottom: 1px solid ${theme.vars.colors.border};
18099
+ `,
18018
18100
  infoContainer: import_css72.css`
18019
18101
  display: flex;
18020
18102
  flex-direction: column;
@@ -18024,18 +18106,26 @@ var useStyles33 = (theme, colorScheme) => (0, import_react111.useMemo)(
18024
18106
  font-size: 0.875rem;
18025
18107
  font-weight: 500;
18026
18108
  color: ${theme.vars.colors.text.secondary};
18027
- width: 120px;
18109
+ width: 200px;
18110
+ min-width: 200px;
18028
18111
  flex-shrink: 0;
18029
18112
  line-height: 28px;
18113
+ text-align: left;
18114
+ white-space: nowrap;
18030
18115
  `,
18031
18116
  name: import_css72.css`
18032
18117
  font-size: 1.5rem;
18033
18118
  font-weight: 600;
18034
18119
  margin: 0 0 8px 0;
18035
18120
  color: ${theme.vars.colors.text.primary};
18121
+ text-align: left;
18036
18122
  `,
18037
18123
  orgInfo: import_css72.css`
18038
18124
  flex: 1;
18125
+ display: flex;
18126
+ flex-direction: column;
18127
+ align-items: flex-start;
18128
+ text-align: left;
18039
18129
  `,
18040
18130
  permissionBadge: import_css72.css`
18041
18131
  padding: calc(${theme.vars.spacing.unit} / 4) ${theme.vars.spacing.unit};
@@ -18075,6 +18165,17 @@ var useStyles33 = (theme, colorScheme) => (0, import_react111.useMemo)(
18075
18165
  text-transform: uppercase;
18076
18166
  letter-spacing: 0.5px;
18077
18167
  `,
18168
+ subtitle: import_css72.css`
18169
+ font-size: 0.875rem;
18170
+ color: ${theme.vars.colors.text.secondary};
18171
+ margin: 0;
18172
+ `,
18173
+ title: import_css72.css`
18174
+ font-size: 1.75rem;
18175
+ font-weight: 700;
18176
+ color: ${theme.vars.colors.text.primary};
18177
+ margin: 0 0 calc(${theme.vars.spacing.unit} * 0.5) 0;
18178
+ `,
18078
18179
  value: import_css72.css`
18079
18180
  color: ${theme.vars.colors.text.primary};
18080
18181
  flex: 1;
@@ -18471,7 +18572,9 @@ var BaseOrganizationProfile = ({
18471
18572
  className = "",
18472
18573
  cardLayout = true,
18473
18574
  organization,
18474
- title = "Organization Profile",
18575
+ preferences,
18576
+ title,
18577
+ subheading,
18475
18578
  mode = "inline",
18476
18579
  editable = true,
18477
18580
  onOpenChange,
@@ -18511,6 +18614,7 @@ var BaseOrganizationProfile = ({
18511
18614
  ]
18512
18615
  }) => {
18513
18616
  const { theme, colorScheme } = useTheme_default();
18617
+ const { t } = useTranslation_default(preferences?.i18n);
18514
18618
  const styles = BaseOrganizationProfile_styles_default(theme, colorScheme);
18515
18619
  const [editedOrganization, setEditedOrganization] = (0, import_react114.useState)(organization);
18516
18620
  const [editingFields, setEditingFields] = (0, import_react114.useState)({});
@@ -18726,7 +18830,15 @@ var BaseOrganizationProfile = ({
18726
18830
  if (!organization) {
18727
18831
  return fallback;
18728
18832
  }
18833
+ const getTranslation = (key, fallback2) => {
18834
+ const text = t(key);
18835
+ return text && text !== key ? text : fallback2;
18836
+ };
18729
18837
  const profileContent = /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Card_default, { className: (0, import_css75.cx)(styles["root"], cardLayout && styles["card"], className), children: [
18838
+ mode !== "popup" && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: (0, import_css75.cx)(styles["headerContainer"]), children: [
18839
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography_default, { variant: "h5", component: "h1", className: (0, import_css75.cx)(styles["title"]), children: getTranslation("organization.profile.heading", title || "Organization Profile") }),
18840
+ /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Typography_default, { variant: "body2", color: "textSecondary", className: (0, import_css75.cx)(styles["subtitle"]), children: getTranslation("organization.profile.subheading", subheading || "Manage your organization details.") })
18841
+ ] }),
18730
18842
  /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: (0, import_css75.cx)(styles["header"]), children: [
18731
18843
  /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Avatar, { name: getOrgInitials(organization.name), size: 80, alt: `${organization.name} logo` }),
18732
18844
  /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { className: (0, import_css75.cx)(styles["orgInfo"]), children: [