@getuserfeedback/react-native 1.3.8 → 1.3.10

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/index.js CHANGED
@@ -16,7 +16,6 @@ import { useResolvedHostViewport } from "./host-viewport.js";
16
16
  import { toCommandFlowId, toCommandSettlementError, toRetryWithoutFlowHandle, } from "./provider-command-helpers.js";
17
17
  import { clearProviderFlowHandleCache, createProviderFlowHandleCache, deleteCachedProviderFlowHandleId, deleteCachedProviderFlowId, getCachedProviderFlowHandleId, snapshotProviderFlowCommand, writeSettledProviderFlowHandleId, } from "./provider-flow-handle-cache.js";
18
18
  import { enqueueProviderNativeMessage, removeProviderNativeMessageId, removeProviderNativeMessageIds, replaceProviderNativeMessages, } from "./provider-message-queue.js";
19
- import { applyProviderOverlayFlowState, applyProviderOverlayHandleInvalidated, createDefaultProviderOverlayState, DEFAULT_PROVIDER_OVERLAY_VISIBILITY, updateProviderOverlayReadySequence, } from "./provider-overlay-state.js";
20
19
  import { cancelProviderStartupCommands, clearProviderPendingCommands, createProviderPendingCommandRegistry, getProviderPendingCommand, getProviderPendingCommandEntries, getProviderPendingCommands, hasDeliveredProviderPendingCommands, isProviderPendingMessageStartup, registerProviderPendingCommand, reissueProviderPendingCommand, takeProviderPendingCommand, } from "./provider-pending-commands.js";
21
20
  import { ProviderWidgetHostOverlay, toProviderWidgetHostStyle, toProviderWidgetSheetHostViewport, } from "./provider-widget-host-overlay.js";
22
21
  import { REACT_NATIVE_SDK_VERSION } from "./version.js";
@@ -34,6 +33,12 @@ const CLIENT_META = {
34
33
  loader: "sdk",
35
34
  transport: "loader",
36
35
  };
36
+ const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY = {
37
+ hostSourceVersion: null,
38
+ isVisible: false,
39
+ readySequence: null,
40
+ sourceKey: null,
41
+ };
37
42
  const createUniqueId = (prefix) => {
38
43
  if (typeof globalThis.crypto !== "undefined" &&
39
44
  typeof globalThis.crypto.randomUUID === "function") {
@@ -71,14 +76,24 @@ const FallbackNativeView = (_a) => {
71
76
  var { children } = _a, props = __rest(_a, ["children"]);
72
77
  return createElement("div", props, children);
73
78
  };
74
- function resolveNativeView() {
75
- var _a;
79
+ const FallbackNativePressable = FallbackNativeView;
80
+ const FallbackNativeText = FallbackNativeView;
81
+ function resolveReactNativeComponents() {
82
+ var _a, _b, _c;
76
83
  try {
77
84
  const reactNativeModule = require("react-native");
78
- return (_a = reactNativeModule.View) !== null && _a !== void 0 ? _a : FallbackNativeView;
85
+ return {
86
+ Pressable: (_a = reactNativeModule.Pressable) !== null && _a !== void 0 ? _a : FallbackNativePressable,
87
+ Text: (_b = reactNativeModule.Text) !== null && _b !== void 0 ? _b : FallbackNativeText,
88
+ View: (_c = reactNativeModule.View) !== null && _c !== void 0 ? _c : FallbackNativeView,
89
+ };
79
90
  }
80
- catch (_b) {
81
- return FallbackNativeView;
91
+ catch (_d) {
92
+ return {
93
+ Pressable: FallbackNativePressable,
94
+ Text: FallbackNativeText,
95
+ View: FallbackNativeView,
96
+ };
82
97
  }
83
98
  }
84
99
  const toIdentifyCommandPayload = (identifyInput, traitsOrOptions, options) => {
@@ -110,16 +125,15 @@ const toIdentifyCommandPayload = (identifyInput, traitsOrOptions, options) => {
110
125
  };
111
126
  export function GetUserFeedbackProvider({ autoInit = true, children, commandTimeoutMs = DEFAULT_COMMAND_TIMEOUT_MS, configureOptions, hostViewport, instanceId: instanceIdProp, initOptions, loaderUrl, onCommandError, onInvalidWebMessage, onWebMessage, source, webViewComponent, webViewProps, }) {
112
127
  var _a, _b;
113
- const NativeView = useMemo(resolveNativeView, []);
128
+ const { Pressable: NativePressable, Text: NativeText, View: NativeView, } = useMemo(resolveReactNativeComponents, []);
114
129
  const [instanceId] = useState(() => { var _a; return (_a = normalizeOptionalString(instanceIdProp)) !== null && _a !== void 0 ? _a : createUniqueId("rn"); });
115
130
  const [nativeMessages, setNativeMessages] = useState([]);
116
- const [widgetHostVisibility, setWidgetHostVisibility] = useState(DEFAULT_PROVIDER_OVERLAY_VISIBILITY);
131
+ const [widgetHostVisibility, setWidgetHostVisibility] = useState(HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY);
117
132
  const resolvedHostViewport = useResolvedHostViewport(hostViewport);
118
133
  const nativeMessagesRef = useRef([]);
119
134
  const pendingCommandsRef = useRef(createProviderPendingCommandRegistry());
120
135
  const hostEpochRef = useRef(0);
121
136
  const flowHandleCacheRef = useRef(createProviderFlowHandleCache());
122
- const providerOverlayStateRef = useRef(createDefaultProviderOverlayState());
123
137
  const initOptionsRef = useRef(initOptions);
124
138
  const configureOptionsRef = useRef(configureOptions);
125
139
  const initOptionsKey = useMemo(() => toJsonKey(initOptions), [initOptions]);
@@ -145,7 +159,6 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
145
159
  lastReadyRef.current = null;
146
160
  startupQueuedKeyRef.current = null;
147
161
  clearProviderFlowHandleCache(flowHandleCacheRef.current);
148
- providerOverlayStateRef.current = createDefaultProviderOverlayState();
149
162
  }
150
163
  initOptionsRef.current = initOptions;
151
164
  configureOptionsRef.current = configureOptions;
@@ -357,16 +370,14 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
357
370
  didReissueDeliveredCommands = reissueDeliveredPendingActionCommands();
358
371
  }
359
372
  lastReadyRef.current = Object.assign(Object.assign({}, event), { hostEpoch: hostEpochRef.current });
360
- const nextVisibility = updateProviderOverlayReadySequence({
361
- ready: {
362
- hostSourceVersion: hostSourceVersionRef.current,
363
- readySequence: event.readySequence,
364
- sourceKey: event.sourceKey,
365
- },
366
- visibility: providerOverlayStateRef.current.visibility,
373
+ setWidgetHostVisibility((visibility) => {
374
+ if (!visibility.isVisible ||
375
+ visibility.sourceKey !== event.sourceKey ||
376
+ visibility.hostSourceVersion !== hostSourceVersionRef.current) {
377
+ return visibility;
378
+ }
379
+ return Object.assign(Object.assign({}, visibility), { readySequence: event.readySequence });
367
380
  });
368
- providerOverlayStateRef.current = Object.assign(Object.assign({}, providerOverlayStateRef.current), { visibility: nextVisibility });
369
- setWidgetHostVisibility(nextVisibility);
370
381
  enqueueStartupCommands({ force: previous !== null });
371
382
  startPendingCommandTimeouts();
372
383
  return didReissueDeliveredCommands;
@@ -392,8 +403,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
392
403
  reissueDeliveredPendingActionCommands();
393
404
  }
394
405
  lastReadyRef.current = null;
395
- providerOverlayStateRef.current = createDefaultProviderOverlayState();
396
- setWidgetHostVisibility(providerOverlayStateRef.current.visibility);
406
+ setWidgetHostVisibility(HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY);
397
407
  pausePendingCommandTimeouts();
398
408
  }, [
399
409
  handleWidgetReady,
@@ -405,14 +415,10 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
405
415
  }, []);
406
416
  const handleFlowHandleInvalidated = useCallback((flowHandleId) => {
407
417
  deleteCachedFlowHandleId(flowHandleId);
408
- const nextState = applyProviderOverlayHandleInvalidated({
409
- flowHandleId,
410
- state: providerOverlayStateRef.current,
411
- });
412
- providerOverlayStateRef.current = nextState;
413
- setWidgetHostVisibility(nextState.visibility);
418
+ setWidgetHostVisibility((visibility) => visibility.flowHandleId === flowHandleId
419
+ ? Object.assign(Object.assign({}, visibility), { flowHandleId: undefined }) : visibility);
414
420
  }, [deleteCachedFlowHandleId]);
415
- const handleFlowStateChanged = useCallback((detail, options) => {
421
+ const handleInstanceFlowStateChanged = useCallback((detail) => {
416
422
  if (detail.instanceId !== instanceId) {
417
423
  return;
418
424
  }
@@ -420,32 +426,25 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
420
426
  if (!readyState) {
421
427
  return;
422
428
  }
423
- const nextState = applyProviderOverlayFlowState({
424
- detail,
425
- origin: options.origin,
426
- ready: {
427
- hostSourceVersion: hostSourceVersionRef.current,
428
- readySequence: readyState.readySequence,
429
- sourceKey: readyState.sourceKey,
430
- },
431
- state: providerOverlayStateRef.current,
429
+ const isVisible = detail.isOpen || detail.isLoading;
430
+ setWidgetHostVisibility({
431
+ flowHandleId: detail.flowHandleId,
432
+ hostSourceVersion: hostSourceVersionRef.current,
433
+ isVisible,
434
+ readySequence: readyState.readySequence,
435
+ sourceKey: readyState.sourceKey,
432
436
  });
433
- providerOverlayStateRef.current = nextState;
434
- setWidgetHostVisibility(nextState.visibility);
435
437
  }, [instanceId]);
436
438
  const handleWebMessage = useCallback((message) => {
437
439
  var _a;
438
440
  if (message.kind === "hostEvent" &&
439
- message.event.name === "instance:handle:invalidated") {
441
+ message.event.name === "instance:handle:invalidated" &&
442
+ message.event.detail.handleKind === "flow") {
440
443
  handleFlowHandleInvalidated(message.event.detail.handleId);
441
444
  }
442
- if (message.kind === "hostEvent" &&
443
- message.event.name === "instance:flow:state-changed") {
444
- handleFlowStateChanged(message.event.detail, { origin: "handle" });
445
- }
446
445
  if (message.kind === "hostEvent" &&
447
446
  message.event.name === "instance:flow:state-changed:instance") {
448
- handleFlowStateChanged(message.event.detail, { origin: "aggregate" });
447
+ handleInstanceFlowStateChanged(message.event.detail);
449
448
  }
450
449
  if (message.kind === "hostEvent" &&
451
450
  message.event.name === "instance:command:settled") {
@@ -502,7 +501,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
502
501
  onWebMessage === null || onWebMessage === void 0 ? void 0 : onWebMessage(message);
503
502
  }, [
504
503
  enqueueTransportCommand,
505
- handleFlowStateChanged,
504
+ handleInstanceFlowStateChanged,
506
505
  handleFlowHandleInvalidated,
507
506
  onWebMessage,
508
507
  ]);
@@ -520,8 +519,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
520
519
  return;
521
520
  }
522
521
  visibilitySourceKeyRef.current = hostSourceKey;
523
- providerOverlayStateRef.current = createDefaultProviderOverlayState();
524
- setWidgetHostVisibility(providerOverlayStateRef.current.visibility);
522
+ setWidgetHostVisibility(HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY);
525
523
  }, [hostSourceKey]);
526
524
  const contextValue = useMemo(() => ({
527
525
  instanceId,
@@ -608,11 +606,20 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
608
606
  webViewComponent,
609
607
  webViewProps: Object.assign(Object.assign({}, webViewProps), { pointerEvents: isWidgetHostVisible ? "auto" : "none", style: composedWebViewStyle }),
610
608
  });
609
+ const handleWidgetHostClose = useCallback(() => {
610
+ enqueueCommand(Object.assign({ kind: "close" }, (widgetHostVisibility.flowHandleId === undefined
611
+ ? {}
612
+ : { flowHandleId: widgetHostVisibility.flowHandleId }))).catch(reportCommandError);
613
+ }, [enqueueCommand, reportCommandError, widgetHostVisibility.flowHandleId]);
611
614
  return createElement(GetUserFeedbackNativeContext.Provider, {
612
615
  value: contextValue,
613
616
  }, children, createElement(ProviderWidgetHostOverlay, {
614
617
  isVisible: isWidgetHostVisible,
618
+ isCloseVisible: true,
619
+ nativePressable: NativePressable,
620
+ nativeText: NativeText,
615
621
  nativeView: NativeView,
622
+ onRequestClose: handleWidgetHostClose,
616
623
  sheetHostViewport,
617
624
  }, widgetHost));
618
625
  }
@@ -1,15 +1,21 @@
1
1
  import { type ComponentType, type ReactElement, type ReactNode } from "react";
2
2
  import type { WidgetHostProps } from "./widget-host.js";
3
3
  type NativeViewComponent = ComponentType<Record<string, unknown>>;
4
+ type NativePressableComponent = ComponentType<Record<string, unknown>>;
5
+ type NativeTextComponent = ComponentType<Record<string, unknown>>;
4
6
  export declare function toProviderWidgetSheetHostViewport(viewport: WidgetHostProps["hostViewport"]): WidgetHostProps["hostViewport"];
5
7
  export declare function toProviderWidgetHostStyle({ isVisible, webViewStyle, }: {
6
8
  isVisible: boolean;
7
9
  webViewStyle: unknown;
8
10
  }): unknown;
9
- export declare function ProviderWidgetHostOverlay({ children, isVisible, nativeView, sheetHostViewport, }: {
11
+ export declare function ProviderWidgetHostOverlay({ children, isVisible, isCloseVisible, nativeView, nativePressable, nativeText, onRequestClose, sheetHostViewport, }: {
10
12
  children?: ReactNode;
13
+ isCloseVisible: boolean;
11
14
  isVisible: boolean;
15
+ nativePressable: NativePressableComponent;
16
+ nativeText: NativeTextComponent;
12
17
  nativeView: NativeViewComponent;
18
+ onRequestClose: () => void;
13
19
  sheetHostViewport: WidgetHostProps["hostViewport"];
14
20
  }): ReactElement;
15
21
  export {};
@@ -38,6 +38,23 @@ const WIDGET_SHEET_STYLE = {
38
38
  shadowRadius: 18,
39
39
  elevation: 18,
40
40
  };
41
+ const WIDGET_SHEET_CLOSE_STYLE = {
42
+ alignItems: "center",
43
+ backgroundColor: "rgba(15, 23, 42, 0.08)",
44
+ borderRadius: 18,
45
+ height: 36,
46
+ justifyContent: "center",
47
+ position: "absolute",
48
+ right: 12,
49
+ top: 12,
50
+ width: 72,
51
+ zIndex: 1,
52
+ };
53
+ const WIDGET_SHEET_CLOSE_TEXT_STYLE = {
54
+ color: "#0f172a",
55
+ fontSize: 14,
56
+ fontWeight: "600",
57
+ };
41
58
  const VISIBLE_WIDGET_HOST_STYLE = {
42
59
  flex: 1,
43
60
  };
@@ -115,7 +132,7 @@ export function toProviderWidgetHostStyle({ isVisible, webViewStyle, }) {
115
132
  ? [visiblePresentationStyle, VISIBLE_WIDGET_HOST_STYLE]
116
133
  : VISIBLE_WIDGET_HOST_STYLE;
117
134
  }
118
- export function ProviderWidgetHostOverlay({ children, isVisible, nativeView, sheetHostViewport, }) {
135
+ export function ProviderWidgetHostOverlay({ children, isVisible, isCloseVisible, nativeView, nativePressable, nativeText, onRequestClose, sheetHostViewport, }) {
119
136
  const widgetSheetStyle = sheetHostViewport
120
137
  ? Object.assign(Object.assign({}, WIDGET_SHEET_STYLE), { height: sheetHostViewport.height }) : Object.assign(Object.assign({}, WIDGET_SHEET_STYLE), { height: "86%" });
121
138
  const pointerEvents = isVisible ? "auto" : "none";
@@ -131,5 +148,15 @@ export function ProviderWidgetHostOverlay({ children, isVisible, nativeView, she
131
148
  pointerEvents,
132
149
  style: isVisible ? widgetSheetStyle : HIDDEN_WIDGET_HOST_STYLE,
133
150
  testID: "gx-widget-host-sheet",
134
- }, children));
151
+ }, children, isVisible && isCloseVisible
152
+ ? createElement(nativePressable, {
153
+ accessibilityLabel: "Close widget",
154
+ accessibilityRole: "button",
155
+ onPress: onRequestClose,
156
+ style: WIDGET_SHEET_CLOSE_STYLE,
157
+ testID: "gx-widget-host-close",
158
+ }, createElement(nativeText, {
159
+ style: WIDGET_SHEET_CLOSE_TEXT_STYLE,
160
+ }, "Close"))
161
+ : null));
135
162
  }
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 : "1.3.8";
6
+ export const REACT_NATIVE_SDK_VERSION = reactNativeSdkVersion.length > 0 ? reactNativeSdkVersion : "1.3.10";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getuserfeedback/react-native",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "getuserfeedback React Native SDK",
5
5
  "keywords": [
6
6
  "getuserfeedback",
@@ -44,8 +44,8 @@
44
44
  "lint": "ultracite check ."
45
45
  },
46
46
  "dependencies": {
47
- "@getuserfeedback/protocol": "^1.3.0",
48
- "@getuserfeedback/sdk": "^0.7.1",
47
+ "@getuserfeedback/protocol": "^1.4.0",
48
+ "@getuserfeedback/sdk": "^0.7.3",
49
49
  "robot3": "^1.2.0"
50
50
  },
51
51
  "peerDependencies": {
@@ -1,43 +0,0 @@
1
- export type ProviderOverlayVisibilityOrigin = "aggregate" | "handle";
2
- export type ProviderOverlayVisibility = {
3
- flowHandleId: string | null;
4
- hostSourceVersion: number | null;
5
- isVisible: boolean;
6
- origin: ProviderOverlayVisibilityOrigin | null;
7
- readySequence: number | null;
8
- sourceKey: string | null;
9
- };
10
- export type ProviderOverlayReadyIdentity = {
11
- hostSourceVersion: number;
12
- readySequence: number;
13
- sourceKey: string;
14
- };
15
- export type ProviderOverlayFlowStateDetail = {
16
- flowHandleId?: string;
17
- isLoading: boolean;
18
- isOpen: boolean;
19
- };
20
- export type ProviderOverlayState = {
21
- visibility: ProviderOverlayVisibility;
22
- visibleFlowHandleIds: Set<string>;
23
- };
24
- export type ProviderOverlayStateInput = {
25
- visibility: ProviderOverlayVisibility;
26
- visibleFlowHandleIds: ReadonlySet<string>;
27
- };
28
- export declare const DEFAULT_PROVIDER_OVERLAY_VISIBILITY: ProviderOverlayVisibility;
29
- export declare const createDefaultProviderOverlayState: () => ProviderOverlayState;
30
- export declare function updateProviderOverlayReadySequence({ ready, visibility, }: {
31
- ready: ProviderOverlayReadyIdentity;
32
- visibility: ProviderOverlayVisibility;
33
- }): ProviderOverlayVisibility;
34
- export declare function applyProviderOverlayFlowState({ detail, origin, ready, state, }: {
35
- detail: ProviderOverlayFlowStateDetail;
36
- origin: ProviderOverlayVisibilityOrigin;
37
- ready: ProviderOverlayReadyIdentity;
38
- state: ProviderOverlayStateInput;
39
- }): ProviderOverlayState;
40
- export declare function applyProviderOverlayHandleInvalidated({ flowHandleId, state, }: {
41
- flowHandleId: string;
42
- state: ProviderOverlayStateInput;
43
- }): ProviderOverlayState;
@@ -1,134 +0,0 @@
1
- export const DEFAULT_PROVIDER_OVERLAY_VISIBILITY = {
2
- flowHandleId: null,
3
- hostSourceVersion: null,
4
- isVisible: false,
5
- origin: null,
6
- readySequence: null,
7
- sourceKey: null,
8
- };
9
- export const createDefaultProviderOverlayState = () => ({
10
- visibility: DEFAULT_PROVIDER_OVERLAY_VISIBILITY,
11
- visibleFlowHandleIds: new Set(),
12
- });
13
- const toVisibleProviderOverlayVisibility = ({ flowHandleId, origin, ready, }) => ({
14
- flowHandleId,
15
- hostSourceVersion: ready.hostSourceVersion,
16
- isVisible: true,
17
- origin,
18
- readySequence: ready.readySequence,
19
- sourceKey: ready.sourceKey,
20
- });
21
- const toHiddenProviderOverlayVisibility = (visibility) => ({
22
- flowHandleId: null,
23
- hostSourceVersion: visibility.hostSourceVersion,
24
- isVisible: false,
25
- origin: null,
26
- readySequence: visibility.readySequence,
27
- sourceKey: visibility.sourceKey,
28
- });
29
- const isVisibilityForReadyIdentity = (visibility, ready) => visibility.hostSourceVersion === ready.hostSourceVersion &&
30
- visibility.readySequence === ready.readySequence &&
31
- visibility.sourceKey === ready.sourceKey;
32
- export function updateProviderOverlayReadySequence({ ready, visibility, }) {
33
- if (!visibility.isVisible ||
34
- visibility.sourceKey !== ready.sourceKey ||
35
- visibility.hostSourceVersion !== ready.hostSourceVersion) {
36
- return visibility;
37
- }
38
- return Object.assign(Object.assign({}, visibility), { readySequence: ready.readySequence });
39
- }
40
- export function applyProviderOverlayFlowState({ detail, origin, ready, state, }) {
41
- var _a;
42
- const isVisible = detail.isOpen || detail.isLoading;
43
- const visibleFlowHandleIds = new Set(state.visibleFlowHandleIds);
44
- if (origin === "aggregate") {
45
- if (isVisible) {
46
- visibleFlowHandleIds.clear();
47
- return {
48
- visibleFlowHandleIds,
49
- visibility: toVisibleProviderOverlayVisibility({
50
- flowHandleId: null,
51
- origin,
52
- ready,
53
- }),
54
- };
55
- }
56
- if (visibleFlowHandleIds.size > 0) {
57
- return {
58
- visibleFlowHandleIds,
59
- visibility: toVisibleProviderOverlayVisibility({
60
- flowHandleId: (_a = visibleFlowHandleIds.values().next().value) !== null && _a !== void 0 ? _a : null,
61
- origin: "handle",
62
- ready,
63
- }),
64
- };
65
- }
66
- return {
67
- visibleFlowHandleIds,
68
- visibility: {
69
- flowHandleId: null,
70
- hostSourceVersion: ready.hostSourceVersion,
71
- isVisible: false,
72
- origin,
73
- readySequence: ready.readySequence,
74
- sourceKey: ready.sourceKey,
75
- },
76
- };
77
- }
78
- if (detail.flowHandleId === undefined) {
79
- return {
80
- visibleFlowHandleIds,
81
- visibility: state.visibility,
82
- };
83
- }
84
- if (isVisible) {
85
- visibleFlowHandleIds.add(detail.flowHandleId);
86
- if (state.visibility.isVisible &&
87
- state.visibility.origin === "aggregate" &&
88
- isVisibilityForReadyIdentity(state.visibility, ready)) {
89
- return {
90
- visibleFlowHandleIds,
91
- visibility: state.visibility,
92
- };
93
- }
94
- return {
95
- visibleFlowHandleIds,
96
- visibility: toVisibleProviderOverlayVisibility({
97
- flowHandleId: detail.flowHandleId,
98
- origin,
99
- ready,
100
- }),
101
- };
102
- }
103
- visibleFlowHandleIds.delete(detail.flowHandleId);
104
- if (visibleFlowHandleIds.size > 0) {
105
- return {
106
- visibleFlowHandleIds,
107
- visibility: state.visibility,
108
- };
109
- }
110
- if (state.visibility.origin !== "handle") {
111
- return {
112
- visibleFlowHandleIds,
113
- visibility: state.visibility,
114
- };
115
- }
116
- return {
117
- visibleFlowHandleIds,
118
- visibility: toHiddenProviderOverlayVisibility(state.visibility),
119
- };
120
- }
121
- export function applyProviderOverlayHandleInvalidated({ flowHandleId, state, }) {
122
- const visibleFlowHandleIds = new Set(state.visibleFlowHandleIds);
123
- visibleFlowHandleIds.delete(flowHandleId);
124
- if (visibleFlowHandleIds.size > 0 || state.visibility.origin !== "handle") {
125
- return {
126
- visibleFlowHandleIds,
127
- visibility: state.visibility,
128
- };
129
- }
130
- return {
131
- visibleFlowHandleIds,
132
- visibility: toHiddenProviderOverlayVisibility(state.visibility),
133
- };
134
- }