{"_id":"@assetflux.io/react-native","name":"@assetflux.io/react-native","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@assetflux.io/react-native","version":"1.0.0","description":"React Native SDK for AssetFlux — dynamic remote asset management with gradual rollout support","license":"BSD-3-Clause","homepage":"https://docs.assetflux.io/react-native/","repository":{"type":"git","url":"git+https://github.com/Patryczon/AssetFlux.git","directory":"react_native_sdk"},"main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","test":"jest","lint":"eslint src/","clean":"rm -rf lib/"},"keywords":["react-native","asset-management","remote-images","cdn","rollout","assetflux"],"engines":{"node":">=18.0.0"},"peerDependencies":{"react":">=18.0.0","react-native":">=0.70.0","@react-native-async-storage/async-storage":">=1.19.0"},"devDependencies":{"@react-native-async-storage/async-storage":"^1.21.0","@testing-library/react-native":"^12.4.0","@types/jest":"^29.5.0","@types/react":"^18.2.0","@types/react-native":"^0.72.0","jest":"^29.7.0","react":"^18.2.0","react-native":"^0.73.0","react-test-renderer":"^18.2.0","ts-jest":"^29.1.0","typescript":"^5.3.0"},"_id":"@assetflux.io/react-native@1.0.0","gitHead":"004127b48a6fbe16d4e58d59c78941d20145affc","bugs":{"url":"https://github.com/Patryczon/AssetFlux/issues"},"_nodeVersion":"22.16.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-A0HcrsEKLZxnmQ60sl2vpUIoyWvYyaNp6cfK5EGO/zxFnzTo3/YL5M4u8oE29IePTYxbCWdaC2MmeCAkDMfz2g==","shasum":"3a35f3e8bd3af067643178da109906e5037220b2","tarball":"https://registry.npmjs.org/@assetflux.io/react-native/-/react-native-1.0.0.tgz","fileCount":48,"unpackedSize":137183,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDsSSYagP0PSitdIr/8kAadBAw/cQ17G97S7menIHFrgwIhAMGuDGMOrOURT5G+kCMhzHmS7NR+FcSoBHZ93ZOte4/J"}]},"_npmUser":{"name":"assetflux","email":"support@assetflux.io"},"directories":{},"maintainers":[{"name":"assetflux","email":"support@assetflux.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native_1.0.0_1770806888804_0.016698968839458983"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-11T10:48:08.674Z","1.0.0":"2026-02-11T10:48:08.960Z","modified":"2026-02-11T10:48:09.183Z"},"maintainers":[{"name":"assetflux","email":"support@assetflux.io"}],"description":"React Native SDK for AssetFlux — dynamic remote asset management with gradual rollout support","homepage":"https://docs.assetflux.io/react-native/","keywords":["react-native","asset-management","remote-images","cdn","rollout","assetflux"],"repository":{"type":"git","url":"git+https://github.com/Patryczon/AssetFlux.git","directory":"react_native_sdk"},"bugs":{"url":"https://github.com/Patryczon/AssetFlux/issues"},"license":"BSD-3-Clause","readme":"# AssetFlux React Native SDK\n\n[![npm version](https://img.shields.io/npm/v/@assetflux.io/react-native.svg)](https://www.npmjs.com/package/@assetflux.io/react-native)\n[![License: BSD-3-Clause](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\nManage, version, and deliver remote images to your React Native applications in real time — no app store review required.\n\n## Getting Started\n\n### 1. Install\n\n```bash\nnpm install @assetflux.io/react-native @react-native-async-storage/async-storage\n# iOS only\ncd ios && pod install\n```\n\n### 2. Initialize\n\n```tsx\nimport { AssetFlux } from '@assetflux.io/react-native';\n\nawait AssetFlux.init({\n  projectId: 'af_your_project_id',\n  apiKey: 'afk_your_sdk_key',\n});\n```\n\n### 3. Display a Remote Asset\n\n```tsx\nimport { RemoteImage } from '@assetflux.io/react-native';\n\n<RemoteImage assetKey=\"home.hero.banner\" width={300} height={200} />\n```\n\n## Usage\n\n### RemoteImage Component\n\n```tsx\nimport { RemoteImage, ShimmerPlaceholder } from '@assetflux.io/react-native';\n\n// With shimmer placeholder and fallback\n<RemoteImage\n  assetKey=\"home.hero.banner\"\n  placeholder={<ShimmerPlaceholder width={300} height={200} borderRadius={8} />}\n  errorWidget={<Text>Failed to load</Text>}\n  fallbackSource={require('./assets/fallback.png')}\n  resizeMode=\"cover\"\n  width={300}\n  height={200}\n  fadeInDuration={300}\n/>\n```\n\n### Prefetch\n\n```tsx\nawait AssetFlux.prefetch('home.hero.banner');\nawait AssetFlux.prefetchAll(['home.logo', 'home.banner']);\nawait AssetFlux.prefetchPattern('home.*');\n```\n\n### Direct URL Resolution\n\n```tsx\nconst url = await AssetFlux.resolveAssetUrl({\n  assetKey: 'home.banner',\n  devicePixelRatio: 3.0,\n});\n```\n\n### Debug Info\n\n```tsx\nconst info = await AssetFlux.getDebugInfo('home.hero.banner');\nconsole.log(info);\n```\n\n## Configuration\n\n```tsx\nimport { FallbackMode, IdentifierType } from '@assetflux.io/react-native';\n\nawait AssetFlux.init({\n  projectId: 'af_...',\n  apiKey: 'afk_...',\n  config: {\n    cacheTTL: 24 * 60 * 60 * 1000,       // 24 hours\n    refreshInterval: 15 * 60 * 1000,      // 15 minutes\n    timeout: 10_000,                       // 10 seconds\n    retryAttempts: 3,\n    fallbackBehavior: FallbackMode.CacheFirst,\n    identifierType: IdentifierType.Device,\n    debug: false,\n  },\n});\n```\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `cacheTTL` | `number` | `86400000` (24h) | Manifest cache TTL in ms |\n| `refreshInterval` | `number` | `900000` (15m) | Background refresh interval in ms |\n| `timeout` | `number` | `10000` (10s) | Network request timeout in ms |\n| `retryAttempts` | `number` | `3` | Max retry attempts with exponential backoff |\n| `fallbackBehavior` | `FallbackMode` | `CacheFirst` | Offline behavior strategy |\n| `identifierType` | `IdentifierType` | `Device` | Identifier for rollout assignment |\n| `customIdentifier` | `string?` | — | Custom identifier value |\n| `instanceConfig` | `InstanceConfig?` | — | Custom API instance (`{ baseUrl }`) |\n| `debug` | `boolean` | `false` | Enable debug logging |\n\n### Fallback Modes\n\n| Mode | Behavior |\n|------|----------|\n| `CacheFirst` | Serve cached manifest even if stale, refresh in background |\n| `Bundled` | Fall back to bundled assets when offline |\n| `Placeholder` | Show placeholder component on failure |\n\n## Gradual Rollout\n\nUsers are deterministically assigned to rollout buckets (0–99) using SHA-256 hashing. The same user always sees the same variant.\n\n```tsx\n// Device-based (default) — persistent across app restarts\n{ identifierType: IdentifierType.Device }\n\n// User-based — set after login\n{ identifierType: IdentifierType.User }\nAssetFlux.setUserId('user_12345');\n\n// Custom identifier\n{ identifierType: IdentifierType.Custom, customIdentifier: 'org_abc' }\n```\n\n## Reactive Rebuilds\n\n`RemoteImage` automatically re-renders when the manifest updates:\n\n```tsx\n// Or subscribe manually\nconst unsubscribe = AssetFlux.addManifestListener(() => {\n  console.log('Manifest updated');\n});\n```\n\n## Requirements\n\n- React Native >= 0.70\n- React >= 18.0\n- iOS 13+ / Android API 21+\n\n## Documentation\n\nFull documentation is available at **[docs.assetflux.io/react-native](https://docs.assetflux.io/react-native/)**.\n\n## License\n\nBSD 3-Clause. See [LICENSE](LICENSE) for details.\n","readmeFilename":"README.md","_rev":"1-88eae6c4e34d2b0e8d8457d54e674344"}