@scalemule/nextjs 0.1.13 → 0.1.15

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/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { createContext, useState, useMemo, useEffect, useCallback, useContext, useRef } from 'react';
2
+ import { createContext, useState, useEffect, useMemo, useCallback, useContext, useRef } from 'react';
3
3
  import { createMoneyClient } from '@scalemule/money';
4
4
  export { MoneyClient, createMoneyClient } from '@scalemule/money';
5
5
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
@@ -4866,16 +4866,16 @@ var WebPushManager = class {
4866
4866
  userVisibleOnly: true,
4867
4867
  applicationServerKey: applicationServerKey.buffer
4868
4868
  });
4869
- const endpoint = pushSubscription.endpoint;
4869
+ const endpoint2 = pushSubscription.endpoint;
4870
4870
  const p256dh = arrayBufferToBase64url(pushSubscription.getKey("p256dh"));
4871
4871
  const auth = arrayBufferToBase64url(pushSubscription.getKey("auth"));
4872
4872
  const subscription = {
4873
- endpoint,
4873
+ endpoint: endpoint2,
4874
4874
  keys: { p256dh, auth }
4875
4875
  };
4876
4876
  const resolvedDeviceId = deviceId || this.state?.deviceId || generateDeviceId();
4877
4877
  const result = await this.fetcher.registerToken({
4878
- token: endpoint,
4878
+ token: endpoint2,
4879
4879
  platform: "web",
4880
4880
  device_id: resolvedDeviceId,
4881
4881
  subscription,
@@ -4887,12 +4887,12 @@ var WebPushManager = class {
4887
4887
  registration_source: this.registrationSource
4888
4888
  });
4889
4889
  this.state = {
4890
- endpoint,
4890
+ endpoint: endpoint2,
4891
4891
  tokenId: result.id,
4892
4892
  deviceId: resolvedDeviceId
4893
4893
  };
4894
4894
  this.persistState();
4895
- return { tokenId: result.id, endpoint };
4895
+ return { tokenId: result.id, endpoint: endpoint2 };
4896
4896
  }
4897
4897
  /** Unsubscribe from browser push and deregister token */
4898
4898
  async unsubscribe() {
@@ -6727,11 +6727,12 @@ var ScaleMule = class {
6727
6727
 
6728
6728
  // src/types/index.ts
6729
6729
  var ScaleMuleApiError = class extends Error {
6730
- constructor(error) {
6730
+ constructor(error, status) {
6731
6731
  super(error.message);
6732
6732
  this.name = "ScaleMuleApiError";
6733
6733
  this.code = error.code;
6734
6734
  this.field = error.field;
6735
+ this.status = status;
6735
6736
  }
6736
6737
  };
6737
6738
 
@@ -7502,6 +7503,45 @@ var ScaleMuleClient2 = class {
7502
7503
  function createClient(config) {
7503
7504
  return new ScaleMuleClient2(config);
7504
7505
  }
7506
+
7507
+ // src/sdk-telemetry.ts
7508
+ var endpoint;
7509
+ function setSdkTelemetryEndpoint(url) {
7510
+ endpoint = url;
7511
+ }
7512
+ function reportSdkError(payload) {
7513
+ if (!endpoint) return;
7514
+ if (typeof fetch === "undefined") return;
7515
+ const body = JSON.stringify({
7516
+ logs: [
7517
+ {
7518
+ message: `${payload.code}: ${payload.message}`,
7519
+ metadata: {
7520
+ name: payload.code,
7521
+ source: "scalemule-sdk",
7522
+ kind: "sdk",
7523
+ op: payload.op,
7524
+ status: payload.status ?? null,
7525
+ path: payload.path ?? null,
7526
+ field: payload.field ?? null,
7527
+ route: typeof window !== "undefined" ? window.location.pathname : null
7528
+ },
7529
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
7530
+ }
7531
+ ]
7532
+ });
7533
+ try {
7534
+ void fetch(endpoint, {
7535
+ method: "POST",
7536
+ headers: { "Content-Type": "application/json" },
7537
+ body,
7538
+ keepalive: true,
7539
+ credentials: "same-origin"
7540
+ }).catch(() => {
7541
+ });
7542
+ } catch {
7543
+ }
7544
+ }
7505
7545
  var USER_CACHE_KEY = "scalemule_user";
7506
7546
  function getCachedUser() {
7507
7547
  if (typeof window === "undefined") return null;
@@ -7533,6 +7573,7 @@ function ScaleMuleProvider({
7533
7573
  storage,
7534
7574
  analyticsProxyUrl,
7535
7575
  authProxyUrl,
7576
+ telemetryEndpoint,
7536
7577
  publishableKey,
7537
7578
  enableAccountSwitcher,
7538
7579
  accountSwitcherPrivacy,
@@ -7546,6 +7587,10 @@ function ScaleMuleProvider({
7546
7587
  const [user, setUser] = useState(null);
7547
7588
  const [initializing, setInitializing] = useState(true);
7548
7589
  const [error, setError] = useState(null);
7590
+ useEffect(() => {
7591
+ setSdkTelemetryEndpoint(telemetryEndpoint);
7592
+ return () => setSdkTelemetryEndpoint(void 0);
7593
+ }, [telemetryEndpoint]);
7549
7594
  const resolvedGatewayUrl = gatewayUrl || (environment === "dev" ? "https://api-dev.scalemule.com" : "https://api.scalemule.com");
7550
7595
  const client = useMemo(
7551
7596
  () => createClient({
@@ -7639,8 +7684,12 @@ function ScaleMuleProvider({
7639
7684
  }
7640
7685
  }
7641
7686
  } catch {
7642
- if (mounted && debug) {
7643
- console.debug("[ScaleMule] Auth proxy session check failed");
7687
+ if (mounted) {
7688
+ setUser(null);
7689
+ setCachedUser(null);
7690
+ if (debug) {
7691
+ console.debug("[ScaleMule] Auth proxy session check failed; clearing cached user");
7692
+ }
7644
7693
  }
7645
7694
  } finally {
7646
7695
  client.resolveSessionPending();
@@ -7799,6 +7848,19 @@ async function proxyFetch(proxyUrl, path, options = {}) {
7799
7848
  // Include cookies for session management
7800
7849
  });
7801
7850
  const data = await response.json();
7851
+ if (data && data.error && !(data.error instanceof ScaleMuleApiError)) {
7852
+ data.error = new ScaleMuleApiError(data.error, response.status);
7853
+ }
7854
+ if (data && data.success === false && data.error) {
7855
+ reportSdkError({
7856
+ code: data.error.code,
7857
+ message: data.error.message,
7858
+ status: response.status,
7859
+ op: path,
7860
+ path: `${proxyUrl}/${path}`,
7861
+ field: data.error.field
7862
+ });
7863
+ }
7802
7864
  return data;
7803
7865
  }
7804
7866
  function useAuth() {
@@ -9016,6 +9078,193 @@ function useContent(options = {}) {
9016
9078
  ]
9017
9079
  );
9018
9080
  }
9081
+ var AUDIO_POLL_INTERVAL_MS = 1e3;
9082
+ var AUDIO_POLL_MAX_ATTEMPTS = 30;
9083
+ function isAudioFile(file) {
9084
+ return file.content_type.startsWith("audio/");
9085
+ }
9086
+ function toStorageBackedAudioFile(file) {
9087
+ return {
9088
+ audio_id: file.id,
9089
+ file_id: file.id,
9090
+ filename: file.filename,
9091
+ mime_type: file.content_type,
9092
+ size_bytes: file.size_bytes,
9093
+ status: "pending_transcode",
9094
+ codec: null,
9095
+ bit_rate_kbps: null,
9096
+ duration_ms: null,
9097
+ created_at: file.created_at,
9098
+ original_view_url: file.url ?? null,
9099
+ transcoded_url: null
9100
+ };
9101
+ }
9102
+ function isNotFoundError(error) {
9103
+ if (!error || typeof error !== "object") {
9104
+ return false;
9105
+ }
9106
+ const candidate = error;
9107
+ return candidate.status === 404 || candidate.statusCode === 404 || candidate.response?.status === 404 || candidate.code === "not_found" || candidate.message?.toLowerCase().includes("not found") === true;
9108
+ }
9109
+ function isAbortError(error) {
9110
+ return error instanceof DOMException && error.name === "AbortError" || !!error && typeof error === "object" && "name" in error && error.name === "AbortError";
9111
+ }
9112
+ async function waitForPollInterval(signal) {
9113
+ if (signal?.aborted) {
9114
+ return false;
9115
+ }
9116
+ return new Promise((resolve) => {
9117
+ const timeoutId = window.setTimeout(() => {
9118
+ cleanup();
9119
+ resolve(true);
9120
+ }, AUDIO_POLL_INTERVAL_MS);
9121
+ const onAbort = () => {
9122
+ cleanup();
9123
+ resolve(false);
9124
+ };
9125
+ const cleanup = () => {
9126
+ window.clearTimeout(timeoutId);
9127
+ signal?.removeEventListener("abort", onAbort);
9128
+ };
9129
+ signal?.addEventListener("abort", onAbort, { once: true });
9130
+ });
9131
+ }
9132
+ function useAudio() {
9133
+ const { client, audio } = useScaleMule();
9134
+ const [loading, setLoading] = useState(false);
9135
+ const [error, setError] = useState(null);
9136
+ const pollTranscodedUrl = useCallback(
9137
+ async (audioId, signal) => {
9138
+ for (let attempt = 0; attempt < AUDIO_POLL_MAX_ATTEMPTS; attempt++) {
9139
+ if (signal?.aborted) {
9140
+ return null;
9141
+ }
9142
+ try {
9143
+ const details = await client.get(`/v1/audios/${audioId}`);
9144
+ if (details.status === "ready" && details.url) {
9145
+ return details.url;
9146
+ }
9147
+ if (details.status === "failed") {
9148
+ return null;
9149
+ }
9150
+ } catch (err) {
9151
+ if (isAbortError(err) || signal?.aborted) {
9152
+ return null;
9153
+ }
9154
+ if (!isNotFoundError(err)) {
9155
+ throw err;
9156
+ }
9157
+ }
9158
+ if (!await waitForPollInterval(signal)) {
9159
+ return null;
9160
+ }
9161
+ }
9162
+ return null;
9163
+ },
9164
+ [client]
9165
+ );
9166
+ const upload = useCallback(
9167
+ async (file, opts) => {
9168
+ setLoading(true);
9169
+ setError(null);
9170
+ try {
9171
+ const result = await audio.uploadViaStorage(file, {
9172
+ filename: opts?.filename,
9173
+ metadata: opts?.metadata,
9174
+ onProgress: opts?.onProgress,
9175
+ signal: opts?.signal
9176
+ });
9177
+ if (result.error || !result.data) {
9178
+ throw result.error ?? { code: "upload_error", message: "Audio upload failed" };
9179
+ }
9180
+ return {
9181
+ file_id: result.data.file_id,
9182
+ audio_id: result.data.audio_id,
9183
+ original_view_url: result.data.original_view_url,
9184
+ transcoded_url_promise: result.data.audio_id ? pollTranscodedUrl(result.data.audio_id, opts?.signal) : Promise.resolve(null)
9185
+ };
9186
+ } catch (err) {
9187
+ const apiError = err;
9188
+ setError(apiError);
9189
+ throw err;
9190
+ } finally {
9191
+ setLoading(false);
9192
+ }
9193
+ },
9194
+ [audio, pollTranscodedUrl]
9195
+ );
9196
+ const list = useCallback(async () => {
9197
+ setLoading(true);
9198
+ setError(null);
9199
+ try {
9200
+ const response = await client.get("/v1/storage/my-files");
9201
+ const audioFiles = response.files.filter(isAudioFile);
9202
+ const enriched = await Promise.all(
9203
+ audioFiles.map(async (file) => {
9204
+ try {
9205
+ const details = await client.get(`/v1/audios/${file.id}`);
9206
+ return {
9207
+ audio_id: details.id,
9208
+ file_id: file.id,
9209
+ filename: file.filename,
9210
+ mime_type: file.content_type,
9211
+ size_bytes: details.size_bytes ?? file.size_bytes,
9212
+ status: details.status,
9213
+ codec: details.codec,
9214
+ bit_rate_kbps: details.bit_rate_kbps ?? null,
9215
+ duration_ms: details.duration_ms ?? null,
9216
+ created_at: details.created_at,
9217
+ original_view_url: file.url ?? null,
9218
+ transcoded_url: details.url ?? null,
9219
+ waveform_peaks: details.waveform_peaks
9220
+ };
9221
+ } catch {
9222
+ return toStorageBackedAudioFile(file);
9223
+ }
9224
+ })
9225
+ );
9226
+ return enriched;
9227
+ } catch (err) {
9228
+ const apiError = err;
9229
+ setError(apiError);
9230
+ throw err;
9231
+ } finally {
9232
+ setLoading(false);
9233
+ }
9234
+ }, [client]);
9235
+ const remove = useCallback(
9236
+ async (fileId) => {
9237
+ setLoading(true);
9238
+ setError(null);
9239
+ try {
9240
+ const [audioDeleteResult, storageDeleteResult] = await Promise.allSettled([
9241
+ client.delete(`/v1/audios/${fileId}`),
9242
+ client.delete(`/v1/storage/files/${fileId}`)
9243
+ ]);
9244
+ if (storageDeleteResult.status === "rejected" && !isNotFoundError(storageDeleteResult.reason)) {
9245
+ throw storageDeleteResult.reason ?? new Error("Storage delete failed");
9246
+ }
9247
+ if (audioDeleteResult.status === "rejected" && !isNotFoundError(audioDeleteResult.reason)) {
9248
+ console.warn("Audio record delete failed after storage delete", audioDeleteResult.reason);
9249
+ }
9250
+ } catch (err) {
9251
+ const apiError = err;
9252
+ setError(apiError);
9253
+ throw err;
9254
+ } finally {
9255
+ setLoading(false);
9256
+ }
9257
+ },
9258
+ [client]
9259
+ );
9260
+ return {
9261
+ upload,
9262
+ list,
9263
+ remove,
9264
+ error,
9265
+ loading
9266
+ };
9267
+ }
9019
9268
  function useMedia() {
9020
9269
  const { storage, photo, video, audio, mediaPolicy: providerDefaultPolicy } = useScaleMule();
9021
9270
  const [uploading, setUploading] = useState(false);
@@ -9934,8 +10183,8 @@ function useAnalytics(options = {}) {
9934
10183
  return { tracked: 1, session_id: sessionIdRef.current || void 0 };
9935
10184
  }
9936
10185
  if (publishableKey && gatewayUrl) {
9937
- const endpoint2 = useV2 ? "/v1/analytics/v2/events" : "/v1/analytics/events";
9938
- fetch(`${gatewayUrl}${endpoint2}`, {
10186
+ const endpoint3 = useV2 ? "/v1/analytics/v2/events" : "/v1/analytics/events";
10187
+ fetch(`${gatewayUrl}${endpoint3}`, {
9939
10188
  method: "POST",
9940
10189
  headers: {
9941
10190
  "Content-Type": "application/json",
@@ -9948,8 +10197,8 @@ function useAnalytics(options = {}) {
9948
10197
  });
9949
10198
  return { tracked: 1, session_id: sessionIdRef.current || void 0 };
9950
10199
  }
9951
- const endpoint = useV2 ? "/v1/analytics/v2/events" : "/v1/analytics/events";
9952
- return await client.post(endpoint, fullEvent);
10200
+ const endpoint2 = useV2 ? "/v1/analytics/v2/events" : "/v1/analytics/events";
10201
+ return await client.post(endpoint2, fullEvent);
9953
10202
  },
9954
10203
  // Note: sessionId removed - we use ref to keep this stable
9955
10204
  [client, buildFullEvent, useV2, analyticsProxyUrl, publishableKey, gatewayUrl]
@@ -10025,8 +10274,8 @@ function useAnalytics(options = {}) {
10025
10274
  return { tracked: events.length, session_id: sessionIdRef.current || void 0 };
10026
10275
  }
10027
10276
  if (publishableKey && gatewayUrl) {
10028
- const endpoint2 = useV2 ? "/v1/analytics/v2/events/batch" : "/v1/analytics/events/batch";
10029
- fetch(`${gatewayUrl}${endpoint2}`, {
10277
+ const endpoint3 = useV2 ? "/v1/analytics/v2/events/batch" : "/v1/analytics/events/batch";
10278
+ fetch(`${gatewayUrl}${endpoint3}`, {
10030
10279
  method: "POST",
10031
10280
  headers: {
10032
10281
  "Content-Type": "application/json",
@@ -10040,8 +10289,8 @@ function useAnalytics(options = {}) {
10040
10289
  setLoading(false);
10041
10290
  return { tracked: events.length, session_id: sessionIdRef.current || void 0 };
10042
10291
  }
10043
- const endpoint = useV2 ? "/v1/analytics/v2/events/batch" : "/v1/analytics/events/batch";
10044
- return await client.post(endpoint, {
10292
+ const endpoint2 = useV2 ? "/v1/analytics/v2/events/batch" : "/v1/analytics/events/batch";
10293
+ return await client.post(endpoint2, {
10045
10294
  events: fullEvents
10046
10295
  });
10047
10296
  } finally {
@@ -10177,10 +10426,10 @@ function useFeatureFlags(options = {}) {
10177
10426
  try {
10178
10427
  const currentKeys = keysRef.current;
10179
10428
  const payload = currentKeys && currentKeys.length > 0 ? { flag_keys: currentKeys, environment, context: contextRef.current } : { environment, context: contextRef.current };
10180
- const endpoint = currentKeys && currentKeys.length > 0 ? "/v1/flags/evaluate/batch" : "/v1/flags/evaluate/all";
10429
+ const endpoint2 = currentKeys && currentKeys.length > 0 ? "/v1/flags/evaluate/batch" : "/v1/flags/evaluate/all";
10181
10430
  let result;
10182
10431
  if (publishableKey && gatewayUrl) {
10183
- const response = await fetch(`${gatewayUrl}${endpoint}`, {
10432
+ const response = await fetch(`${gatewayUrl}${endpoint2}`, {
10184
10433
  method: "POST",
10185
10434
  headers: {
10186
10435
  "Content-Type": "application/json",
@@ -10194,7 +10443,7 @@ function useFeatureFlags(options = {}) {
10194
10443
  const json = await response.json();
10195
10444
  result = json.data || json || {};
10196
10445
  } else {
10197
- result = await client.post(endpoint, payload);
10446
+ result = await client.post(endpoint2, payload);
10198
10447
  }
10199
10448
  setFlags(result || {});
10200
10449
  setError(null);
@@ -11221,4 +11470,4 @@ function createSafeLogger(prefix) {
11221
11470
  };
11222
11471
  }
11223
11472
 
11224
- export { FeedbackWidget, ScaleMuleApiError, ScaleMuleClient2 as ScaleMuleClient, ScaleMuleMedia, ScaleMuleProvider, composePhone, createClient, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
11473
+ export { FeedbackWidget, ScaleMuleApiError, ScaleMuleClient2 as ScaleMuleClient, ScaleMuleMedia, ScaleMuleProvider, composePhone, createClient, createSafeLogger, normalizePhone, phoneCountries, sanitizeForLog, useAnalytics, useAudio, useAuth, useBilling, useContent, useFeatureFlags, useFeedback, useFileStatus, useMedia, useMoney, useMoneyClient, usePushNotifications, useRealtime, useScaleMule, useScaleMuleClient, useShare, useUser, validateForm, validators };
@@ -0,0 +1,43 @@
1
+ declare const SM_LEDVERY_STATE_COOKIE = "sm_ledvery_state";
2
+ declare const SM_LEDVERY_PKCE_VERIFIER_COOKIE = "sm_ledvery_pkce_verifier";
3
+ declare const SM_LEDVERY_NONCE_COOKIE = "sm_ledvery_nonce";
4
+ declare const SM_LEDVERY_ID_TOKEN_COOKIE = "sm_ledvery_id_token";
5
+ declare const SM_LEDVERY_ACCESS_TOKEN_COOKIE = "sm_ledvery_access_token";
6
+ interface SessionCookieOverrides {
7
+ maxAge?: number;
8
+ domain?: string;
9
+ path?: string;
10
+ sameSite?: 'strict' | 'lax' | 'none';
11
+ secure?: boolean;
12
+ }
13
+ interface LedverySessionData {
14
+ idToken: string;
15
+ accessToken?: string;
16
+ claims: Record<string, unknown>;
17
+ expiresAt: string;
18
+ }
19
+ declare function getLedverySession(request: Request): LedverySessionData | null;
20
+
21
+ interface LedveryRoutesConfig {
22
+ issuer: string;
23
+ clientId: string;
24
+ clientSecret?: string;
25
+ redirectUri: string;
26
+ defaultScope?: string;
27
+ postLoginRedirect?: string;
28
+ postLogoutRedirect?: string;
29
+ cookies?: SessionCookieOverrides;
30
+ storeAccessToken?: boolean;
31
+ fetch?: typeof fetch;
32
+ }
33
+ type RouteHandler = (request: Request, context: {
34
+ params: Promise<{
35
+ action?: string[];
36
+ }>;
37
+ }) => Promise<Response>;
38
+ declare function createLedveryRoutes(config: LedveryRoutesConfig): {
39
+ GET: RouteHandler;
40
+ POST: RouteHandler;
41
+ };
42
+
43
+ export { type LedveryRoutesConfig as L, SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, type LedverySessionData as a, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
@@ -0,0 +1,43 @@
1
+ declare const SM_LEDVERY_STATE_COOKIE = "sm_ledvery_state";
2
+ declare const SM_LEDVERY_PKCE_VERIFIER_COOKIE = "sm_ledvery_pkce_verifier";
3
+ declare const SM_LEDVERY_NONCE_COOKIE = "sm_ledvery_nonce";
4
+ declare const SM_LEDVERY_ID_TOKEN_COOKIE = "sm_ledvery_id_token";
5
+ declare const SM_LEDVERY_ACCESS_TOKEN_COOKIE = "sm_ledvery_access_token";
6
+ interface SessionCookieOverrides {
7
+ maxAge?: number;
8
+ domain?: string;
9
+ path?: string;
10
+ sameSite?: 'strict' | 'lax' | 'none';
11
+ secure?: boolean;
12
+ }
13
+ interface LedverySessionData {
14
+ idToken: string;
15
+ accessToken?: string;
16
+ claims: Record<string, unknown>;
17
+ expiresAt: string;
18
+ }
19
+ declare function getLedverySession(request: Request): LedverySessionData | null;
20
+
21
+ interface LedveryRoutesConfig {
22
+ issuer: string;
23
+ clientId: string;
24
+ clientSecret?: string;
25
+ redirectUri: string;
26
+ defaultScope?: string;
27
+ postLoginRedirect?: string;
28
+ postLogoutRedirect?: string;
29
+ cookies?: SessionCookieOverrides;
30
+ storeAccessToken?: boolean;
31
+ fetch?: typeof fetch;
32
+ }
33
+ type RouteHandler = (request: Request, context: {
34
+ params: Promise<{
35
+ action?: string[];
36
+ }>;
37
+ }) => Promise<Response>;
38
+ declare function createLedveryRoutes(config: LedveryRoutesConfig): {
39
+ GET: RouteHandler;
40
+ POST: RouteHandler;
41
+ };
42
+
43
+ export { type LedveryRoutesConfig as L, SM_LEDVERY_ACCESS_TOKEN_COOKIE as S, type LedverySessionData as a, SM_LEDVERY_ID_TOKEN_COOKIE as b, SM_LEDVERY_NONCE_COOKIE as c, SM_LEDVERY_PKCE_VERIFIER_COOKIE as d, SM_LEDVERY_STATE_COOKIE as e, createLedveryRoutes as f, getLedverySession as g };
@@ -6,11 +6,12 @@ require('next/server');
6
6
 
7
7
  // src/types/index.ts
8
8
  var ScaleMuleApiError = class extends Error {
9
- constructor(error) {
9
+ constructor(error, status) {
10
10
  super(error.message);
11
11
  this.name = "ScaleMuleApiError";
12
12
  this.code = error.code;
13
13
  this.field = error.field;
14
+ this.status = status;
14
15
  }
15
16
  };
16
17
 
@@ -4,11 +4,12 @@ import 'next/server';
4
4
 
5
5
  // src/types/index.ts
6
6
  var ScaleMuleApiError = class extends Error {
7
- constructor(error) {
7
+ constructor(error, status) {
8
8
  super(error.message);
9
9
  this.name = "ScaleMuleApiError";
10
10
  this.code = error.code;
11
11
  this.field = error.field;
12
+ this.status = status;
12
13
  }
13
14
  };
14
15
 
@@ -1,6 +1,7 @@
1
- import { S as ServerConfig } from '../webhook-handler-BqzCYRNJ.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-BqzCYRNJ.mjs';
3
- import { p as ClientContext, A as ApiError } from '../index-BIIUrnPr.mjs';
1
+ import { S as ServerConfig } from '../webhook-handler-CUp_A0_p.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-CUp_A0_p.mjs';
3
+ import { p as ClientContext, A as ApiError } from '../index-DTWyUcyd.mjs';
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-C9vvhlUn.mjs';
4
5
  import { NextRequest, NextResponse } from 'next/server';
5
6
  import '@scalemule/money';
6
7
 
@@ -1,6 +1,7 @@
1
- import { S as ServerConfig } from '../webhook-handler-BjFbqZuq.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-BjFbqZuq.js';
3
- import { p as ClientContext, A as ApiError } from '../index-BIIUrnPr.js';
1
+ import { S as ServerConfig } from '../webhook-handler-C07AK4QB.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-C07AK4QB.js';
3
+ import { p as ClientContext, A as ApiError } from '../index-DTWyUcyd.js';
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-C9vvhlUn.js';
4
5
  import { NextRequest, NextResponse } from 'next/server';
5
6
  import '@scalemule/money';
6
7