@scalemule/nextjs 0.1.65 → 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/audio.d.mts CHANGED
@@ -99,6 +99,8 @@ declare class NarrationHighlighter {
99
99
  private currentWord;
100
100
  private currentSentence;
101
101
  private follow;
102
+ private userScrolledAt;
103
+ private lastScrollAt;
102
104
  private detachUserScroll;
103
105
  private reducedMotion;
104
106
  private root;
@@ -114,7 +116,7 @@ declare class NarrationHighlighter {
114
116
  * to hide the toggle below ~0.5. */
115
117
  matchRatio(): number;
116
118
  private attachUserScroll;
117
- /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
119
+ /** Re-engage auto-scroll immediately (the reader pressed the toggle or sought). */
118
120
  resumeFollowing(): void;
119
121
  /** Lazily creates the overlay layer behind the article text. */
120
122
  private ensureLayer;
package/dist/audio.d.ts CHANGED
@@ -99,6 +99,8 @@ declare class NarrationHighlighter {
99
99
  private currentWord;
100
100
  private currentSentence;
101
101
  private follow;
102
+ private userScrolledAt;
103
+ private lastScrollAt;
102
104
  private detachUserScroll;
103
105
  private reducedMotion;
104
106
  private root;
@@ -114,7 +116,7 @@ declare class NarrationHighlighter {
114
116
  * to hide the toggle below ~0.5. */
115
117
  matchRatio(): number;
116
118
  private attachUserScroll;
117
- /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
119
+ /** Re-engage auto-scroll immediately (the reader pressed the toggle or sought). */
118
120
  resumeFollowing(): void;
119
121
  /** Lazily creates the overlay layer behind the article text. */
120
122
  private ensureLayer;
package/dist/audio.js CHANGED
@@ -74,22 +74,43 @@ function collectDomWords(root) {
74
74
  }
75
75
  function alignWords(timingNorms, domNorms, window2 = 6) {
76
76
  const out = new Array(timingNorms.length).fill(-1);
77
+ const resyncWindow = Math.max(window2 * 4, 24);
77
78
  let j = 0;
79
+ let inSync = true;
78
80
  for (let i = 0; i < timingNorms.length; i++) {
79
81
  const target = timingNorms[i];
80
82
  if (!target) continue;
83
+ const nextTarget = i + 1 < timingNorms.length ? timingNorms[i + 1] : "";
81
84
  let found = -1;
82
- for (let k = j; k < Math.min(domNorms.length, j + window2); k++) {
83
- if (domNorms[k] === target) {
84
- found = k;
85
- break;
85
+ if (inSync && j < domNorms.length && domNorms[j] === target) {
86
+ found = j;
87
+ } else {
88
+ if (nextTarget) {
89
+ const limit = Math.min(domNorms.length - 1, j + resyncWindow);
90
+ for (let k = j; k < limit; k++) {
91
+ if (domNorms[k] === target && domNorms[k + 1] === nextTarget) {
92
+ found = k;
93
+ break;
94
+ }
95
+ }
96
+ }
97
+ if (found === -1 && (inSync || !nextTarget)) {
98
+ const limit = Math.min(domNorms.length, j + window2);
99
+ for (let k = j; k < limit; k++) {
100
+ if (domNorms[k] === target) {
101
+ found = k;
102
+ break;
103
+ }
104
+ }
86
105
  }
87
106
  }
88
107
  if (found === -1) {
108
+ inSync = false;
89
109
  continue;
90
110
  }
91
111
  out[i] = found;
92
112
  j = found + 1;
113
+ inSync = true;
93
114
  }
94
115
  return out;
95
116
  }
@@ -135,11 +156,15 @@ function narrationHighlightSupported() {
135
156
  }
136
157
  var PAD_X = 2;
137
158
  var PAD_Y = 1;
159
+ var AUTO_SCROLL_THROTTLE_MS = 180;
160
+ var USER_SCROLL_COOLDOWN_MS = 1200;
138
161
  var NarrationHighlighter = class {
139
162
  constructor(root, timings) {
140
163
  this.currentWord = -2;
141
164
  this.currentSentence = -2;
142
165
  this.follow = true;
166
+ this.userScrolledAt = 0;
167
+ this.lastScrollAt = 0;
143
168
  this.detachUserScroll = null;
144
169
  this.layer = null;
145
170
  this.sentenceLayer = null;
@@ -185,20 +210,23 @@ var NarrationHighlighter = class {
185
210
  return this.ranges.filter(Boolean).length / this.ranges.length;
186
211
  }
187
212
  attachUserScroll(doc) {
188
- const stopFollowing = () => {
189
- this.follow = false;
213
+ const onUserScroll = () => {
214
+ this.userScrolledAt = Date.now();
190
215
  };
191
216
  const opts = { passive: true };
192
- doc.addEventListener("wheel", stopFollowing, opts);
193
- doc.addEventListener("touchmove", stopFollowing, opts);
217
+ doc.addEventListener("wheel", onUserScroll, opts);
218
+ doc.addEventListener("touchmove", onUserScroll, opts);
194
219
  this.detachUserScroll = () => {
195
- doc.removeEventListener("wheel", stopFollowing, opts);
196
- doc.removeEventListener("touchmove", stopFollowing, opts);
220
+ doc.removeEventListener("wheel", onUserScroll, opts);
221
+ doc.removeEventListener("touchmove", onUserScroll, opts);
197
222
  };
198
223
  }
199
- /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
224
+ /** Re-engage auto-scroll immediately (the reader pressed the toggle or sought). */
200
225
  resumeFollowing() {
201
226
  this.follow = true;
227
+ this.userScrolledAt = 0;
228
+ this.lastScrollAt = 0;
229
+ this.currentWord = -2;
202
230
  this.currentSentence = -2;
203
231
  }
204
232
  /** Lazily creates the overlay layer behind the article text. */
@@ -298,21 +326,26 @@ var NarrationHighlighter = class {
298
326
  if (!this.ensureLayer()) return;
299
327
  this.paint(this.wordLayer, this.ranges[idx] ? this.boxesFor([idx]) : [], "word");
300
328
  const sentence = this.words[idx][3];
329
+ const members = this.sentenceWords.get(sentence) ?? [];
301
330
  if (sentence !== this.currentSentence) {
302
331
  this.currentSentence = sentence;
303
- const members = this.sentenceWords.get(sentence) ?? [];
304
332
  this.paint(this.sentenceLayer, this.boxesFor(members), "sentence");
305
- const first = members.length ? this.ranges[members[0]] : null;
306
- if (first) this.scrollTo(first);
307
333
  }
334
+ const activeRange = this.ranges[idx] ?? (members.length ? this.ranges[members[0]] : null);
335
+ if (activeRange) this.scrollTo(activeRange);
308
336
  }
309
337
  scrollTo(range) {
310
338
  if (!this.follow) return;
339
+ const now = Date.now();
340
+ if (now - this.userScrolledAt < USER_SCROLL_COOLDOWN_MS) return;
341
+ if (now - this.lastScrollAt < AUTO_SCROLL_THROTTLE_MS) return;
311
342
  try {
312
343
  const rect = range.getBoundingClientRect();
313
344
  const viewport = window.innerHeight || 0;
314
- if (rect.top < viewport * 0.15 || rect.bottom > viewport * 0.7) {
315
- const target = window.scrollY + rect.top - viewport * 0.3;
345
+ if (viewport <= 0) return;
346
+ if (rect.top < viewport * 0.2 || rect.bottom > viewport * 0.75) {
347
+ this.lastScrollAt = now;
348
+ const target = Math.max(0, window.scrollY + rect.top - viewport * 0.35);
316
349
  window.scrollTo({ top: target, behavior: this.reducedMotion ? "auto" : "smooth" });
317
350
  }
318
351
  } catch {
package/dist/audio.mjs CHANGED
@@ -44,22 +44,43 @@ function collectDomWords(root) {
44
44
  }
45
45
  function alignWords(timingNorms, domNorms, window2 = 6) {
46
46
  const out = new Array(timingNorms.length).fill(-1);
47
+ const resyncWindow = Math.max(window2 * 4, 24);
47
48
  let j = 0;
49
+ let inSync = true;
48
50
  for (let i = 0; i < timingNorms.length; i++) {
49
51
  const target = timingNorms[i];
50
52
  if (!target) continue;
53
+ const nextTarget = i + 1 < timingNorms.length ? timingNorms[i + 1] : "";
51
54
  let found = -1;
52
- for (let k = j; k < Math.min(domNorms.length, j + window2); k++) {
53
- if (domNorms[k] === target) {
54
- found = k;
55
- break;
55
+ if (inSync && j < domNorms.length && domNorms[j] === target) {
56
+ found = j;
57
+ } else {
58
+ if (nextTarget) {
59
+ const limit = Math.min(domNorms.length - 1, j + resyncWindow);
60
+ for (let k = j; k < limit; k++) {
61
+ if (domNorms[k] === target && domNorms[k + 1] === nextTarget) {
62
+ found = k;
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ if (found === -1 && (inSync || !nextTarget)) {
68
+ const limit = Math.min(domNorms.length, j + window2);
69
+ for (let k = j; k < limit; k++) {
70
+ if (domNorms[k] === target) {
71
+ found = k;
72
+ break;
73
+ }
74
+ }
56
75
  }
57
76
  }
58
77
  if (found === -1) {
78
+ inSync = false;
59
79
  continue;
60
80
  }
61
81
  out[i] = found;
62
82
  j = found + 1;
83
+ inSync = true;
63
84
  }
64
85
  return out;
65
86
  }
@@ -105,11 +126,15 @@ function narrationHighlightSupported() {
105
126
  }
106
127
  var PAD_X = 2;
107
128
  var PAD_Y = 1;
129
+ var AUTO_SCROLL_THROTTLE_MS = 180;
130
+ var USER_SCROLL_COOLDOWN_MS = 1200;
108
131
  var NarrationHighlighter = class {
109
132
  constructor(root, timings) {
110
133
  this.currentWord = -2;
111
134
  this.currentSentence = -2;
112
135
  this.follow = true;
136
+ this.userScrolledAt = 0;
137
+ this.lastScrollAt = 0;
113
138
  this.detachUserScroll = null;
114
139
  this.layer = null;
115
140
  this.sentenceLayer = null;
@@ -155,20 +180,23 @@ var NarrationHighlighter = class {
155
180
  return this.ranges.filter(Boolean).length / this.ranges.length;
156
181
  }
157
182
  attachUserScroll(doc) {
158
- const stopFollowing = () => {
159
- this.follow = false;
183
+ const onUserScroll = () => {
184
+ this.userScrolledAt = Date.now();
160
185
  };
161
186
  const opts = { passive: true };
162
- doc.addEventListener("wheel", stopFollowing, opts);
163
- doc.addEventListener("touchmove", stopFollowing, opts);
187
+ doc.addEventListener("wheel", onUserScroll, opts);
188
+ doc.addEventListener("touchmove", onUserScroll, opts);
164
189
  this.detachUserScroll = () => {
165
- doc.removeEventListener("wheel", stopFollowing, opts);
166
- doc.removeEventListener("touchmove", stopFollowing, opts);
190
+ doc.removeEventListener("wheel", onUserScroll, opts);
191
+ doc.removeEventListener("touchmove", onUserScroll, opts);
167
192
  };
168
193
  }
169
- /** Re-engage auto-scroll (the reader pressed the toggle or sought). */
194
+ /** Re-engage auto-scroll immediately (the reader pressed the toggle or sought). */
170
195
  resumeFollowing() {
171
196
  this.follow = true;
197
+ this.userScrolledAt = 0;
198
+ this.lastScrollAt = 0;
199
+ this.currentWord = -2;
172
200
  this.currentSentence = -2;
173
201
  }
174
202
  /** Lazily creates the overlay layer behind the article text. */
@@ -268,21 +296,26 @@ var NarrationHighlighter = class {
268
296
  if (!this.ensureLayer()) return;
269
297
  this.paint(this.wordLayer, this.ranges[idx] ? this.boxesFor([idx]) : [], "word");
270
298
  const sentence = this.words[idx][3];
299
+ const members = this.sentenceWords.get(sentence) ?? [];
271
300
  if (sentence !== this.currentSentence) {
272
301
  this.currentSentence = sentence;
273
- const members = this.sentenceWords.get(sentence) ?? [];
274
302
  this.paint(this.sentenceLayer, this.boxesFor(members), "sentence");
275
- const first = members.length ? this.ranges[members[0]] : null;
276
- if (first) this.scrollTo(first);
277
303
  }
304
+ const activeRange = this.ranges[idx] ?? (members.length ? this.ranges[members[0]] : null);
305
+ if (activeRange) this.scrollTo(activeRange);
278
306
  }
279
307
  scrollTo(range) {
280
308
  if (!this.follow) return;
309
+ const now = Date.now();
310
+ if (now - this.userScrolledAt < USER_SCROLL_COOLDOWN_MS) return;
311
+ if (now - this.lastScrollAt < AUTO_SCROLL_THROTTLE_MS) return;
281
312
  try {
282
313
  const rect = range.getBoundingClientRect();
283
314
  const viewport = window.innerHeight || 0;
284
- if (rect.top < viewport * 0.15 || rect.bottom > viewport * 0.7) {
285
- const target = window.scrollY + rect.top - viewport * 0.3;
315
+ if (viewport <= 0) return;
316
+ if (rect.top < viewport * 0.2 || rect.bottom > viewport * 0.75) {
317
+ this.lastScrollAt = now;
318
+ const target = Math.max(0, window.scrollY + rect.top - viewport * 0.35);
286
319
  window.scrollTo({ top: target, behavior: this.reducedMotion ? "auto" : "smooth" });
287
320
  }
288
321
  } catch {
package/dist/client.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { ac as StorageAdapter, A as ApiError } from './index-Sm43YPgb.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-Sm43YPgb.js';
1
+ import { ac as StorageAdapter, A as ApiError } from './index-BOPHR50i.js';
2
2
 
3
3
  /**
4
4
  * ScaleMule API Client
@@ -514,7 +514,7 @@ interface UseAuthReturn {
514
514
  /** Reset password with token */
515
515
  resetPassword: (token: string, newPassword: string) => Promise<void>;
516
516
  /** Verify email with token */
517
- verifyEmail: (token: string) => Promise<void>;
517
+ verifyEmail: (token: string, email?: string) => Promise<void>;
518
518
  /** Resend verification email (optional email for unauthenticated resend) */
519
519
  resendVerification: (email?: string) => Promise<void>;
520
520
  /** Refresh session token */
@@ -514,7 +514,7 @@ interface UseAuthReturn {
514
514
  /** Reset password with token */
515
515
  resetPassword: (token: string, newPassword: string) => Promise<void>;
516
516
  /** Verify email with token */
517
- verifyEmail: (token: string) => Promise<void>;
517
+ verifyEmail: (token: string, email?: string) => Promise<void>;
518
518
  /** Resend verification email (optional email for unauthenticated resend) */
519
519
  resendVerification: (email?: string) => Promise<void>;
520
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-Sm43YPgb.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-Sm43YPgb.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-Sm43YPgb.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-Sm43YPgb.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.
@@ -1637,13 +1640,13 @@ function createAuthRoutes(config = {}) {
1637
1640
  }
1638
1641
  // ==================== Verify Email ====================
1639
1642
  case "verify-email": {
1640
- const { token } = body;
1643
+ const { token, email } = body;
1641
1644
  if (!token) {
1642
1645
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1643
1646
  }
1644
1647
  let verifyData;
1645
1648
  try {
1646
- verifyData = await sm.auth.verifyEmail(token);
1649
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1647
1650
  } catch (err) {
1648
1651
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1649
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.
@@ -1635,13 +1638,13 @@ function createAuthRoutes(config = {}) {
1635
1638
  }
1636
1639
  // ==================== Verify Email ====================
1637
1640
  case "verify-email": {
1638
- const { token } = body;
1641
+ const { token, email } = body;
1639
1642
  if (!token) {
1640
1643
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1641
1644
  }
1642
1645
  let verifyData;
1643
1646
  try {
1644
- verifyData = await sm.auth.verifyEmail(token);
1647
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1645
1648
  } catch (err) {
1646
1649
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1647
1650
  return errorResponse(
@@ -1,6 +1,6 @@
1
- import { S as ServerConfig } from '../webhook-handler-363gMdVs.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-363gMdVs.mjs';
3
- import { q as ClientContext, A as ApiError } from '../index-Sm43YPgb.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-Cglm2AVC.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-Cglm2AVC.js';
3
- import { q as ClientContext, A as ApiError } from '../index-Sm43YPgb.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.
@@ -1808,13 +1811,13 @@ function createAuthRoutes(config = {}) {
1808
1811
  }
1809
1812
  // ==================== Verify Email ====================
1810
1813
  case "verify-email": {
1811
- const { token } = body;
1814
+ const { token, email } = body;
1812
1815
  if (!token) {
1813
1816
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1814
1817
  }
1815
1818
  let verifyData;
1816
1819
  try {
1817
- verifyData = await sm.auth.verifyEmail(token);
1820
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1818
1821
  } catch (err) {
1819
1822
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1820
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.
@@ -1806,13 +1809,13 @@ function createAuthRoutes(config = {}) {
1806
1809
  }
1807
1810
  // ==================== Verify Email ====================
1808
1811
  case "verify-email": {
1809
- const { token } = body;
1812
+ const { token, email } = body;
1810
1813
  if (!token) {
1811
1814
  return errorResponse("VALIDATION_ERROR", "Token required", 400);
1812
1815
  }
1813
1816
  let verifyData;
1814
1817
  try {
1815
- verifyData = await sm.auth.verifyEmail(token);
1818
+ verifyData = await sm.auth.verifyEmail(token, typeof email === "string" && email ? email : void 0, { clientContext });
1816
1819
  } catch (err) {
1817
1820
  const apiErr = err instanceof ScaleMuleApiError ? err : null;
1818
1821
  return errorResponse(
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-363gMdVs.mjs';
1
+ export { g as createWebhookHandler } from '../webhook-handler-CoASZNi5.mjs';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-Sm43YPgb.mjs';
4
+ import '../index-BOPHR50i.mjs';
@@ -1,4 +1,4 @@
1
- export { g as createWebhookHandler } from '../webhook-handler-Cglm2AVC.js';
1
+ export { g as createWebhookHandler } from '../webhook-handler-C7XK0Tjs.js';
2
2
  import '@scalemule/sdk';
3
3
  import '@scalemule/money';
4
- import '../index-Sm43YPgb.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-Sm43YPgb.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-Sm43YPgb.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-Sm43YPgb.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-Sm43YPgb.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.65",
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",