@djangocfg/api 2.1.100 → 2.1.101

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/auth.d.cts CHANGED
@@ -300,6 +300,12 @@ interface AuthContextType {
300
300
  getRedirectUrl: () => string;
301
301
  clearRedirectUrl: () => void;
302
302
  hasRedirectUrl: () => boolean;
303
+ updateProfile: (data: {
304
+ first_name?: string;
305
+ last_name?: string;
306
+ username?: string;
307
+ }) => Promise<UserProfile>;
308
+ uploadAvatar: (avatar: File | Blob) => Promise<UserProfile>;
303
309
  }
304
310
  interface AuthProviderProps {
305
311
  children: React$1.ReactNode;
package/dist/auth.d.ts CHANGED
@@ -300,6 +300,12 @@ interface AuthContextType {
300
300
  getRedirectUrl: () => string;
301
301
  clearRedirectUrl: () => void;
302
302
  hasRedirectUrl: () => boolean;
303
+ updateProfile: (data: {
304
+ first_name?: string;
305
+ last_name?: string;
306
+ username?: string;
307
+ }) => Promise<UserProfile>;
308
+ uploadAvatar: (avatar: File | Blob) => Promise<UserProfile>;
303
309
  }
304
310
  interface AuthProviderProps {
305
311
  children: React$1.ReactNode;
package/dist/auth.mjs CHANGED
@@ -4681,6 +4681,20 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4681
4681
  const isAdminUser = useMemo(() => {
4682
4682
  return Boolean(user?.is_staff || user?.is_superuser);
4683
4683
  }, [user]);
4684
+ const updateProfile = useCallback3(
4685
+ async (data) => {
4686
+ const result = await accounts.partialUpdateProfile(data);
4687
+ return result;
4688
+ },
4689
+ [accounts]
4690
+ );
4691
+ const uploadAvatar = useCallback3(
4692
+ async (avatar) => {
4693
+ const result = await accounts.uploadAvatar(avatar);
4694
+ return result;
4695
+ },
4696
+ [accounts]
4697
+ );
4684
4698
  const value = useMemo(
4685
4699
  () => ({
4686
4700
  user,
@@ -4706,7 +4720,10 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4706
4720
  saveRedirectUrl: redirectManager.setRedirect,
4707
4721
  getRedirectUrl: redirectManager.getFinalRedirectUrl,
4708
4722
  clearRedirectUrl: redirectManager.clearRedirect,
4709
- hasRedirectUrl: redirectManager.hasRedirect
4723
+ hasRedirectUrl: redirectManager.hasRedirect,
4724
+ // Profile management
4725
+ updateProfile,
4726
+ uploadAvatar
4710
4727
  }),
4711
4728
  [
4712
4729
  user,
@@ -4724,7 +4741,9 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4724
4741
  verifyOTP,
4725
4742
  refreshToken,
4726
4743
  logout,
4727
- redirectManager
4744
+ redirectManager,
4745
+ updateProfile,
4746
+ uploadAvatar
4728
4747
  ]
4729
4748
  );
4730
4749
  return /* @__PURE__ */ jsx2(AuthContext.Provider, { value, children });
@@ -4777,7 +4796,15 @@ var defaultAuthState = {
4777
4796
  getRedirectUrl: /* @__PURE__ */ __name(() => null, "getRedirectUrl"),
4778
4797
  clearRedirectUrl: /* @__PURE__ */ __name(() => {
4779
4798
  }, "clearRedirectUrl"),
4780
- hasRedirectUrl: /* @__PURE__ */ __name(() => false, "hasRedirectUrl")
4799
+ hasRedirectUrl: /* @__PURE__ */ __name(() => false, "hasRedirectUrl"),
4800
+ updateProfile: /* @__PURE__ */ __name(async () => {
4801
+ authLogger.warn("useAuth: updateProfile called outside AuthProvider");
4802
+ return {};
4803
+ }, "updateProfile"),
4804
+ uploadAvatar: /* @__PURE__ */ __name(async () => {
4805
+ authLogger.warn("useAuth: uploadAvatar called outside AuthProvider");
4806
+ return {};
4807
+ }, "uploadAvatar")
4781
4808
  };
4782
4809
  var useAuth = /* @__PURE__ */ __name(() => {
4783
4810
  const context = useContext2(AuthContext);