@teardown/react-native 2.0.0 → 2.0.1
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/README.md +33 -19
- package/docs/01-getting-started.mdx +147 -0
- package/docs/02-core-concepts.mdx +188 -0
- package/docs/03-identity.mdx +301 -0
- package/docs/04-force-updates.mdx +339 -0
- package/docs/05-device-info.mdx +324 -0
- package/docs/06-logging.mdx +345 -0
- package/docs/06-storage.mdx +349 -0
- package/docs/07-api-reference.mdx +472 -0
- package/docs/07-logging.mdx +345 -0
- package/docs/08-api-reference.mdx +472 -0
- package/docs/08-hooks-reference.mdx +476 -0
- package/docs/09-advanced.mdx +563 -0
- package/docs/09-hooks-reference.mdx +476 -0
- package/docs/10-advanced.mdx +563 -0
- package/package.json +1 -1
- package/src/clients/api/api.client.ts +27 -2
- package/src/clients/device/device.client.test.ts +0 -5
- package/src/clients/device/expo-adapter.ts +1 -39
- package/src/clients/force-update/force-update.client.test.ts +7 -8
- package/src/clients/identity/identity.client.ts +6 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, test, expect, beforeEach, mock } from "bun:test";
|
|
2
2
|
import { EventEmitter } from "eventemitter3";
|
|
3
|
+
import { ForceUpdateClient, IdentifyVersionStatusEnum } from "./force-update.client";
|
|
3
4
|
|
|
4
5
|
// Must mock react-native BEFORE any imports that use it
|
|
5
6
|
const mockAppStateListeners: ((state: string) => void)[] = [];
|
|
@@ -12,8 +13,6 @@ mock.module("react-native", () => ({
|
|
|
12
13
|
},
|
|
13
14
|
}));
|
|
14
15
|
|
|
15
|
-
// Import after mock
|
|
16
|
-
const { ForceUpdateClient, IdentifyVersionStatusEnum } = await import("./force-update.client");
|
|
17
16
|
type IdentifyState = import("../identity").IdentifyState;
|
|
18
17
|
type IdentifyStateChangeEvents = import("../identity").IdentifyStateChangeEvents;
|
|
19
18
|
type VersionStatus = import("./force-update.client").VersionStatus;
|
|
@@ -52,10 +51,10 @@ function createMockIdentityClient() {
|
|
|
52
51
|
function createMockLoggingClient() {
|
|
53
52
|
return {
|
|
54
53
|
createLogger: () => ({
|
|
55
|
-
info: () => {},
|
|
56
|
-
warn: () => {},
|
|
57
|
-
error: () => {},
|
|
58
|
-
debug: () => {},
|
|
54
|
+
info: () => { },
|
|
55
|
+
warn: () => { },
|
|
56
|
+
error: () => { },
|
|
57
|
+
debug: () => { },
|
|
59
58
|
}),
|
|
60
59
|
};
|
|
61
60
|
}
|
|
@@ -266,8 +265,8 @@ describe("ForceUpdateClient", () => {
|
|
|
266
265
|
[IdentifyVersionStatusEnum.UP_TO_DATE, "up_to_date"],
|
|
267
266
|
[IdentifyVersionStatusEnum.UPDATE_AVAILABLE, "update_available"],
|
|
268
267
|
[IdentifyVersionStatusEnum.UPDATE_REQUIRED, "update_required"],
|
|
269
|
-
[IdentifyVersionStatusEnum.UPDATE_RECOMMENDED, "
|
|
270
|
-
[IdentifyVersionStatusEnum.DISABLED, "
|
|
268
|
+
[IdentifyVersionStatusEnum.UPDATE_RECOMMENDED, "update_recommended"],
|
|
269
|
+
[IdentifyVersionStatusEnum.DISABLED, "disabled"],
|
|
271
270
|
])("maps %s to %s", (apiStatus, expectedType) => {
|
|
272
271
|
const mockIdentity = createMockIdentityClient();
|
|
273
272
|
const mockLogging = createMockLoggingClient();
|
|
@@ -184,6 +184,11 @@ export class IdentityClient {
|
|
|
184
184
|
return this.tryCatch(async () => {
|
|
185
185
|
const deviceId = await this.device.getDeviceId();
|
|
186
186
|
const deviceInfo = await this.device.getDeviceInfo();
|
|
187
|
+
console.log("this.api.apiKey", this.api.apiKey);
|
|
188
|
+
console.log("this.api.orgId", this.api.orgId);
|
|
189
|
+
console.log("this.api.projectId", this.api.projectId);
|
|
190
|
+
console.log("this.api.environmentSlug", this.api.environmentSlug);
|
|
191
|
+
console.log("this.api.deviceId", deviceId);
|
|
187
192
|
const response = await this.api.client("/v1/identify", {
|
|
188
193
|
method: "POST",
|
|
189
194
|
headers: {
|
|
@@ -208,6 +213,7 @@ export class IdentityClient {
|
|
|
208
213
|
});
|
|
209
214
|
|
|
210
215
|
if (response.error != null) {
|
|
216
|
+
console.log("identify error", response.error.status, response.error.value);
|
|
211
217
|
this.setIdentifyState(previousState);
|
|
212
218
|
|
|
213
219
|
if (response.error.status === 422) {
|