@insforge/react 1.0.5-dev.0 → 1.0.5-dev.1

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.
@@ -2,7 +2,6 @@
2
2
 
3
3
  var React2 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
- require('@insforge/sdk');
6
5
  var react = require('@insforge/shared/react');
7
6
  var lucideReact = require('lucide-react');
8
7
  var zod = require('zod');
@@ -4910,7 +4909,7 @@ function UserProfileModal({ onClose, onError }) {
4910
4909
  React2.useEffect(() => {
4911
4910
  if (user) {
4912
4911
  const initialData = {
4913
- name: user.name || ""
4912
+ name: user.profile?.name || ""
4914
4913
  };
4915
4914
  if (user.profile) {
4916
4915
  Object.entries(user.profile).forEach(([key, value]) => {
@@ -4924,7 +4923,7 @@ function UserProfileModal({ onClose, onError }) {
4924
4923
  }, [user]);
4925
4924
  React2.useEffect(() => {
4926
4925
  setImageError(false);
4927
- const avatarUrl = user?.avatarUrl;
4926
+ const avatarUrl = user?.profile?.avatar_url;
4928
4927
  if (!avatarUrl) {
4929
4928
  return;
4930
4929
  }
@@ -4942,7 +4941,7 @@ function UserProfileModal({ onClose, onError }) {
4942
4941
  }
4943
4942
  };
4944
4943
  void checkImageUrl();
4945
- }, [user?.avatarUrl]);
4944
+ }, [user?.profile?.avatar_url]);
4946
4945
  const handleFieldChange = React2.useCallback((key, value) => {
4947
4946
  setFormData((prev2) => ({
4948
4947
  ...prev2,
@@ -4955,7 +4954,9 @@ function UserProfileModal({ onClose, onError }) {
4955
4954
  try {
4956
4955
  const { name, ...dynamicFields } = formData;
4957
4956
  const updateData = {
4958
- name
4957
+ profile: {
4958
+ name
4959
+ }
4959
4960
  };
4960
4961
  if (Object.keys(dynamicFields).length > 0) {
4961
4962
  updateData.profile = dynamicFields;
@@ -4975,7 +4976,7 @@ function UserProfileModal({ onClose, onError }) {
4975
4976
  const handleCancel = React2.useCallback(() => {
4976
4977
  if (user) {
4977
4978
  const resetData = {
4978
- name: user.name || ""
4979
+ name: user.profile?.name || ""
4979
4980
  };
4980
4981
  if (user.profile) {
4981
4982
  Object.entries(user.profile).forEach(([key, value]) => {
@@ -5012,12 +5013,12 @@ function UserProfileModal({ onClose, onError }) {
5012
5013
  if (!isLoaded || !user) {
5013
5014
  return null;
5014
5015
  }
5015
- const initials = user.name ? user.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
5016
+ const initials = user.profile?.name ? user.profile.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
5016
5017
  const fields = [];
5017
5018
  fields.push({ key: "email", value: user.email, readOnly: true });
5018
5019
  fields.push({
5019
5020
  key: "name",
5020
- value: isEditing ? formData.name || "" : user.name || "",
5021
+ value: isEditing ? formData.name || "" : user.profile?.name || "",
5021
5022
  readOnly: false
5022
5023
  });
5023
5024
  if (user.profile) {
@@ -5037,11 +5038,11 @@ function UserProfileModal({ onClose, onError }) {
5037
5038
  /* @__PURE__ */ jsxRuntime.jsx(ProfileModalCloseButton, { onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, {}) })
5038
5039
  ] }),
5039
5040
  /* @__PURE__ */ jsxRuntime.jsxs(ProfileModalBody, { children: [
5040
- /* @__PURE__ */ jsxRuntime.jsx(ProfileAvatarSection, { children: /* @__PURE__ */ jsxRuntime.jsx(ProfileAvatar, { children: user.avatarUrl && !imageError ? /* @__PURE__ */ jsxRuntime.jsx(
5041
+ /* @__PURE__ */ jsxRuntime.jsx(ProfileAvatarSection, { children: /* @__PURE__ */ jsxRuntime.jsx(ProfileAvatar, { children: user.profile?.avatar_url && !imageError ? /* @__PURE__ */ jsxRuntime.jsx(
5041
5042
  ProfileAvatarImage,
5042
5043
  {
5043
- src: user.avatarUrl,
5044
- alt: user.name || user.email,
5044
+ src: user.profile.avatar_url,
5045
+ alt: user.profile?.name || user.email,
5045
5046
  onError: () => setImageError(true)
5046
5047
  }
5047
5048
  ) : initials }) }),
@@ -5060,7 +5061,7 @@ function UserProfileModal({ onClose, onError }) {
5060
5061
  ] }),
5061
5062
  /* @__PURE__ */ jsxRuntime.jsx(ProfileModalFooter, { children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5062
5063
  /* @__PURE__ */ jsxRuntime.jsx(ProfileButton, { onClick: handleCancel, disabled: isSaving, children: "Cancel" }),
5063
- /* @__PURE__ */ jsxRuntime.jsxs(ProfileButton, { $primary: true, onClick: handleSave, disabled: isSaving, children: [
5064
+ /* @__PURE__ */ jsxRuntime.jsxs(ProfileButton, { $primary: true, onClick: () => void handleSave(), disabled: isSaving, children: [
5064
5065
  isSaving && /* @__PURE__ */ jsxRuntime.jsx(ProfileSpinner, {}),
5065
5066
  isSaving ? "Saving..." : "Save"
5066
5067
  ] })
@@ -5083,7 +5084,7 @@ function UserButton({
5083
5084
  const menuRef = React2.useRef(null);
5084
5085
  React2.useEffect(() => {
5085
5086
  setImageError(false);
5086
- const avatarUrl = user?.avatarUrl;
5087
+ const avatarUrl = user?.profile?.avatar_url;
5087
5088
  if (!avatarUrl) {
5088
5089
  return;
5089
5090
  }
@@ -5104,7 +5105,7 @@ function UserButton({
5104
5105
  }
5105
5106
  };
5106
5107
  void checkImageUrl();
5107
- }, [user?.avatarUrl]);
5108
+ }, [user?.profile?.avatar_url]);
5108
5109
  React2.useEffect(() => {
5109
5110
  if (isOpen && dropdownRef.current) {
5110
5111
  const buttonRect = dropdownRef.current.getBoundingClientRect();
@@ -5148,7 +5149,7 @@ function UserButton({
5148
5149
  if (!user) {
5149
5150
  return null;
5150
5151
  }
5151
- const initials = user.name ? user.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
5152
+ const initials = user.profile?.name ? user.profile.name.charAt(0).toUpperCase() : user.email.split("@")[0].slice(0, 2).toUpperCase();
5152
5153
  return /* @__PURE__ */ jsxRuntime.jsxs(UserButtonContainer, { ref: dropdownRef, children: [
5153
5154
  /* @__PURE__ */ jsxRuntime.jsxs(
5154
5155
  UserButtonButton,
@@ -5158,16 +5159,16 @@ function UserButton({
5158
5159
  "aria-expanded": isOpen,
5159
5160
  "aria-haspopup": "true",
5160
5161
  children: [
5161
- /* @__PURE__ */ jsxRuntime.jsx(UserButtonAvatar, { children: user.avatarUrl && !imageError ? /* @__PURE__ */ jsxRuntime.jsx(
5162
+ /* @__PURE__ */ jsxRuntime.jsx(UserButtonAvatar, { children: user.profile?.avatar_url && !imageError ? /* @__PURE__ */ jsxRuntime.jsx(
5162
5163
  UserButtonAvatarImage,
5163
5164
  {
5164
- src: user.avatarUrl,
5165
+ src: user.profile.avatar_url,
5165
5166
  alt: user.email,
5166
5167
  onError: () => setImageError(true)
5167
5168
  }
5168
5169
  ) : /* @__PURE__ */ jsxRuntime.jsx(UserButtonAvatarInitials, { children: initials }) }),
5169
5170
  mode === "detailed" && /* @__PURE__ */ jsxRuntime.jsxs(UserButtonInfo, { children: [
5170
- user.name && /* @__PURE__ */ jsxRuntime.jsx(UserButtonName, { children: user.name }),
5171
+ user.profile?.name && /* @__PURE__ */ jsxRuntime.jsx(UserButtonName, { children: user.profile.name }),
5171
5172
  /* @__PURE__ */ jsxRuntime.jsx(UserButtonEmail, { children: user.email })
5172
5173
  ] })
5173
5174
  ]
@@ -5192,13 +5193,7 @@ function UserButton({
5192
5193
  "Sign out"
5193
5194
  ] }) })
5194
5195
  ] }),
5195
- showProfileModal && /* @__PURE__ */ jsxRuntime.jsx(
5196
- UserProfileModal,
5197
- {
5198
- onClose: () => setShowProfileModal(false),
5199
- onError: onProfileError
5200
- }
5201
- )
5196
+ showProfileModal && /* @__PURE__ */ jsxRuntime.jsx(UserProfileModal, { onClose: () => setShowProfileModal(false), onError: onProfileError })
5202
5197
  ] });
5203
5198
  }
5204
5199
  function Protect({