@getuserfeedback/react-native 5.1.9 → 5.1.11

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/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AppEventExternalId, AppEventJsonValue, PublicCommandPayload } from "@getuserfeedback/protocol";
2
- import type { CapabilitiesInput, ConfigureOptions, GraphOperations, InitOptions } from "@getuserfeedback/sdk";
2
+ import type { CapabilitiesInput, ConfigureOptions, GraphOperations, InitOptions, TrackOptions } from "@getuserfeedback/sdk";
3
3
  type IdentifyTraits = Record<string, unknown>;
4
4
  type TrackProperties = Record<string, AppEventJsonValue>;
5
5
  type OpenCommand = Extract<PublicCommandPayload, {
@@ -11,9 +11,6 @@ type PrerenderCommand = Extract<PublicCommandPayload, {
11
11
  type IdentifyOptions = {
12
12
  externalIds?: AppEventExternalId[];
13
13
  };
14
- type TrackOptions = {
15
- externalIds?: AppEventExternalId[];
16
- };
17
14
  type OpenFlowOptions = Pick<OpenCommand, "hideCloseButton" | "metadata">;
18
15
  type PrerenderFlowOptions = Pick<PrerenderCommand, "hideCloseButton">;
19
16
  type HostContext = Extract<PublicCommandPayload, {
@@ -1,10 +1,9 @@
1
- import { appEventPayloadSchema, coreCommandEnvelopeSchema, } from "@getuserfeedback/protocol";
1
+ import { appEventPayloadSchema, coreCommandEnvelopeSchema, TRAFFIC_APP_EVENT_RPC_METHOD, TRAFFIC_TELEMETRY_RPC_METHOD, trafficTelemetryRpcParamsSchema, } from "@getuserfeedback/protocol";
2
2
  import { eventHandleInvalidatedSchema, } from "@getuserfeedback/protocol/internal/core-handle-invalidation";
3
3
  import { eventCommandSettledSchema, } from "@getuserfeedback/protocol/internal/core-host-command-settlement";
4
4
  import { CORE_SESSION_FAILED_CODE, eventCoreSessionFailedSchema, } from "@getuserfeedback/protocol/internal/core-session-failure";
5
5
  import { buildRpcResponse, rpcRequestSchema, } from "@getuserfeedback/protocol/internal/v3-rpc-messages";
6
6
  const DISPOSED_MESSAGE = "Core command channel is disposed";
7
- const TRAFFIC_APP_EVENT_RPC_METHOD = "traffic.appEvent";
8
7
  const isRecord = (value) => typeof value === "object" && value !== null;
9
8
  export function createNativeCoreCommandChannel(input) {
10
9
  const listeners = new Set();
@@ -17,20 +16,32 @@ export function createNativeCoreCommandChannel(input) {
17
16
  if (value.t === "getuserfeedback:rpc:request") {
18
17
  const parsed = rpcRequestSchema.safeParse(value);
19
18
  if (!parsed.success ||
20
- parsed.data.gen !== input.coreConnection.generation ||
21
- parsed.data.method !== TRAFFIC_APP_EVENT_RPC_METHOD) {
19
+ parsed.data.gen !== input.coreConnection.generation) {
20
+ return;
21
+ }
22
+ let result;
23
+ if (parsed.data.method === TRAFFIC_TELEMETRY_RPC_METHOD) {
24
+ const params = trafficTelemetryRpcParamsSchema.safeParse(parsed.data.params);
25
+ result = params.success
26
+ ? { allowed: true, envelope: params.data.envelope }
27
+ : { allowed: false };
28
+ }
29
+ else if (parsed.data.method === TRAFFIC_APP_EVENT_RPC_METHOD) {
30
+ const params = isRecord(parsed.data.params) ? parsed.data.params : null;
31
+ const instanceId = params && typeof params.instanceId === "string"
32
+ ? params.instanceId.trim()
33
+ : "";
34
+ const payload = params
35
+ ? appEventPayloadSchema.safeParse(params.payload)
36
+ : { success: false };
37
+ result =
38
+ instanceId.length > 0 && payload.success
39
+ ? { allowed: true, payload: payload.data }
40
+ : { allowed: false };
41
+ }
42
+ else {
22
43
  return;
23
44
  }
24
- const params = isRecord(parsed.data.params) ? parsed.data.params : null;
25
- const instanceId = params && typeof params.instanceId === "string"
26
- ? params.instanceId.trim()
27
- : "";
28
- const payload = params
29
- ? appEventPayloadSchema.safeParse(params.payload)
30
- : { success: false };
31
- const result = instanceId.length > 0 && payload.success
32
- ? { allowed: true, payload: payload.data }
33
- : { allowed: false };
34
45
  try {
35
46
  input.coreConnection.transport.postMessage(buildRpcResponse({
36
47
  gen: parsed.data.gen,
@@ -1,4 +1,5 @@
1
1
  import { assertNoSegmentExternalIdsInValueArgument } from "@getuserfeedback/protocol/host";
2
+ import { parseTrackMessageId } from "@getuserfeedback/protocol/internal/sdk-event-options";
2
3
  export const parseRequiredString = (name, value) => {
3
4
  const normalized = value === null || value === void 0 ? void 0 : value.trim();
4
5
  if (!normalized) {
@@ -41,7 +42,8 @@ export function createNativeProviderClient({ dispatchCommand, flow, instanceId,
41
42
  valueArgumentName: "properties",
42
43
  callShape: "track(eventName, properties, { externalIds })",
43
44
  });
44
- return dispatchCommand(Object.assign(Object.assign({ kind: "track", origin: "customer", event: parseRequiredString("eventName", eventName) }, (properties === undefined ? {} : { properties })), ((options === null || options === void 0 ? void 0 : options.externalIds) === undefined
45
+ const messageId = parseTrackMessageId(options === null || options === void 0 ? void 0 : options.messageId);
46
+ return dispatchCommand(Object.assign(Object.assign(Object.assign({ kind: "track", origin: "customer", event: parseRequiredString("eventName", eventName) }, (properties === undefined ? {} : { properties })), (messageId === undefined ? {} : { messageId })), ((options === null || options === void 0 ? void 0 : options.externalIds) === undefined
45
47
  ? {}
46
48
  : { context: { externalIds: options.externalIds } })));
47
49
  };
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 : "5.1.9";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "5.1.11";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "5.1.9",
3
+ "version": "5.1.11",
4
4
  "description": "getuserfeedback React Native SDK",
5
5
  "keywords": [
6
6
  "getuserfeedback",
@@ -44,8 +44,8 @@
44
44
  "lint": "biome check ."
45
45
  },
46
46
  "dependencies": {
47
- "@getuserfeedback/protocol": "^5.0.1",
48
- "@getuserfeedback/sdk": "^0.13.7",
47
+ "@getuserfeedback/protocol": "^5.0.2",
48
+ "@getuserfeedback/sdk": "^0.13.9",
49
49
  "robot3": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {