@getuserfeedback/react-native 5.6.0 → 5.7.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.
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { AppEventExternalId, PublicCommandPayload } from "@getuserfeedback/protocol";
2
- import type { ActionRegistration, CapabilitiesInput, ConfigureOptions, EventOptions, EventProperties, GraphOperations, InitOptions, OpenRequestedCallback } from "@getuserfeedback/sdk";
2
+ import type { ActionRegistration, CapabilitiesInput, ConfigureOptions, EventOptions, EventProperties, FlagsInput, GraphOperations, InitOptions, OpenRequestedCallback } from "@getuserfeedback/sdk";
3
3
  export type { EventOptions, EventProperties, OpenRequestedCallback, OpenRequestedEvent, TrackOptions, } from "@getuserfeedback/sdk";
4
4
  type IdentifyTraits = Record<string, unknown>;
5
5
  type OpenCommand = Extract<PublicCommandPayload, {
@@ -28,11 +28,13 @@ export type NativeActionRegistration = Extract<ActionRegistration, {
28
28
  kind: "custom";
29
29
  }>;
30
30
  /** React Native provider initialization options. */
31
- export type ClientOptions = Omit<InitOptions, "capabilities" | "clientMeta" | "hostActions" | "hostCapabilities" | "runtimeEndpoints"> & {
31
+ export type ClientOptions = Omit<InitOptions, "capabilities" | "clientMeta" | "flags" | "hostActions" | "hostCapabilities" | "runtimeEndpoints"> & {
32
32
  /** Widget actions implemented by the current app version. */
33
33
  actions?: NativeActionRegistration[] | undefined;
34
34
  /** Capabilities supported by the current app version. */
35
35
  capabilities?: CapabilitiesInput | undefined;
36
+ /** Feature flag evaluations supplied during initialization. */
37
+ flags?: FlagsInput | undefined;
36
38
  /**
37
39
  * @deprecated Omit this option. The provider stamps canonical React Native
38
40
  * client metadata.
@@ -107,8 +109,15 @@ export interface Client {
107
109
  onOpenRequested: (callback: OpenRequestedCallback) => () => void;
108
110
  /** Resets widget state, authentication, and the current user identity. */
109
111
  reset: (options?: CommandOptions) => Promise<void>;
110
- /** Updates app navigation and environment context used by targeting. */
112
+ /**
113
+ * Updates current-route and host-supplied targeting context. URL and page
114
+ * fields can enrich events and consent-gated telemetry; `env` and `storage`
115
+ * are local-targeting inputs only.
116
+ */
111
117
  updateHostContext: (context: HostContext, options?: CommandOptions) => Promise<void>;
112
- /** Emits a named app signal into the widget runtime. */
118
+ /**
119
+ * Emits an ephemeral signal for local engagement targeting. This does not
120
+ * persist a customer occurrence; use `track()` or `screen()` for that.
121
+ */
113
122
  emitHostSignal: (name: string, data?: unknown, options?: CommandOptions) => Promise<void>;
114
123
  }
@@ -57,9 +57,21 @@ const useNativeActionRegistry = (actions) => {
57
57
  const getHandler = useCallback((definition) => { var _a; return (_a = registryRef.current) === null || _a === void 0 ? void 0 : _a.getHandler(definition); }, []);
58
58
  return { definitions: nextRegistry.listDefinitions(), getHandler };
59
59
  };
60
+ const toInitFlags = (flags) => {
61
+ if (flags === undefined) {
62
+ return undefined;
63
+ }
64
+ const normalizedFlags = Array.isArray(flags)
65
+ ? flags.map((flag) => (Object.assign({}, flag)))
66
+ : Object.entries(flags)
67
+ .sort(([leftKey], [rightKey]) => leftKey.localeCompare(rightKey))
68
+ .map(([key, value]) => ({ key, value }));
69
+ return normalizedFlags.length === 0 ? undefined : normalizedFlags;
70
+ };
60
71
  const parseNativeInitOptions = (_a, hostActions) => {
61
- var { actions: _actions, capabilities } = _a, clientOptions = __rest(_a, ["actions", "capabilities"]);
62
- const initOptions = parseInitOptions(Object.assign(Object.assign(Object.assign({}, clientOptions), (hostActions !== undefined && hostActions.length > 0
72
+ var { actions: _actions, capabilities, flags } = _a, clientOptions = __rest(_a, ["actions", "capabilities", "flags"]);
73
+ const normalizedFlags = toInitFlags(flags);
74
+ const initOptions = parseInitOptions(Object.assign(Object.assign(Object.assign(Object.assign({}, clientOptions), (normalizedFlags === undefined ? {} : { flags: normalizedFlags })), (hostActions !== undefined && hostActions.length > 0
63
75
  ? { hostActions }
64
76
  : {})), (capabilities !== undefined
65
77
  ? {
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.6.0";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "5.7.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "getuserfeedback React Native SDK",
5
5
  "keywords": [
6
6
  "getuserfeedback",