@xhub-short/adapters 0.1.0-beta.14 → 0.1.0-beta.16

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.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IDataSource, VideoItem, FeedResponse, IPlaylistDataSource, PlaylistData, PlaylistCollectionResponse, ILogger, LogLevel, LogEntry, IStorage, ISessionStorage, SessionSnapshot, IInteraction, Comment, ICommentAdapter, MockCommentAdapterConfig, CommentListResponse, ReplyListResponse, PostCommentPayload, CommentItem, PostReplyPayload, ReplyItem, EditCommentPayload, DeleteCommentPayload, ReportCommentPayload, IAnalytics, AnalyticsEvent, INetworkAdapter, NetworkType, NetworkQuality, IVideoLoader, VideoSource, PreloadConfig, PreloadResult, PreloadStatus, IPosterLoader, ReportReason, CommentTransformers } from '@xhub-short/contracts';
1
+ import { IDataSource, VideoItem, FeedResponse, IPlaylistDataSource, PlaylistData, PlaylistCollectionResponse, ILogger, LogLevel, LogEntry, IStorage, ISessionStorage, SessionSnapshot, IInteraction, Comment, ICommentAdapter, MockCommentAdapterConfig, CommentListResponse, ReplyListResponse, PostCommentPayload, CommentItem, PostReplyPayload, ReplyItem, EditCommentPayload, DeleteCommentPayload, ReportCommentPayload, IAnalytics, AnalyticsEvent, INetworkAdapter, NetworkType, NetworkQuality, IPosterLoader, IVideoLoader, VideoSource, PreloadConfig, PreloadResult, PreloadStatus, ReportReason, CommentTransformers } from '@xhub-short/contracts';
2
2
 
3
3
  /**
4
4
  * MockDataAdapter - Development/Testing Data Source
@@ -1789,6 +1789,13 @@ declare class LocalStorageAdapter implements IStorage {
1789
1789
  * Clear all SDK-namespaced keys
1790
1790
  */
1791
1791
  clear(): Promise<void>;
1792
+ /**
1793
+ * Get a value from localStorage synchronously
1794
+ *
1795
+ * Used for zero-flash cache hydration during React render phase.
1796
+ * localStorage is inherently synchronous, so this bypasses the async wrapper.
1797
+ */
1798
+ getSync<T>(key: string): T | null;
1792
1799
  /**
1793
1800
  * Get all SDK-namespaced keys
1794
1801
  */
package/dist/index.js CHANGED
@@ -4271,6 +4271,25 @@ var LocalStorageAdapter = class {
4271
4271
  count: keysToRemove.length
4272
4272
  });
4273
4273
  }
4274
+ /**
4275
+ * Get a value from localStorage synchronously
4276
+ *
4277
+ * Used for zero-flash cache hydration during React render phase.
4278
+ * localStorage is inherently synchronous, so this bypasses the async wrapper.
4279
+ */
4280
+ getSync(key) {
4281
+ try {
4282
+ const fullKey = this.buildKey(key);
4283
+ const value = localStorage.getItem(fullKey);
4284
+ if (value === null) {
4285
+ return null;
4286
+ }
4287
+ return JSON.parse(value);
4288
+ } catch (error) {
4289
+ this.logger?.warn("[LocalStorageAdapter] Failed to getSync/parse value", { key, error });
4290
+ return null;
4291
+ }
4292
+ }
4274
4293
  /**
4275
4294
  * Get all SDK-namespaced keys
4276
4295
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xhub-short/adapters",
3
3
  "sideEffects": false,
4
- "version": "0.1.0-beta.14",
4
+ "version": "0.1.0-beta.16",
5
5
  "type": "module",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@xhub-short/contracts": "0.1.0-beta.14"
23
+ "@xhub-short/contracts": "0.1.0-beta.16"
24
24
  },
25
25
  "optionalDependencies": {
26
26
  "hls.js": "^1.5.0"