@hot-updater/react-native 0.36.6 → 1.0.0-rc.0

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 (239) hide show
  1. package/android/src/main/java/com/hotupdater/BundleFileStorageService.kt +357 -6
  2. package/android/src/main/java/com/hotupdater/BundleMetadata.kt +268 -34
  3. package/android/src/main/java/com/hotupdater/HotUpdaterImpl.kt +75 -9
  4. package/android/src/main/java/com/hotupdater/NativeConfigUtils.kt +2 -16
  5. package/android/src/main/java/com/hotupdater/ReleaseCatalogCacheService.kt +166 -0
  6. package/android/src/main/java/com/hotupdater/SignatureVerifier.kt +1 -2
  7. package/android/src/newarch/HotUpdater.kt +1 -1
  8. package/android/src/newarch/HotUpdaterModule.kt +116 -0
  9. package/android/src/oldarch/HotUpdater.kt +1 -1
  10. package/android/src/oldarch/HotUpdaterModule.kt +128 -0
  11. package/android/src/oldarch/HotUpdaterSpec.kt +38 -0
  12. package/android/src/test/java/com/hotupdater/BundleFileStorageServiceTest.kt +280 -2
  13. package/android/src/test/java/com/hotupdater/HotUpdaterImplTest.kt +57 -2
  14. package/android/src/test/java/com/hotupdater/ReleaseCatalogCacheServiceTest.kt +118 -0
  15. package/ios/HotUpdater/Internal/BundleFileStorageService.swift +491 -30
  16. package/ios/HotUpdater/Internal/BundleMetadata.swift +229 -6
  17. package/ios/HotUpdater/Internal/HotUpdater.mm +122 -0
  18. package/ios/HotUpdater/Internal/HotUpdaterImpl.swift +176 -7
  19. package/ios/HotUpdater/Internal/ReleaseCatalogCacheService.swift +213 -0
  20. package/lib/commonjs/catalogCacheNative.js +44 -0
  21. package/lib/commonjs/catalogCacheNative.js.map +1 -0
  22. package/lib/commonjs/catalogCacheNative.spec.js +31 -0
  23. package/lib/commonjs/catalogCacheNative.spec.js.map +1 -0
  24. package/lib/commonjs/checkForUpdate.js +231 -60
  25. package/lib/commonjs/checkForUpdate.js.map +1 -1
  26. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js +604 -0
  27. package/lib/commonjs/checkForUpdate.releaseCatalog.spec.js.map +1 -0
  28. package/lib/commonjs/error.js +8 -1
  29. package/lib/commonjs/error.js.map +1 -1
  30. package/lib/commonjs/{fetchUpdateInfo.js → fetchJSON.js} +11 -14
  31. package/lib/commonjs/fetchJSON.js.map +1 -0
  32. package/lib/commonjs/httpClient.js +153 -0
  33. package/lib/commonjs/httpClient.js.map +1 -0
  34. package/lib/commonjs/httpClient.spec.js +102 -0
  35. package/lib/commonjs/httpClient.spec.js.map +1 -0
  36. package/lib/commonjs/index.js +48 -71
  37. package/lib/commonjs/index.js.map +1 -1
  38. package/lib/commonjs/index.spec.js +117 -161
  39. package/lib/commonjs/index.spec.js.map +1 -1
  40. package/lib/commonjs/iosInterop.spec.js +18 -0
  41. package/lib/commonjs/iosInterop.spec.js.map +1 -0
  42. package/lib/commonjs/native.js +222 -55
  43. package/lib/commonjs/native.js.map +1 -1
  44. package/lib/commonjs/native.spec.js +226 -12
  45. package/lib/commonjs/native.spec.js.map +1 -1
  46. package/lib/commonjs/notifyAppReadyAnalytics.boundary.spec.js +218 -0
  47. package/lib/commonjs/notifyAppReadyAnalytics.boundary.spec.js.map +1 -0
  48. package/lib/commonjs/notifyAppReadyAnalytics.js +133 -0
  49. package/lib/commonjs/notifyAppReadyAnalytics.js.map +1 -0
  50. package/lib/commonjs/notifyAppReadyAnalytics.spec.js +246 -0
  51. package/lib/commonjs/notifyAppReadyAnalytics.spec.js.map +1 -0
  52. package/lib/commonjs/notifyAppReadyAnalytics.test-utils.js +24 -0
  53. package/lib/commonjs/notifyAppReadyAnalytics.test-utils.js.map +1 -0
  54. package/lib/commonjs/notifyAppReadyAnalytics.transport.spec.js +117 -0
  55. package/lib/commonjs/notifyAppReadyAnalytics.transport.spec.js.map +1 -0
  56. package/lib/commonjs/releaseCatalogCache.js +179 -0
  57. package/lib/commonjs/releaseCatalogCache.js.map +1 -0
  58. package/lib/commonjs/releaseCatalogCache.spec.js +195 -0
  59. package/lib/commonjs/releaseCatalogCache.spec.js.map +1 -0
  60. package/lib/commonjs/releaseCatalogCacheNativeContract.spec.js +64 -0
  61. package/lib/commonjs/releaseCatalogCacheNativeContract.spec.js.map +1 -0
  62. package/lib/commonjs/sdkVersion.js +1 -1
  63. package/lib/commonjs/sdkVersion.js.map +1 -1
  64. package/lib/commonjs/specs/NativeHotUpdater.js.map +1 -1
  65. package/lib/commonjs/types.js +0 -12
  66. package/lib/commonjs/types.js.map +1 -1
  67. package/lib/commonjs/wrap.js +7 -82
  68. package/lib/commonjs/wrap.js.map +1 -1
  69. package/lib/commonjs/wrap.spec.js +203 -56
  70. package/lib/commonjs/wrap.spec.js.map +1 -1
  71. package/lib/commonjs/wrap.types.js +6 -0
  72. package/lib/commonjs/wrap.types.js.map +1 -0
  73. package/lib/module/catalogCacheNative.js +36 -0
  74. package/lib/module/catalogCacheNative.js.map +1 -0
  75. package/lib/module/catalogCacheNative.spec.js +31 -0
  76. package/lib/module/catalogCacheNative.spec.js.map +1 -0
  77. package/lib/module/checkForUpdate.js +233 -62
  78. package/lib/module/checkForUpdate.js.map +1 -1
  79. package/lib/module/checkForUpdate.releaseCatalog.spec.js +603 -0
  80. package/lib/module/checkForUpdate.releaseCatalog.spec.js.map +1 -0
  81. package/lib/module/error.js +6 -0
  82. package/lib/module/error.js.map +1 -1
  83. package/lib/module/{fetchUpdateInfo.js → fetchJSON.js} +9 -12
  84. package/lib/module/fetchJSON.js.map +1 -0
  85. package/lib/module/httpClient.js +148 -0
  86. package/lib/module/httpClient.js.map +1 -0
  87. package/lib/module/httpClient.spec.js +102 -0
  88. package/lib/module/httpClient.spec.js.map +1 -0
  89. package/lib/module/index.js +49 -66
  90. package/lib/module/index.js.map +1 -1
  91. package/lib/module/index.spec.js +117 -161
  92. package/lib/module/index.spec.js.map +1 -1
  93. package/lib/module/iosInterop.spec.js +18 -0
  94. package/lib/module/iosInterop.spec.js.map +1 -0
  95. package/lib/module/native.js +206 -51
  96. package/lib/module/native.js.map +1 -1
  97. package/lib/module/native.spec.js +226 -12
  98. package/lib/module/native.spec.js.map +1 -1
  99. package/lib/module/notifyAppReadyAnalytics.boundary.spec.js +217 -0
  100. package/lib/module/notifyAppReadyAnalytics.boundary.spec.js.map +1 -0
  101. package/lib/module/notifyAppReadyAnalytics.js +128 -0
  102. package/lib/module/notifyAppReadyAnalytics.js.map +1 -0
  103. package/lib/module/notifyAppReadyAnalytics.spec.js +245 -0
  104. package/lib/module/notifyAppReadyAnalytics.spec.js.map +1 -0
  105. package/lib/module/notifyAppReadyAnalytics.test-utils.js +18 -0
  106. package/lib/module/notifyAppReadyAnalytics.test-utils.js.map +1 -0
  107. package/lib/module/notifyAppReadyAnalytics.transport.spec.js +116 -0
  108. package/lib/module/notifyAppReadyAnalytics.transport.spec.js.map +1 -0
  109. package/lib/module/releaseCatalogCache.js +171 -0
  110. package/lib/module/releaseCatalogCache.js.map +1 -0
  111. package/lib/module/releaseCatalogCache.spec.js +195 -0
  112. package/lib/module/releaseCatalogCache.spec.js.map +1 -0
  113. package/lib/module/releaseCatalogCacheNativeContract.spec.js +64 -0
  114. package/lib/module/releaseCatalogCacheNativeContract.spec.js.map +1 -0
  115. package/lib/module/sdkVersion.js +1 -1
  116. package/lib/module/sdkVersion.js.map +1 -1
  117. package/lib/module/specs/NativeHotUpdater.js.map +1 -1
  118. package/lib/module/types.js +0 -12
  119. package/lib/module/types.js.map +1 -1
  120. package/lib/module/wrap.js +6 -81
  121. package/lib/module/wrap.js.map +1 -1
  122. package/lib/module/wrap.spec.js +203 -56
  123. package/lib/module/wrap.spec.js.map +1 -1
  124. package/lib/module/wrap.types.js +4 -0
  125. package/lib/module/wrap.types.js.map +1 -0
  126. package/lib/typescript/commonjs/catalogCacheNative.d.ts +4 -0
  127. package/lib/typescript/commonjs/catalogCacheNative.d.ts.map +1 -0
  128. package/lib/typescript/commonjs/checkForUpdate.d.ts +14 -4
  129. package/lib/typescript/commonjs/checkForUpdate.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/error.d.ts +3 -0
  131. package/lib/typescript/commonjs/error.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/fetchJSON.d.ts +6 -0
  133. package/lib/typescript/commonjs/fetchJSON.d.ts.map +1 -0
  134. package/lib/typescript/commonjs/httpClient.d.ts +56 -0
  135. package/lib/typescript/commonjs/httpClient.d.ts.map +1 -0
  136. package/lib/typescript/commonjs/index.d.ts +32 -41
  137. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/native.d.ts +83 -18
  139. package/lib/typescript/commonjs/native.d.ts.map +1 -1
  140. package/lib/typescript/commonjs/notifyAppReadyAnalytics.d.ts +13 -0
  141. package/lib/typescript/commonjs/notifyAppReadyAnalytics.d.ts.map +1 -0
  142. package/lib/typescript/commonjs/notifyAppReadyAnalytics.test-utils.d.ts +8 -0
  143. package/lib/typescript/commonjs/notifyAppReadyAnalytics.test-utils.d.ts.map +1 -0
  144. package/lib/typescript/commonjs/releaseCatalogCache.d.ts +25 -0
  145. package/lib/typescript/commonjs/releaseCatalogCache.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/sdkVersion.d.ts +1 -1
  147. package/lib/typescript/commonjs/sdkVersion.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts +40 -5
  149. package/lib/typescript/commonjs/specs/NativeHotUpdater.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/types.d.ts +0 -118
  151. package/lib/typescript/commonjs/types.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/wrap.d.ts +2 -191
  153. package/lib/typescript/commonjs/wrap.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/wrap.types.d.ts +65 -0
  155. package/lib/typescript/commonjs/wrap.types.d.ts.map +1 -0
  156. package/lib/typescript/module/catalogCacheNative.d.ts +4 -0
  157. package/lib/typescript/module/catalogCacheNative.d.ts.map +1 -0
  158. package/lib/typescript/module/checkForUpdate.d.ts +14 -4
  159. package/lib/typescript/module/checkForUpdate.d.ts.map +1 -1
  160. package/lib/typescript/module/error.d.ts +3 -0
  161. package/lib/typescript/module/error.d.ts.map +1 -1
  162. package/lib/typescript/module/fetchJSON.d.ts +6 -0
  163. package/lib/typescript/module/fetchJSON.d.ts.map +1 -0
  164. package/lib/typescript/module/httpClient.d.ts +56 -0
  165. package/lib/typescript/module/httpClient.d.ts.map +1 -0
  166. package/lib/typescript/module/index.d.ts +32 -41
  167. package/lib/typescript/module/index.d.ts.map +1 -1
  168. package/lib/typescript/module/native.d.ts +83 -18
  169. package/lib/typescript/module/native.d.ts.map +1 -1
  170. package/lib/typescript/module/notifyAppReadyAnalytics.d.ts +13 -0
  171. package/lib/typescript/module/notifyAppReadyAnalytics.d.ts.map +1 -0
  172. package/lib/typescript/module/notifyAppReadyAnalytics.test-utils.d.ts +8 -0
  173. package/lib/typescript/module/notifyAppReadyAnalytics.test-utils.d.ts.map +1 -0
  174. package/lib/typescript/module/releaseCatalogCache.d.ts +25 -0
  175. package/lib/typescript/module/releaseCatalogCache.d.ts.map +1 -0
  176. package/lib/typescript/module/sdkVersion.d.ts +1 -1
  177. package/lib/typescript/module/sdkVersion.d.ts.map +1 -1
  178. package/lib/typescript/module/specs/NativeHotUpdater.d.ts +40 -5
  179. package/lib/typescript/module/specs/NativeHotUpdater.d.ts.map +1 -1
  180. package/lib/typescript/module/types.d.ts +0 -118
  181. package/lib/typescript/module/types.d.ts.map +1 -1
  182. package/lib/typescript/module/wrap.d.ts +2 -191
  183. package/lib/typescript/module/wrap.d.ts.map +1 -1
  184. package/lib/typescript/module/wrap.types.d.ts +65 -0
  185. package/lib/typescript/module/wrap.types.d.ts.map +1 -0
  186. package/package.json +6 -24
  187. package/src/catalogCacheNative.spec.ts +63 -0
  188. package/src/catalogCacheNative.ts +74 -0
  189. package/src/checkForUpdate.releaseCatalog.spec.ts +596 -0
  190. package/src/checkForUpdate.ts +368 -97
  191. package/src/error.ts +7 -0
  192. package/src/{fetchUpdateInfo.ts → fetchJSON.ts} +8 -15
  193. package/src/httpClient.spec.ts +132 -0
  194. package/src/httpClient.ts +261 -0
  195. package/src/index.spec.ts +110 -203
  196. package/src/index.ts +70 -93
  197. package/src/iosInterop.spec.ts +30 -0
  198. package/src/native.spec.ts +226 -10
  199. package/src/native.ts +385 -83
  200. package/src/notifyAppReadyAnalytics.boundary.spec.ts +234 -0
  201. package/src/notifyAppReadyAnalytics.spec.ts +243 -0
  202. package/src/notifyAppReadyAnalytics.test-utils.ts +31 -0
  203. package/src/notifyAppReadyAnalytics.transport.spec.ts +130 -0
  204. package/src/notifyAppReadyAnalytics.ts +194 -0
  205. package/src/releaseCatalogCache.spec.ts +282 -0
  206. package/src/releaseCatalogCache.ts +341 -0
  207. package/src/releaseCatalogCacheNativeContract.spec.ts +80 -0
  208. package/src/sdkVersion.ts +1 -1
  209. package/src/specs/NativeHotUpdater.ts +51 -5
  210. package/src/types.ts +0 -140
  211. package/src/wrap.spec.ts +251 -56
  212. package/src/wrap.tsx +23 -318
  213. package/src/wrap.types.ts +78 -0
  214. package/android/src/main/java/com/hotupdater/StringResourceUtils.kt +0 -45
  215. package/app.plugin.js +0 -1
  216. package/ios/HotUpdater/Internal/HotUpdaterCrashHandler.h +0 -7
  217. package/ios/HotUpdater/Internal/HotUpdaterCrashHandler.mm +0 -4
  218. package/lib/commonjs/DefaultResolver.js +0 -50
  219. package/lib/commonjs/DefaultResolver.js.map +0 -1
  220. package/lib/commonjs/DefaultResolver.spec.js +0 -144
  221. package/lib/commonjs/DefaultResolver.spec.js.map +0 -1
  222. package/lib/commonjs/fetchUpdateInfo.js.map +0 -1
  223. package/lib/module/DefaultResolver.js +0 -46
  224. package/lib/module/DefaultResolver.js.map +0 -1
  225. package/lib/module/DefaultResolver.spec.js +0 -144
  226. package/lib/module/DefaultResolver.spec.js.map +0 -1
  227. package/lib/module/fetchUpdateInfo.js.map +0 -1
  228. package/lib/typescript/commonjs/DefaultResolver.d.ts +0 -11
  229. package/lib/typescript/commonjs/DefaultResolver.d.ts.map +0 -1
  230. package/lib/typescript/commonjs/fetchUpdateInfo.d.ts +0 -7
  231. package/lib/typescript/commonjs/fetchUpdateInfo.d.ts.map +0 -1
  232. package/lib/typescript/module/DefaultResolver.d.ts +0 -11
  233. package/lib/typescript/module/DefaultResolver.d.ts.map +0 -1
  234. package/lib/typescript/module/fetchUpdateInfo.d.ts +0 -7
  235. package/lib/typescript/module/fetchUpdateInfo.d.ts.map +0 -1
  236. package/plugin/build/transformers.js +0 -314
  237. package/plugin/build/withHotUpdater.js +0 -228
  238. package/src/DefaultResolver.spec.ts +0 -193
  239. package/src/DefaultResolver.ts +0 -63
package/src/index.ts CHANGED
@@ -3,9 +3,10 @@ import {
3
3
  checkForUpdate,
4
4
  type InternalCheckForUpdateOptions,
5
5
  } from "./checkForUpdate";
6
- import { createDefaultResolver } from "./DefaultResolver";
6
+ import { createHttpClient, type HotUpdaterHttpClient } from "./httpClient";
7
7
  import {
8
8
  addListener,
9
+ getPublicActiveUpdateState,
9
10
  clearCrashHistory,
10
11
  getAppVersion,
11
12
  getBaseURL,
@@ -15,18 +16,21 @@ import {
15
16
  getCrashHistory,
16
17
  getDefaultChannel,
17
18
  getFingerprintHash,
19
+ getInstallId,
18
20
  getManifest,
19
- getMinBundleId,
21
+ getMinimumReleaseId,
22
+ getReleaseId,
20
23
  isChannelSwitched,
24
+ notifyAppReady,
21
25
  reload,
22
26
  resetChannel,
23
27
  setCohort,
24
28
  setReloadBehavior,
29
+ setUser,
25
30
  type UpdateParams,
26
31
  updateBundle,
27
32
  } from "./native";
28
33
  import { hotUpdaterStore } from "./store";
29
- import type { HotUpdaterResolver } from "./types";
30
34
  import {
31
35
  type AutoUpdateOptions,
32
36
  type HotUpdaterInitOptions,
@@ -34,7 +38,6 @@ import {
34
38
  init,
35
39
  type InternalInitOptions,
36
40
  type InternalWrapOptions,
37
- type ManualUpdateOptions,
38
41
  wrap,
39
42
  } from "./wrap";
40
43
 
@@ -46,25 +49,22 @@ export type {
46
49
  Manifest,
47
50
  ManifestAsset,
48
51
  NotifyAppReadyResult,
52
+ ActiveUpdateState,
49
53
  ReloadBehavior,
50
54
  ReloadBehaviorSetting,
55
+ SetUserParams,
51
56
  } from "./native";
52
57
  export * from "./store";
53
- export { createDefaultResolver } from "./DefaultResolver";
54
58
  export {
55
59
  extractSignatureFailure,
56
60
  type HotUpdaterBaseURL,
57
- type HotUpdaterResolver,
58
61
  isSignatureVerificationError,
59
- type ResolverCheckUpdateParams,
60
- type ResolverNotifyAppReadyParams,
61
62
  type SignatureVerificationFailure,
62
63
  } from "./types";
63
64
  export type {
64
65
  HotUpdaterFallbackComponentProps,
65
66
  HotUpdaterInitOptions,
66
67
  HotUpdaterOptions,
67
- ManualUpdateOptions,
68
68
  RunUpdateProcessResponse,
69
69
  } from "./wrap";
70
70
 
@@ -88,31 +88,9 @@ registerGlobalGetBaseURL();
88
88
 
89
89
  type HotUpdaterWrap = {
90
90
  (options: AutoUpdateOptions): ReturnType<typeof wrap>;
91
- /**
92
- * @deprecated Replace manual `HotUpdater.wrap` with `HotUpdater.init`.
93
- *
94
- * ```tsx
95
- * import { HotUpdater } from "@hot-updater/react-native";
96
- *
97
- * HotUpdater.init({
98
- * baseURL: "<your-update-server-url>",
99
- * });
100
- *
101
- * export default App;
102
- * ```
103
- *
104
- * Then call `HotUpdater.checkForUpdate(...)` from your manual update flow.
105
- * See https://hot-updater.dev/docs/guides/custom-update
106
- */
107
- (options: ManualUpdateOptions): ReturnType<typeof wrap>;
108
91
  (options: HotUpdaterOptions): ReturnType<typeof wrap>;
109
92
  };
110
93
 
111
- const isManualWrapOptions = (
112
- options: HotUpdaterOptions,
113
- ): options is ManualUpdateOptions =>
114
- "updateMode" in options && options.updateMode === "manual";
115
-
116
94
  /**
117
95
  * Creates a HotUpdater client instance with all update management methods.
118
96
  * This function is called once on module initialization to create a singleton instance.
@@ -123,18 +101,19 @@ function createHotUpdaterClient() {
123
101
 
124
102
  // Global configuration stored from wrap
125
103
  const globalConfig: {
126
- resolver: HotUpdaterResolver | null;
104
+ analytics?: boolean;
105
+ client: HotUpdaterHttpClient | null;
127
106
  requestHeaders?: Record<string, string>;
128
107
  requestTimeout?: number;
129
108
  onError?: (error: unknown) => void;
130
109
  } = {
131
- resolver: null,
110
+ client: null,
132
111
  };
133
112
 
134
113
  const createMissingNetworkConfigError = (apiName: "init" | "wrap") => {
135
114
  if (apiName === "init") {
136
115
  return new Error(
137
- `[HotUpdater] Either baseURL or resolver must be provided.\n\n` +
116
+ `[HotUpdater] baseURL must be provided.\n\n` +
138
117
  `Configure HotUpdater before calling update APIs with the standard baseURL setup:\n\n` +
139
118
  ` HotUpdater.init({\n` +
140
119
  ` baseURL: "<your-update-server-url>",\n` +
@@ -150,7 +129,7 @@ function createHotUpdaterClient() {
150
129
  ` })(App);\n\n`;
151
130
 
152
131
  return new Error(
153
- `[HotUpdater] Either baseURL or resolver must be provided.\n\n` +
132
+ `[HotUpdater] baseURL must be provided.\n\n` +
154
133
  `Configure HotUpdater.wrap with the standard baseURL setup:\n\n` +
155
134
  baseURLExample +
156
135
  `For manual update flows, use HotUpdater.init() and visit: ` +
@@ -161,39 +140,25 @@ function createHotUpdaterClient() {
161
140
  const normalizeOptions = (
162
141
  options: HotUpdaterOptions,
163
142
  ): InternalWrapOptions => {
164
- if (isManualWrapOptions(options)) {
165
- if ("baseURL" in options && options.baseURL) {
166
- const { baseURL, ...rest } = options;
167
- return {
168
- ...rest,
169
- resolver: createDefaultResolver(baseURL),
170
- updateMode: "manual",
171
- };
172
- }
173
-
174
- if ("resolver" in options && options.resolver) {
175
- return {
176
- ...options,
177
- updateMode: "manual",
178
- };
179
- }
143
+ const incoming = options as HotUpdaterOptions & {
144
+ updateMode?: unknown;
145
+ };
146
+ if (incoming.updateMode === "manual") {
147
+ throw new Error(
148
+ '[HotUpdater] HotUpdater.wrap({ updateMode: "manual" }) was removed. ' +
149
+ "Call HotUpdater.init({ ... }) instead, export your root component " +
150
+ "directly, and use HotUpdater.checkForUpdate(...) for the manual " +
151
+ "update flow. See https://hot-updater.dev/docs/guides/custom-update",
152
+ );
180
153
  }
181
154
 
182
- const autoOptions = options as AutoUpdateOptions;
155
+ const autoOptions = incoming as AutoUpdateOptions;
183
156
 
184
- if ("baseURL" in autoOptions && autoOptions.baseURL) {
157
+ if (autoOptions.baseURL) {
185
158
  const { baseURL, ...rest } = autoOptions;
186
159
  return {
187
160
  ...rest,
188
- resolver: createDefaultResolver(baseURL),
189
- updateMode: "auto",
190
- };
191
- }
192
-
193
- if ("resolver" in autoOptions && autoOptions.resolver) {
194
- return {
195
- ...autoOptions,
196
- updateMode: "auto",
161
+ client: createHttpClient(baseURL),
197
162
  };
198
163
  }
199
164
 
@@ -208,18 +173,14 @@ function createHotUpdaterClient() {
208
173
  updateMode?: unknown;
209
174
  };
210
175
 
211
- if ("baseURL" in rest && rest.baseURL) {
176
+ if (rest.baseURL) {
212
177
  const { baseURL, ...baseURLRest } = rest;
213
178
  return {
214
179
  ...baseURLRest,
215
- resolver: createDefaultResolver(baseURL),
180
+ client: createHttpClient(baseURL),
216
181
  };
217
182
  }
218
183
 
219
- if ("resolver" in rest && rest.resolver) {
220
- return rest;
221
- }
222
-
223
184
  throw createMissingNetworkConfigError("init");
224
185
  };
225
186
 
@@ -227,7 +188,8 @@ function createHotUpdaterClient() {
227
188
  normalizedOptions: InternalInitOptions | InternalWrapOptions,
228
189
  options: HotUpdaterOptions | HotUpdaterInitOptions,
229
190
  ) => {
230
- globalConfig.resolver = normalizedOptions.resolver;
191
+ globalConfig.analytics = normalizedOptions.analytics;
192
+ globalConfig.client = normalizedOptions.client;
231
193
  globalConfig.requestHeaders = options.requestHeaders;
232
194
  globalConfig.requestTimeout = options.requestTimeout;
233
195
  globalConfig.onError = options.onError;
@@ -250,8 +212,8 @@ function createHotUpdaterClient() {
250
212
  configurationAPI ??= nextAPI;
251
213
  };
252
214
 
253
- const ensureGlobalResolver = (methodName: string) => {
254
- if (!globalConfig.resolver) {
215
+ const ensureGlobalClient = (methodName: string) => {
216
+ if (!globalConfig.client) {
255
217
  throw new Error(
256
218
  `[HotUpdater] ${methodName} requires HotUpdater.wrap() or HotUpdater.init() to be used.\n\n` +
257
219
  `To fix this issue, configure HotUpdater before calling ${methodName}:\n\n` +
@@ -267,7 +229,7 @@ function createHotUpdaterClient() {
267
229
  `For manual update flows, visit: https://hot-updater.dev/docs/guides/custom-update`,
268
230
  );
269
231
  }
270
- return globalConfig.resolver;
232
+ return globalConfig.client;
271
233
  };
272
234
 
273
235
  return {
@@ -289,7 +251,7 @@ function createHotUpdaterClient() {
289
251
  * baseURL: "<your-update-server-url>",
290
252
  * updateStrategy: "appVersion",
291
253
  * requestHeaders: {
292
- * "Authorization": "Bearer <your-access-token>",
254
+ * "x-api-key": "<your-api-key>",
293
255
  * },
294
256
  * })(App);
295
257
  * ```
@@ -306,8 +268,7 @@ function createHotUpdaterClient() {
306
268
  * Initializes HotUpdater without wrapping a React component.
307
269
  *
308
270
  * Use this for manual update flows in runtimes where a root component HOC
309
- * is not convenient. Replace deprecated manual
310
- * `HotUpdater.wrap({ updateMode: "manual" })(App)` usage with this API.
271
+ * is not convenient. Use this instead of wrapping the root component.
311
272
  *
312
273
  * @example
313
274
  * ```tsx
@@ -368,15 +329,19 @@ function createHotUpdaterClient() {
368
329
  */
369
330
  getAppVersion,
370
331
 
332
+ /** Reads the active and stable Release/Bundle state. */
333
+ getActiveUpdateState: async () => getPublicActiveUpdateState(),
334
+
371
335
  /**
372
336
  * Fetches the current bundle ID of the app.
373
337
  */
374
338
  getBundleId,
375
339
 
376
- /**
377
- * Retrieves the initial bundle ID based on the build time of the native app.
378
- */
379
- getMinBundleId,
340
+ /** Preferred Release-catalog name for the build-time UUIDv7 floor. */
341
+ getMinimumReleaseId,
342
+
343
+ /** Returns the active Release identity, or null for BUILTIN/legacy state. */
344
+ getReleaseId,
380
345
 
381
346
  /**
382
347
  * Fetches the current manifest for the active bundle.
@@ -453,18 +418,17 @@ function createHotUpdaterClient() {
453
418
  * Manually checks for updates.
454
419
  *
455
420
  * @param {Object} config - Update check configuration
456
- * @param {string} config.source - Update server URL
457
421
  * @param {string} [config.channel] - Optional channel override for this update check
458
422
  * @param {Record<string, string>} [config.requestHeaders] - Request headers
459
423
  *
460
- * @returns {Promise<UpdateInfo | null>} Update information or null if up to date
424
+ * @returns {Promise<CheckForUpdateResult | null>} Update information or null if up to date
461
425
  *
462
426
  * @example
463
427
  * ```ts
464
428
  * const updateInfo = await HotUpdater.checkForUpdate({
465
- * source: "<your-update-server-url>",
429
+ * updateStrategy: "appVersion",
466
430
  * requestHeaders: {
467
- * Authorization: "Bearer <your-access-token>",
431
+ * "x-api-key": "<your-api-key>",
468
432
  * },
469
433
  * });
470
434
  *
@@ -473,18 +437,19 @@ function createHotUpdaterClient() {
473
437
  * return;
474
438
  * }
475
439
  *
476
- * await HotUpdater.updateBundle(updateInfo.id, updateInfo.fileUrl);
440
+ * await updateInfo.updateBundle();
477
441
  * if (updateInfo.shouldForceUpdate) {
478
442
  * await HotUpdater.reload();
479
443
  * }
480
444
  * ```
481
445
  */
482
446
  checkForUpdate: (config: CheckForUpdateOptions) => {
483
- const resolver = ensureGlobalResolver("checkForUpdate");
447
+ const client = ensureGlobalClient("checkForUpdate");
484
448
 
485
449
  const mergedConfig: InternalCheckForUpdateOptions = {
486
450
  ...config,
487
- resolver,
451
+ analytics: globalConfig.analytics,
452
+ client,
488
453
  requestHeaders: {
489
454
  ...globalConfig.requestHeaders,
490
455
  ...config.requestHeaders,
@@ -508,9 +473,9 @@ function createHotUpdaterClient() {
508
473
  * @example
509
474
  * ```ts
510
475
  * const updateInfo = await HotUpdater.checkForUpdate({
511
- * source: "<your-update-server-url>",
476
+ * updateStrategy: "appVersion",
512
477
  * requestHeaders: {
513
- * Authorization: "Bearer <your-access-token>",
478
+ * "x-api-key": "<your-api-key>",
514
479
  * },
515
480
  * });
516
481
  *
@@ -520,17 +485,14 @@ function createHotUpdaterClient() {
520
485
  * };
521
486
  * }
522
487
  *
523
- * await HotUpdater.updateBundle({
524
- * bundleId: updateInfo.id,
525
- * fileUrl: updateInfo.fileUrl
526
- * });
488
+ * await updateInfo.updateBundle();
527
489
  * if (updateInfo.shouldForceUpdate) {
528
490
  * await HotUpdater.reload();
529
491
  * }
530
492
  * ```
531
493
  */
532
494
  updateBundle: (params: UpdateParams) => {
533
- ensureGlobalResolver("updateBundle");
495
+ ensureGlobalClient("updateBundle");
534
496
  return updateBundle(params);
535
497
  },
536
498
 
@@ -567,6 +529,21 @@ function createHotUpdaterClient() {
567
529
  */
568
530
  getFingerprintHash,
569
531
 
532
+ /**
533
+ * Fetches the persisted install id for this app installation.
534
+ */
535
+ getInstallId,
536
+
537
+ /**
538
+ * Persists nullable user identity fields associated with this installation.
539
+ */
540
+ setUser,
541
+
542
+ /**
543
+ * Reads the native launch report for the current process.
544
+ */
545
+ notifyAppReady,
546
+
570
547
  /**
571
548
  * Gets the list of bundle IDs that have been marked as crashed.
572
549
  * These bundles will be rejected if attempted to install again.
@@ -0,0 +1,30 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+
4
+ import { describe, expect, it } from "vitest";
5
+
6
+ const iosInternalDirectory = resolve(
7
+ import.meta.dirname,
8
+ "../ios/HotUpdater/Internal",
9
+ );
10
+
11
+ const readIOSSource = (filename: string) =>
12
+ readFileSync(resolve(iosInternalDirectory, filename), "utf8");
13
+
14
+ describe("iOS Objective-C interoperability", () => {
15
+ it("does not call an autoreleased NSString through raw Swift ABI", () => {
16
+ const implementation = readIOSSource("HotUpdaterImpl.swift");
17
+ const objectiveCImplementation = readIOSSource("HotUpdater.mm");
18
+
19
+ expect(implementation).not.toContain(
20
+ '@_silgen_name("HotUpdaterGetMinBundleId")',
21
+ );
22
+ expect(implementation).toContain(
23
+ '@_silgen_name("HotUpdaterCopyMinBundleId")',
24
+ );
25
+ expect(implementation).toContain(".takeRetainedValue() as String");
26
+ expect(objectiveCImplementation).toContain(
27
+ "return (__bridge_retained void *)HotUpdaterGetMinBundleId();",
28
+ );
29
+ });
30
+ });