@getuserfeedback/react-native 5.6.1 → 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.
@@ -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.1";
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.1",
3
+ "version": "5.7.0",
4
4
  "description": "getuserfeedback React Native SDK",
5
5
  "keywords": [
6
6
  "getuserfeedback",