tevrocsdk 0.1.52 → 0.1.53

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.
Files changed (2) hide show
  1. package/README.md +20 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -332,3 +332,23 @@ try {
332
332
  }
333
333
  }
334
334
  ```
335
+
336
+ ## File-offline caching (native only)
337
+
338
+ When running inside a native shell (Capacitor or Tauri), the SDK can now persist downloaded file bytes into the native store so assets are available while offline. Key points:
339
+
340
+ - Behavior is enabled only when a native store is available — the web/browser runtime is unaffected.
341
+ - On online sync the SDK will download files referenced in entity results, encode them as Base64, and save them under `downloaded_files/<key>` in the native store.
342
+ - When offline, the `files.url()` helper will return a `data:<contentType>;base64,<data>` URI for cached files so `<img>` and other consumers can render assets without network access.
343
+ - Debug logs use the tag `[tevrocsdk][fileoffline]` for all download/persist/read operations.
344
+ - The SDK applies iterative percent-decoding to file keys when resolving URLs to avoid double-encoding issues seen in some integrations.
345
+
346
+ How to validate:
347
+
348
+ 1. Run your app in a native shell (Capacitor or Tauri) with `debug: true`.
349
+ 2. Trigger a sync or load entities that reference files (for example, product images).
350
+ 3. Watch the console for `[tevrocsdk][fileoffline]` logs showing download and store operations.
351
+ 4. Go offline and reload the page — `files.url(key)` should resolve to a `data:` URI and images should render from the native cache.
352
+
353
+ Note: This feature is additive and opt-in via using the SDK inside a native runtime; browser-only apps keep the existing behavior and will not attempt native persistence.
354
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tevrocsdk",
3
- "version": "0.1.52",
3
+ "version": "0.1.53",
4
4
  "description": "JavaScript SDK for the Tevroc API.",
5
5
  "main": "./tevroc-sdk.umd.js",
6
6
  "module": "./tevroc-sdk.esm.js",