@getuserfeedback/react-native 3.0.75 → 3.0.77
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/native-core-command-channel.d.ts +0 -2
- package/dist/native-core-command-channel.js +1 -29
- package/dist/native-core-command-session.d.ts +0 -2
- package/dist/native-core-command-session.js +0 -17
- package/dist/native-direct-command-session.d.ts +2 -7
- package/dist/native-direct-command-session.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type CoreCommandEnvelope } from "@getuserfeedback/protocol";
|
|
2
|
-
import { type EventHandleInvalidated } from "@getuserfeedback/protocol/internal/core-handle-invalidation";
|
|
3
2
|
import { type EventCommandSettled } from "@getuserfeedback/protocol/internal/core-host-command-settlement";
|
|
4
3
|
import type { CoreWebViewHostConnection } from "./core-webview-host-controller.js";
|
|
5
4
|
export type NativeCoreCommandChannel = {
|
|
6
5
|
post: (envelope: CoreCommandEnvelope) => void;
|
|
7
6
|
subscribe: (listener: (message: EventCommandSettled) => void) => () => void;
|
|
8
|
-
subscribeHandleInvalidated: (listener: (message: EventHandleInvalidated) => void) => () => void;
|
|
9
7
|
};
|
|
10
8
|
type OwnedNativeCoreCommandChannel = {
|
|
11
9
|
channel: NativeCoreCommandChannel;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { coreCommandEnvelopeSchema, } from "@getuserfeedback/protocol";
|
|
2
|
-
import { eventHandleInvalidatedSchema, } from "@getuserfeedback/protocol/internal/core-handle-invalidation";
|
|
3
2
|
import { eventCommandSettledSchema, } from "@getuserfeedback/protocol/internal/core-host-command-settlement";
|
|
4
3
|
const DISPOSED_MESSAGE = "Core command channel is disposed";
|
|
5
4
|
const isRecord = (value) => typeof value === "object" && value !== null;
|
|
6
5
|
export function createNativeCoreCommandChannel(input) {
|
|
7
6
|
const listeners = new Set();
|
|
8
|
-
const handleInvalidatedListeners = new Set();
|
|
9
7
|
let disposed = false;
|
|
10
8
|
const handleMessage = (value) => {
|
|
11
|
-
var _a
|
|
9
|
+
var _a;
|
|
12
10
|
if (disposed || !isRecord(value)) {
|
|
13
11
|
return;
|
|
14
12
|
}
|
|
@@ -28,22 +26,6 @@ export function createNativeCoreCommandChannel(input) {
|
|
|
28
26
|
}
|
|
29
27
|
return;
|
|
30
28
|
}
|
|
31
|
-
if (value.t !== "getuserfeedback:event:handleInvalidated") {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const parsed = eventHandleInvalidatedSchema.safeParse(value);
|
|
35
|
-
if (!parsed.success) {
|
|
36
|
-
(_b = input.onInvalidMessage) === null || _b === void 0 ? void 0 : _b.call(input, parsed.error instanceof Error
|
|
37
|
-
? parsed.error
|
|
38
|
-
: new Error("Invalid core handle invalidation message"), value);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (parsed.data.gen !== input.coreConnection.generation) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
for (const listener of [...handleInvalidatedListeners]) {
|
|
45
|
-
listener(parsed.data);
|
|
46
|
-
}
|
|
47
29
|
};
|
|
48
30
|
const unsubscribeTransport = input.coreConnection.transport.subscribe(handleMessage);
|
|
49
31
|
const channel = {
|
|
@@ -63,15 +45,6 @@ export function createNativeCoreCommandChannel(input) {
|
|
|
63
45
|
listeners.delete(listener);
|
|
64
46
|
};
|
|
65
47
|
},
|
|
66
|
-
subscribeHandleInvalidated: (listener) => {
|
|
67
|
-
if (disposed) {
|
|
68
|
-
return () => { };
|
|
69
|
-
}
|
|
70
|
-
handleInvalidatedListeners.add(listener);
|
|
71
|
-
return () => {
|
|
72
|
-
handleInvalidatedListeners.delete(listener);
|
|
73
|
-
};
|
|
74
|
-
},
|
|
75
48
|
};
|
|
76
49
|
return {
|
|
77
50
|
channel,
|
|
@@ -82,7 +55,6 @@ export function createNativeCoreCommandChannel(input) {
|
|
|
82
55
|
disposed = true;
|
|
83
56
|
unsubscribeTransport();
|
|
84
57
|
listeners.clear();
|
|
85
|
-
handleInvalidatedListeners.clear();
|
|
86
58
|
},
|
|
87
59
|
};
|
|
88
60
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { type CoreCommandEnvelope } from "@getuserfeedback/protocol";
|
|
2
2
|
import { type CommandSettledDetail } from "@getuserfeedback/protocol/host";
|
|
3
|
-
import type { EventHandleInvalidated } from "@getuserfeedback/protocol/internal/core-handle-invalidation";
|
|
4
3
|
import type { NativeCoreCommandChannel } from "./native-core-command-channel.js";
|
|
5
4
|
export type NativeCoreCommandSession = {
|
|
6
5
|
dispatch: (envelope: CoreCommandEnvelope) => Promise<CommandSettledDetail>;
|
|
7
|
-
subscribeHandleInvalidated: (listener: (message: EventHandleInvalidated) => void) => () => void;
|
|
8
6
|
};
|
|
9
7
|
type NativeCoreCommandSessionOwner = {
|
|
10
8
|
dispose: () => void;
|
|
@@ -24,7 +24,6 @@ function toCommandSettledDetail(settlement) {
|
|
|
24
24
|
export function createNativeCoreCommandSession(input) {
|
|
25
25
|
const pendingCommands = createPendingCommandTracker();
|
|
26
26
|
const pendingIdentityByRequestId = new Map();
|
|
27
|
-
const handleInvalidatedListeners = new Set();
|
|
28
27
|
let disposed = false;
|
|
29
28
|
const unsubscribeSettlements = input.channel.subscribe((settlement) => {
|
|
30
29
|
const detail = toCommandSettledDetail(settlement);
|
|
@@ -41,11 +40,6 @@ export function createNativeCoreCommandSession(input) {
|
|
|
41
40
|
}
|
|
42
41
|
pendingCommands.reject(detail.requestId, toCommandSettlementError(detail));
|
|
43
42
|
});
|
|
44
|
-
const unsubscribeHandleInvalidated = input.channel.subscribeHandleInvalidated((message) => {
|
|
45
|
-
for (const listener of [...handleInvalidatedListeners]) {
|
|
46
|
-
listener(message);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
43
|
return {
|
|
50
44
|
session: {
|
|
51
45
|
dispatch: async (envelope) => {
|
|
@@ -67,15 +61,6 @@ export function createNativeCoreCommandSession(input) {
|
|
|
67
61
|
}
|
|
68
62
|
return settlement;
|
|
69
63
|
},
|
|
70
|
-
subscribeHandleInvalidated: (listener) => {
|
|
71
|
-
if (disposed) {
|
|
72
|
-
return () => { };
|
|
73
|
-
}
|
|
74
|
-
handleInvalidatedListeners.add(listener);
|
|
75
|
-
return () => {
|
|
76
|
-
handleInvalidatedListeners.delete(listener);
|
|
77
|
-
};
|
|
78
|
-
},
|
|
79
64
|
},
|
|
80
65
|
dispose: () => {
|
|
81
66
|
if (disposed) {
|
|
@@ -83,8 +68,6 @@ export function createNativeCoreCommandSession(input) {
|
|
|
83
68
|
}
|
|
84
69
|
disposed = true;
|
|
85
70
|
unsubscribeSettlements();
|
|
86
|
-
unsubscribeHandleInvalidated();
|
|
87
|
-
handleInvalidatedListeners.clear();
|
|
88
71
|
pendingIdentityByRequestId.clear();
|
|
89
72
|
pendingCommands.reset((requestId) => new NativeCoreCommandSessionClosedError(requestId));
|
|
90
73
|
},
|
|
@@ -8,15 +8,10 @@ type NativeFlowAllocationCommand = (Omit<Extract<CoreTranslatablePublicCommandPa
|
|
|
8
8
|
}) | Extract<CoreTranslatablePublicCommandPayload, {
|
|
9
9
|
kind: "prefetch" | "prerender";
|
|
10
10
|
}>;
|
|
11
|
-
type NativeScopedCloseCommand = Extract<CoreTranslatablePublicCommandPayload, {
|
|
12
|
-
kind: "close";
|
|
13
|
-
}> & {
|
|
14
|
-
flowHandleId: string;
|
|
15
|
-
};
|
|
16
11
|
/** Public commands accepted by the direct native provider session. */
|
|
17
12
|
type NativeDirectCommandPayload = Exclude<CoreTranslatablePublicCommandPayload, {
|
|
18
|
-
kind: "init" | "open" | "prefetch" | "prerender" | "
|
|
19
|
-
}> | NativeFlowAllocationCommand
|
|
13
|
+
kind: "init" | "open" | "prefetch" | "prerender" | "reset";
|
|
14
|
+
}> | NativeFlowAllocationCommand;
|
|
20
15
|
/** Public command envelope accepted by the direct native provider session. */
|
|
21
16
|
export type NativeDirectCommandEnvelope = Omit<CommandEnvelopeWithInstanceId, "command"> & {
|
|
22
17
|
command: NativeDirectCommandPayload;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getFlowHandleFromSettlementDetail } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { toCoreCommandPayload, } from "@getuserfeedback/protocol/internal/public-core-command";
|
|
3
|
-
// TODO(migration): Route reset
|
|
3
|
+
// TODO(migration): Route reset and the public provider client through this core-ordered direct session.
|
|
4
4
|
// [from=native-core-ordered-command-session] [to=native-provider-direct-session] [scope=slice] [principle=core-owned-flow-lifecycle] [priority=high] [impact=high] [risk=high] [epic=runtime-neutral-view-host-orchestration] [epic_order=180]
|
|
5
5
|
export function createNativeDirectCommandSession(input) {
|
|
6
6
|
const dispatchToCore = (envelope, command) => {
|
package/dist/version.js
CHANGED
|
@@ -3,4 +3,4 @@ const reactNativeSdkVersion = typeof __GX_REACT_NATIVE_SDK_VERSION__ === "string
|
|
|
3
3
|
: "";
|
|
4
4
|
// Build scripts patch this fallback to the package version for published artifacts.
|
|
5
5
|
// Source-linked workspace usage keeps the local fallback.
|
|
6
|
-
export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.
|
|
6
|
+
export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "3.0.77";
|