@scalemule/nextjs 0.1.10 → 0.1.12

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.d.mts CHANGED
@@ -436,9 +436,17 @@ interface ScaleMuleMediaProps {
436
436
  alt?: string;
437
437
  /**
438
438
  * Polling interval while waiting for the media pipeline to complete.
439
- * Defaults to 2000ms; set to `null` to disable polling. Polling stops
440
- * automatically once scan is clean. When `conversationId` is set the
441
- * component receives push updates and you can usually pass `null`.
439
+ *
440
+ * Default behaviour:
441
+ * - With `conversationId` set: polling **off** (the realtime
442
+ * conversation channel pushes `file_status_changed` events;
443
+ * a poll loop on top would just be wasted requests).
444
+ * - Without `conversationId`: 2000ms.
445
+ *
446
+ * Override either way by passing a number (belt-and-suspenders if you
447
+ * don't trust your websocket) or `null` (disable explicitly).
448
+ * Polling stops automatically once both scan and any expected
449
+ * pipeline (optimize / transcode) have settled.
442
450
  */
443
451
  pollIntervalMs?: number | null;
444
452
  /**
package/dist/index.d.ts CHANGED
@@ -436,9 +436,17 @@ interface ScaleMuleMediaProps {
436
436
  alt?: string;
437
437
  /**
438
438
  * Polling interval while waiting for the media pipeline to complete.
439
- * Defaults to 2000ms; set to `null` to disable polling. Polling stops
440
- * automatically once scan is clean. When `conversationId` is set the
441
- * component receives push updates and you can usually pass `null`.
439
+ *
440
+ * Default behaviour:
441
+ * - With `conversationId` set: polling **off** (the realtime
442
+ * conversation channel pushes `file_status_changed` events;
443
+ * a poll loop on top would just be wasted requests).
444
+ * - Without `conversationId`: 2000ms.
445
+ *
446
+ * Override either way by passing a number (belt-and-suspenders if you
447
+ * don't trust your websocket) or `null` (disable explicitly).
448
+ * Polling stops automatically once both scan and any expected
449
+ * pipeline (optimize / transcode) have settled.
442
450
  */
443
451
  pollIntervalMs?: number | null;
444
452
  /**
package/dist/index.js CHANGED
@@ -2771,6 +2771,20 @@ var StorageService = class extends ServiceModule {
2771
2771
  async getFileStatus(fileId, options) {
2772
2772
  return this._get(`/files/${fileId}/status`, options);
2773
2773
  }
2774
+ /**
2775
+ * Read the application's active media policy. Lightweight endpoint
2776
+ * (`GET /v1/storage/policy`) used by the SDK on boot to pick up the
2777
+ * platform-default `media_policy` without requiring app-admin auth.
2778
+ *
2779
+ * @example
2780
+ * ```ts
2781
+ * const { data } = await client.storage.getPolicy();
2782
+ * console.log(data?.media_policy); // 'safe_visible'
2783
+ * ```
2784
+ */
2785
+ async getPolicy(options) {
2786
+ return this._get(`/policy`, options);
2787
+ }
2774
2788
  /**
2775
2789
  * Get a signed view URL for inline display (img src, thumbnails).
2776
2790
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
@@ -9243,17 +9257,18 @@ function ScaleMuleMedia(props) {
9243
9257
  className,
9244
9258
  style,
9245
9259
  alt,
9246
- pollIntervalMs = 2e3,
9260
+ pollIntervalMs,
9247
9261
  conversationId = null,
9248
9262
  conversationKind,
9249
9263
  renderPlaceholder,
9250
9264
  renderBlocked,
9251
9265
  renderOverride
9252
9266
  } = props;
9267
+ const effectivePollIntervalMs = pollIntervalMs !== void 0 ? pollIntervalMs : conversationId ? null : 2e3;
9253
9268
  const { gatewayUrl } = useScaleMule();
9254
9269
  const { status, isReady } = useFileStatus({
9255
9270
  fileId,
9256
- pollIntervalMs,
9271
+ pollIntervalMs: effectivePollIntervalMs,
9257
9272
  conversationId,
9258
9273
  conversationKind
9259
9274
  });
@@ -9332,9 +9347,6 @@ function ScaleMuleMedia(props) {
9332
9347
  if (hls) hls.destroy();
9333
9348
  };
9334
9349
  }, [isVideo, src]);
9335
- if (renderOverride) {
9336
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderOverride({ src, state: renderState }) });
9337
- }
9338
9350
  if (renderState === "blocked") {
9339
9351
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderBlocked ? renderBlocked() : /* @__PURE__ */ jsxRuntime.jsx(
9340
9352
  "div",
@@ -9346,6 +9358,9 @@ function ScaleMuleMedia(props) {
9346
9358
  }
9347
9359
  ) });
9348
9360
  }
9361
+ if (renderOverride) {
9362
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderOverride({ src, state: renderState }) });
9363
+ }
9349
9364
  if (renderState === "pending" && !src) {
9350
9365
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: renderPlaceholder ? renderPlaceholder() : /* @__PURE__ */ jsxRuntime.jsx(
9351
9366
  "div",
package/dist/index.mjs CHANGED
@@ -2751,6 +2751,20 @@ var StorageService = class extends ServiceModule {
2751
2751
  async getFileStatus(fileId, options) {
2752
2752
  return this._get(`/files/${fileId}/status`, options);
2753
2753
  }
2754
+ /**
2755
+ * Read the application's active media policy. Lightweight endpoint
2756
+ * (`GET /v1/storage/policy`) used by the SDK on boot to pick up the
2757
+ * platform-default `media_policy` without requiring app-admin auth.
2758
+ *
2759
+ * @example
2760
+ * ```ts
2761
+ * const { data } = await client.storage.getPolicy();
2762
+ * console.log(data?.media_policy); // 'safe_visible'
2763
+ * ```
2764
+ */
2765
+ async getPolicy(options) {
2766
+ return this._get(`/policy`, options);
2767
+ }
2754
2768
  /**
2755
2769
  * Get a signed view URL for inline display (img src, thumbnails).
2756
2770
  * Returns CloudFront signed URL (fast, ~1us) or S3 presigned fallback.
@@ -9223,17 +9237,18 @@ function ScaleMuleMedia(props) {
9223
9237
  className,
9224
9238
  style,
9225
9239
  alt,
9226
- pollIntervalMs = 2e3,
9240
+ pollIntervalMs,
9227
9241
  conversationId = null,
9228
9242
  conversationKind,
9229
9243
  renderPlaceholder,
9230
9244
  renderBlocked,
9231
9245
  renderOverride
9232
9246
  } = props;
9247
+ const effectivePollIntervalMs = pollIntervalMs !== void 0 ? pollIntervalMs : conversationId ? null : 2e3;
9233
9248
  const { gatewayUrl } = useScaleMule();
9234
9249
  const { status, isReady } = useFileStatus({
9235
9250
  fileId,
9236
- pollIntervalMs,
9251
+ pollIntervalMs: effectivePollIntervalMs,
9237
9252
  conversationId,
9238
9253
  conversationKind
9239
9254
  });
@@ -9312,9 +9327,6 @@ function ScaleMuleMedia(props) {
9312
9327
  if (hls) hls.destroy();
9313
9328
  };
9314
9329
  }, [isVideo, src]);
9315
- if (renderOverride) {
9316
- return /* @__PURE__ */ jsx(Fragment, { children: renderOverride({ src, state: renderState }) });
9317
- }
9318
9330
  if (renderState === "blocked") {
9319
9331
  return /* @__PURE__ */ jsx(Fragment, { children: renderBlocked ? renderBlocked() : /* @__PURE__ */ jsx(
9320
9332
  "div",
@@ -9326,6 +9338,9 @@ function ScaleMuleMedia(props) {
9326
9338
  }
9327
9339
  ) });
9328
9340
  }
9341
+ if (renderOverride) {
9342
+ return /* @__PURE__ */ jsx(Fragment, { children: renderOverride({ src, state: renderState }) });
9343
+ }
9329
9344
  if (renderState === "pending" && !src) {
9330
9345
  return /* @__PURE__ */ jsx(Fragment, { children: renderPlaceholder ? renderPlaceholder() : /* @__PURE__ */ jsx(
9331
9346
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalemule/nextjs",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@scalemule/money": "^0.0.1",
57
- "@scalemule/sdk": "^0.0.43"
57
+ "@scalemule/sdk": ">=0.0.45 <0.1.0"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "next": ">=14.0.0",