@scalemule/nextjs 0.1.66 → 0.1.67

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/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ac as StorageAdapter, A as ApiError } from './index-CEi5Nd4L.mjs';
1
+ import { ac as StorageAdapter, A as ApiError } from './index-BOPHR50i.mjs';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ac as StorageAdapter, A as ApiError } from './index-CEi5Nd4L.js';
1
+ import { ac as StorageAdapter, A as ApiError } from './index-BOPHR50i.js';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
@@ -178,6 +178,12 @@ interface RegisterRequest {
178
178
  website?: string;
179
179
  company?: string;
180
180
  hp_field?: string;
181
+ /**
182
+ * Token from an account invitation link. When ScaleMule challenges a sign-up
183
+ * (for example a first-time browser), a pending invitation addressed to this
184
+ * email lets the registration through. It does not accept the invitation.
185
+ */
186
+ invitation_token?: string;
181
187
  }
182
188
  interface LoginRequest {
183
189
  challenge_token?: string;
@@ -508,7 +514,7 @@ interface UseAuthReturn {
508
514
  /** Reset password with token */
509
515
  resetPassword: (token: string, newPassword: string) => Promise<void>;
510
516
  /** Verify email with token */
511
- verifyEmail: (token: string) => Promise<void>;
517
+ verifyEmail: (token: string, email?: string) => Promise<void>;
512
518
  /** Resend verification email (optional email for unauthenticated resend) */
513
519
  resendVerification: (email?: string) => Promise<void>;
514
520
  /** Refresh session token */
@@ -178,6 +178,12 @@ interface RegisterRequest {
178
178
  website?: string;
179
179
  company?: string;
180
180
  hp_field?: string;
181
+ /**
182
+ * Token from an account invitation link. When ScaleMule challenges a sign-up
183
+ * (for example a first-time browser), a pending invitation addressed to this
184
+ * email lets the registration through. It does not accept the invitation.
185
+ */
186
+ invitation_token?: string;
181
187
  }
182
188
  interface LoginRequest {
183
189
  challenge_token?: string;
@@ -508,7 +514,7 @@ interface UseAuthReturn {
508
514
  /** Reset password with token */
509
515
  resetPassword: (token: string, newPassword: string) => Promise<void>;
510
516
  /** Verify email with token */
511
- verifyEmail: (token: string) => Promise<void>;
517
+ verifyEmail: (token: string, email?: string) => Promise<void>;
512
518
  /** Resend verification email (optional email for unauthenticated resend) */
513
519
  resendVerification: (email?: string) => Promise<void>;
514
520
  /** Refresh session token */
package/dist/index.d.mts CHANGED
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
6
6
  export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
7
7
  import { ScaleMuleClient } from './client.mjs';
8
8
  export { ClientConfig, RequestOptions, createClient } from './client.mjs';
9
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CEi5Nd4L.mjs';
10
- export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-CEi5Nd4L.mjs';
9
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.mjs';
10
+ export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.mjs';
11
11
 
12
12
  /**
13
13
  * Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
package/dist/index.d.ts CHANGED
@@ -6,8 +6,8 @@ import { MoneyClient } from '@scalemule/money';
6
6
  export { MoneyClient, MoneyClientConfig, createMoneyClient } from '@scalemule/money';
7
7
  import { ScaleMuleClient } from './client.js';
8
8
  export { ClientConfig, RequestOptions, createClient } from './client.js';
9
- import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-CEi5Nd4L.js';
10
- export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-CEi5Nd4L.js';
9
+ import { S as ScaleMuleConfig, U as User, L as LoginResponse, A as ApiError$1, a as UseAuthReturn, b as UseBillingReturn, c as ListFilesParams, d as UseContentReturn, e as UseUserReturn, f as UseAnalyticsOptions, g as UseAnalyticsReturn } from './index-BOPHR50i.js';
10
+ export { h as AccountBalance, i as AnalyticsEvent, j as ApiResponse, k as AuthLoginResponse, B as BatchTrackRequest, l as BillingPayment, m as BillingPayout, n as BillingRefund, o as BillingTransaction, C as ChangeEmailRequest, p as ChangePasswordRequest, q as ClientContext, r as ConnectedAccount, s as CookieLoginResponse, t as CookieOAuthCallbackResponse, D as DeviceFingerprint, u as DeviceInfo, E as EnhancedAnalyticsEvent, F as ForgotPasswordRequest, K as KnownAccountInfo, v as LinkedAccount, w as ListFilesResponse, x as LoginDeviceInfo, y as LoginRequest, z as LoginResponseWithMFA, G as LoginRiskInfo, M as MFAChallengeResponse, H as MFAMethod, I as MFASMSSetupResponse, J as MFASetupRequest, N as MFAStatus, O as MFATOTPSetupResponse, P as MFAVerifyRequest, Q as OAuthCallbackRequest, R as OAuthCallbackResponse, T as OAuthConfig, V as OAuthProvider, W as OAuthStartResponse, X as PageViewData, Y as PayoutSchedule, Z as PhoneLoginRequest, _ as PhoneSendCodeRequest, $ as PhoneVerifyRequest, a0 as Profile, a1 as ProxyBearerLoginResponse, a2 as RefreshResponse, a3 as RegisterRequest, a4 as ResetPasswordRequest, a5 as ScaleMuleApiError, a6 as ScaleMuleEnvironment, a7 as Session, a8 as SignedUploadCompleteRequest, a9 as SignedUploadRequest, aa as SignedUploadResponse, ab as SignedUploadUrl, ac as StorageAdapter, ad as StorageFile, ae as TrackEventResponse, af as TransactionSummary, ag as UTMParams, ah as UpdateProfileRequest, ai as UploadOptions, aj as UploadResponse, ak as VerifyEmailRequest } from './index-BOPHR50i.js';
11
11
 
12
12
  /**
13
13
  * Tri-state file visibility — `'private' | 'app_public' | 'anonymous_visible'`.
package/dist/index.js CHANGED
@@ -1818,10 +1818,11 @@ function useAuth() {
1818
1818
  [client, setUser, setError, authProxyUrl]
1819
1819
  );
1820
1820
  const verifyEmail = React.useCallback(
1821
- async (token) => {
1821
+ async (token, email) => {
1822
1822
  setError(null);
1823
+ const body = email ? { token, email } : { token };
1823
1824
  if (authProxyUrl) {
1824
- const response = await proxyFetch(authProxyUrl, "verify-email", { body: { token } });
1825
+ const response = await proxyFetch(authProxyUrl, "verify-email", { body });
1825
1826
  if (!response.success) {
1826
1827
  const err = response.error || {
1827
1828
  code: "VERIFY_EMAIL_FAILED",
@@ -1832,7 +1833,7 @@ function useAuth() {
1832
1833
  }
1833
1834
  } else {
1834
1835
  try {
1835
- const result = await client.post("/v1/auth/verify-email", { token });
1836
+ const result = await client.post("/v1/auth/verify-email", body);
1836
1837
  if (result?.session_token && result?.user) {
1837
1838
  await client.setSession(result.session_token, result.user.id);
1838
1839
  setUser(result.user);
package/dist/index.mjs CHANGED
@@ -1798,10 +1798,11 @@ function useAuth() {
1798
1798
  [client, setUser, setError, authProxyUrl]
1799
1799
  );
1800
1800
  const verifyEmail = useCallback(
1801
- async (token) => {
1801
+ async (token, email) => {
1802
1802
  setError(null);
1803
+ const body = email ? { token, email } : { token };
1803
1804
  if (authProxyUrl) {
1804
- const response = await proxyFetch(authProxyUrl, "verify-email", { body: { token } });
1805
+ const response = await proxyFetch(authProxyUrl, "verify-email", { body });
1805
1806
  if (!response.success) {
1806
1807
  const err = response.error || {
1807
1808
  code: "VERIFY_EMAIL_FAILED",
@@ -1812,7 +1813,7 @@ function useAuth() {
1812
1813
  }
1813
1814
  } else {
1814
1815
  try {
1815
- const result = await client.post("/v1/auth/verify-email", { token });
1816
+ const result = await client.post("/v1/auth/verify-email", body);
1816
1817
  if (result?.session_token && result?.user) {
1817
1818
  await client.setSession(result.session_token, result.user.id);
1818
1819
  setUser(result.user);
@@ -257,8 +257,11 @@ var ScaleMuleServer = class {
257
257
  /**
258
258
  * Verify email with token
259
259
  */
260
- verifyEmail: async (token) => {
261
- return this.request("POST", "/v1/auth/verify-email", { body: { token } });
260
+ verifyEmail: async (token, email, options) => {
261
+ return this.request("POST", "/v1/auth/verify-email", {
262
+ body: email ? { token, email } : { token },
263
+ clientContext: options?.clientContext
264
+ });
262
265
  },
263
266
  /**
264
267
  * Resend verification email.
@@ -1440,7 +1443,7 @@ function createAuthRoutes(config = {}) {
1440
1443
  switch (path) {
1441
1444
  // ==================== Register ====================
1442
1445
  case "register": {
1443
- const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
1446
+ const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
1444
1447
  if (!email || !password) {
1445
1448
  return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
1446
1449
  }
@@ -1460,7 +1463,18 @@ function createAuthRoutes(config = {}) {
1460
1463
  }
1461
1464
  let registeredUser;
1462
1465
  try {
1463
- registeredUser = await sm.auth.register({ email, password, full_name, username, phone }, { clientContext });
1466
+ registeredUser = await sm.auth.register(
1467
+ {
1468
+ email,
1469
+ password,
1470
+ full_name,
1471
+ username,
1472
+ phone,
1473
+ // Lets an invited person through a first-visit trust challenge.
1474
+ ...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
1475
+ },
1476
+ { clientContext }
1477
+ );
1464
1478
  } catch (err) {
1465
1479
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1466
1480
  return errorResponse(
@@ -1626,13 +1640,13 @@ function createAuthRoutes(config = {}) {
1626
1640
  }
1627
1641
  // ==================== Verify Email ====================
1628
1642
  case "verify-email": {
1629
- const { token } = body;
1643
+ const { token, email } = body;
1630
1644
  if (!token) {
1631
1645
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1632
1646
  }
1633
1647
  let verifyData;
1634
1648
  try {
1635
- verifyData = await sm.auth.verifyEmail(token);
1649
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1636
1650
  } catch (err) {
1637
1651
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1638
1652
  return errorResponse(
@@ -255,8 +255,11 @@ var ScaleMuleServer = class {
255
255
  /**
256
256
  * Verify email with token
257
257
  */
258
- verifyEmail: async (token) => {
259
- return this.request("POST", "/v1/auth/verify-email", { body: { token } });
258
+ verifyEmail: async (token, email, options) => {
259
+ return this.request("POST", "/v1/auth/verify-email", {
260
+ body: email ? { token, email } : { token },
261
+ clientContext: options?.clientContext
262
+ });
260
263
  },
261
264
  /**
262
265
  * Resend verification email.
@@ -1438,7 +1441,7 @@ function createAuthRoutes(config = {}) {
1438
1441
  switch (path) {
1439
1442
  // ==================== Register ====================
1440
1443
  case "register": {
1441
- const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
1444
+ const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
1442
1445
  if (!email || !password) {
1443
1446
  return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
1444
1447
  }
@@ -1458,7 +1461,18 @@ function createAuthRoutes(config = {}) {
1458
1461
  }
1459
1462
  let registeredUser;
1460
1463
  try {
1461
- registeredUser = await sm.auth.register({ email, password, full_name, username, phone }, { clientContext });
1464
+ registeredUser = await sm.auth.register(
1465
+ {
1466
+ email,
1467
+ password,
1468
+ full_name,
1469
+ username,
1470
+ phone,
1471
+ // Lets an invited person through a first-visit trust challenge.
1472
+ ...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
1473
+ },
1474
+ { clientContext }
1475
+ );
1462
1476
  } catch (err) {
1463
1477
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1464
1478
  return errorResponse(
@@ -1624,13 +1638,13 @@ function createAuthRoutes(config = {}) {
1624
1638
  }
1625
1639
  // ==================== Verify Email ====================
1626
1640
  case "verify-email": {
1627
- const { token } = body;
1641
+ const { token, email } = body;
1628
1642
  if (!token) {
1629
1643
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1630
1644
  }
1631
1645
  let verifyData;
1632
1646
  try {
1633
- verifyData = await sm.auth.verifyEmail(token);
1647
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1634
1648
  } catch (err) {
1635
1649
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1636
1650
  return errorResponse(
@@ -1,6 +1,6 @@
1
- import { S as ServerConfig } from '../webhook-handler-CJm0sIZG.mjs';
2
- export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CJm0sIZG.mjs';
3
- import { q as ClientContext, A as ApiError } from '../index-CEi5Nd4L.mjs';
1
+ import { S as ServerConfig } from '../webhook-handler-CoASZNi5.mjs';
2
+ export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CoASZNi5.mjs';
3
+ import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.mjs';
4
4
  export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.mjs';
5
5
  import { NextRequest, NextResponse } from 'next/server';
6
6
  import '@scalemule/sdk';
@@ -1,6 +1,6 @@
1
- import { S as ServerConfig } from '../webhook-handler-CnQe9hm5.js';
2
- export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-CnQe9hm5.js';
3
- import { q as ClientContext, A as ApiError } from '../index-CEi5Nd4L.js';
1
+ import { S as ServerConfig } from '../webhook-handler-C7XK0Tjs.js';
2
+ export { a as ScaleMuleServer, V as VideoFailedEvent, b as VideoReadyEvent, c as VideoTranscodedEvent, d as VideoUploadedEvent, W as WebhookEvent, e as WebhookRoutesConfig, f as createServerClient, g as createWebhookHandler, h as createWebhookRoutes, p as parseWebhookEvent, r as registerVideoWebhook, i as resolveGatewayUrl, v as verifyWebhookSignature } from '../webhook-handler-C7XK0Tjs.js';
3
+ import { q as ClientContext, A as ApiError } from '../index-BOPHR50i.js';
4
4
  export { L as LedveryRoutesConfig, a as LedverySessionData, S as SM_LEDVERY_ACCESS_TOKEN_COOKIE, b as SM_LEDVERY_ID_TOKEN_COOKIE, c as SM_LEDVERY_NONCE_COOKIE, d as SM_LEDVERY_PKCE_VERIFIER_COOKIE, e as SM_LEDVERY_STATE_COOKIE, f as createLedveryRoutes, g as getLedverySession } from '../ledvery-CxPzZpxP.js';
5
5
  import { NextRequest, NextResponse } from 'next/server';
6
6
  import '@scalemule/sdk';
@@ -331,8 +331,11 @@ var ScaleMuleServer = class {
331
331
  /**
332
332
  * Verify email with token
333
333
  */
334
- verifyEmail: async (token) => {
335
- return this.request("POST", "/v1/auth/verify-email", { body: { token } });
334
+ verifyEmail: async (token, email, options) => {
335
+ return this.request("POST", "/v1/auth/verify-email", {
336
+ body: email ? { token, email } : { token },
337
+ clientContext: options?.clientContext
338
+ });
336
339
  },
337
340
  /**
338
341
  * Resend verification email.
@@ -1611,7 +1614,7 @@ function createAuthRoutes(config = {}) {
1611
1614
  switch (path) {
1612
1615
  // ==================== Register ====================
1613
1616
  case "register": {
1614
- const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
1617
+ const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
1615
1618
  if (!email || !password) {
1616
1619
  return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
1617
1620
  }
@@ -1631,7 +1634,18 @@ function createAuthRoutes(config = {}) {
1631
1634
  }
1632
1635
  let registeredUser;
1633
1636
  try {
1634
- registeredUser = await sm.auth.register({ email, password, full_name, username, phone }, { clientContext });
1637
+ registeredUser = await sm.auth.register(
1638
+ {
1639
+ email,
1640
+ password,
1641
+ full_name,
1642
+ username,
1643
+ phone,
1644
+ // Lets an invited person through a first-visit trust challenge.
1645
+ ...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
1646
+ },
1647
+ { clientContext }
1648
+ );
1635
1649
  } catch (err) {
1636
1650
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1637
1651
  return errorResponse(
@@ -1797,13 +1811,13 @@ function createAuthRoutes(config = {}) {
1797
1811
  }
1798
1812
  // ==================== Verify Email ====================
1799
1813
  case "verify-email": {
1800
- const { token } = body;
1814
+ const { token, email } = body;
1801
1815
  if (!token) {
1802
1816
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1803
1817
  }
1804
1818
  let verifyData;
1805
1819
  try {
1806
- verifyData = await sm.auth.verifyEmail(token);
1820
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1807
1821
  } catch (err) {
1808
1822
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1809
1823
  return errorResponse(
@@ -329,8 +329,11 @@ var ScaleMuleServer = class {
329
329
  /**
330
330
  * Verify email with token
331
331
  */
332
- verifyEmail: async (token) => {
333
- return this.request("POST", "/v1/auth/verify-email", { body: { token } });
332
+ verifyEmail: async (token, email, options) => {
333
+ return this.request("POST", "/v1/auth/verify-email", {
334
+ body: email ? { token, email } : { token },
335
+ clientContext: options?.clientContext
336
+ });
334
337
  },
335
338
  /**
336
339
  * Resend verification email.
@@ -1609,7 +1612,7 @@ function createAuthRoutes(config = {}) {
1609
1612
  switch (path) {
1610
1613
  // ==================== Register ====================
1611
1614
  case "register": {
1612
- const { email, password, full_name, username, phone, publication_code, website, company, hp_field } = body;
1615
+ const { email, password, full_name, username, phone, publication_code, website, company, hp_field, invitation_token } = body;
1613
1616
  if (!email || !password) {
1614
1617
  return errorResponse("VALIDATION_ERROR", "Email and password required", 400);
1615
1618
  }
@@ -1629,7 +1632,18 @@ function createAuthRoutes(config = {}) {
1629
1632
  }
1630
1633
  let registeredUser;
1631
1634
  try {
1632
- registeredUser = await sm.auth.register({ email, password, full_name, username, phone }, { clientContext });
1635
+ registeredUser = await sm.auth.register(
1636
+ {
1637
+ email,
1638
+ password,
1639
+ full_name,
1640
+ username,
1641
+ phone,
1642
+ // Lets an invited person through a first-visit trust challenge.
1643
+ ...typeof invitation_token === "string" && invitation_token ? { invitation_token } : {}
1644
+ },
1645
+ { clientContext }
1646
+ );
1633
1647
  } catch (err) {
1634
1648
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1635
1649
  return errorResponse(
@@ -1795,13 +1809,13 @@ function createAuthRoutes(config = {}) {
1795
1809
  }
1796
1810
  // ==================== Verify Email ====================
1797
1811
  case "verify-email": {
1798
- const { token } = body;
1812
+ const { token, email } = body;
1799
1813
  if (!token) {
1800
1814
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1801
1815
  }
1802
1816
  let verifyData;
1803
1817
  try {
1804
- verifyData = await sm.auth.verifyEmail(token);
1818
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1805
1819
  } catch (err) {
1806
1820
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1807
1821
  return errorResponse(
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-CJm0sIZG.mjs';
1
+ export { g as createWebhookHandler } from '../webhook-handler-CoASZNi5.mjs';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-CEi5Nd4L.mjs';
4
+ import '../index-BOPHR50i.mjs';
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-CnQe9hm5.js';
1
+ export { g as createWebhookHandler } from '../webhook-handler-C7XK0Tjs.js';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-CEi5Nd4L.js';
4
+ import '../index-BOPHR50i.js';
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { U as User, A as ApiError, ad as StorageFile } from './index-CEi5Nd4L.mjs';
3
+ import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.mjs';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
package/dist/testing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { U as User, A as ApiError, ad as StorageFile } from './index-CEi5Nd4L.js';
3
+ import { U as User, A as ApiError, ad as StorageFile } from './index-BOPHR50i.js';
4
4
 
5
5
  interface MockUserOptions {
6
6
  id?: string;
@@ -1,6 +1,6 @@
1
1
  import { ExperimentAssignment } from '@scalemule/sdk';
2
2
  import { MoneyClient } from '@scalemule/money';
3
- import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-CEi5Nd4L.mjs';
3
+ import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.js';
4
4
 
5
5
  /**
6
6
  * Server-Side ScaleMule Client
@@ -122,7 +122,9 @@ declare class ScaleMuleServer {
122
122
  /**
123
123
  * Verify email with token
124
124
  */
125
- verifyEmail: (token: string) => Promise<{
125
+ verifyEmail: (token: string, email?: string, options?: {
126
+ clientContext?: ClientContext;
127
+ }) => Promise<{
126
128
  message?: string;
127
129
  verified?: boolean;
128
130
  session_token?: string;
@@ -1,6 +1,6 @@
1
1
  import { ExperimentAssignment } from '@scalemule/sdk';
2
2
  import { MoneyClient } from '@scalemule/money';
3
- import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-CEi5Nd4L.js';
3
+ import { A as ApiError, a3 as RegisterRequest, q as ClientContext, U as User, L as LoginResponse, y as LoginRequest, c as ListFilesParams, w as ListFilesResponse, ad as StorageFile, aj as UploadResponse } from './index-BOPHR50i.mjs';
4
4
 
5
5
  /**
6
6
  * Server-Side ScaleMule Client
@@ -122,7 +122,9 @@ declare class ScaleMuleServer {
122
122
  /**
123
123
  * Verify email with token
124
124
  */
125
- verifyEmail: (token: string) => Promise<{
125
+ verifyEmail: (token: string, email?: string, options?: {
126
+ clientContext?: ClientContext;
127
+ }) => Promise<{
126
128
  message?: string;
127
129
  verified?: boolean;
128
130
  session_token?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.66",
3
+ "version": "0.1.67",
4
4
  "description": "ScaleMule SDK for Next.js applications - authentication, storage, and user management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",