@sylphx/sdk 0.8.0 → 0.9.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.
@@ -13332,72 +13332,30 @@ function SylphxProviderInner({
13332
13332
  }, [authState.isSignedIn, authPrefix]);
13333
13333
  const resetPassword = useCallback28(
13334
13334
  async (options) => {
13335
- const response = await fetch(`${platformUrl}/v1/auth/reset-password`, {
13336
- method: "POST",
13337
- headers: { "Content-Type": "application/json" },
13338
- body: JSON.stringify({
13339
- token: options.token,
13340
- new_password: options.newPassword,
13341
- client_id: appId || ""
13342
- })
13335
+ await api.post("/auth/reset-password", {
13336
+ token: options.token,
13337
+ newPassword: options.newPassword
13343
13338
  });
13344
- if (!response.ok) {
13345
- const error = await response.json().catch(() => ({ message: "Password reset failed" }));
13346
- throw new Error(error.message || "Password reset failed");
13347
- }
13348
13339
  },
13349
- [appId, platformUrl]
13340
+ [api]
13350
13341
  );
13351
13342
  const verifyEmail = useCallback28(
13352
13343
  async (options) => {
13353
- const response = await fetch(`${platformUrl}/v1/auth/verify-email`, {
13354
- method: "POST",
13355
- headers: { "Content-Type": "application/json" },
13356
- body: JSON.stringify({
13357
- token: options.token,
13358
- client_id: appId || ""
13359
- })
13360
- });
13361
- if (!response.ok) {
13362
- const error = await response.json().catch(() => ({ message: "Email verification failed" }));
13363
- throw new Error(error.message || "Email verification failed");
13364
- }
13344
+ await api.post("/auth/verify-email", { token: options.token });
13365
13345
  },
13366
- [appId, platformUrl]
13346
+ [api]
13367
13347
  );
13368
13348
  const resendVerificationEmail = useCallback28(
13369
13349
  async (options) => {
13370
- const response = await fetch(`${platformUrl}/v1/auth/resend-verification`, {
13371
- method: "POST",
13372
- headers: { "Content-Type": "application/json" },
13373
- body: JSON.stringify({
13374
- email: options.email,
13375
- client_id: appId || ""
13376
- })
13377
- });
13378
- if (!response.ok) {
13379
- const error = await response.json().catch(() => ({ message: "Failed to resend verification email" }));
13380
- throw new Error(error.message || "Failed to resend verification email");
13381
- }
13350
+ await api.post("/auth/resend-verification", { email: options.email });
13382
13351
  },
13383
- [appId, platformUrl]
13352
+ [api]
13384
13353
  );
13385
13354
  const forgotPassword = useCallback28(
13386
13355
  async (options) => {
13387
- const response = await fetch(`${platformUrl}/v1/auth/forgot-password`, {
13388
- method: "POST",
13389
- headers: { "Content-Type": "application/json" },
13390
- body: JSON.stringify({
13391
- email: options.email,
13392
- client_id: appId || ""
13393
- })
13394
- });
13395
- if (!response.ok) {
13396
- const error = await response.json().catch(() => ({ message: "Failed to send password reset email" }));
13397
- throw new Error(error.message || "Failed to send password reset email");
13398
- }
13356
+ await api.post("/auth/forgot-password", { email: options.email });
13399
13357
  },
13400
- [appId, platformUrl]
13358
+ [api]
13401
13359
  );
13402
13360
  const clearOAuthError = useCallback28(() => {
13403
13361
  setAuthState((prev) => ({ ...prev, oauthError: null }));
@@ -14272,15 +14230,7 @@ function SylphxProviderInner({
14272
14230
  });
14273
14231
  },
14274
14232
  verifyEmail: async (token) => {
14275
- const response = await fetch(`${platformUrl}/v1/auth/verify-email`, {
14276
- method: "POST",
14277
- headers: { "Content-Type": "application/json" },
14278
- body: JSON.stringify({ token, client_id: appId || "" })
14279
- });
14280
- if (!response.ok) {
14281
- const error = await response.json().catch(() => ({ message: "Email verification failed" }));
14282
- throw new Error(error.message || "Email verification failed");
14283
- }
14233
+ await api.post("/auth/verify-email", { token });
14284
14234
  return { success: true };
14285
14235
  },
14286
14236
  logout: async (_refreshToken) => {