@getuserfeedback/react-native 3.0.66 → 3.0.67
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 +1 -0
- package/dist/provider-command-helpers.js +1 -0
- package/dist/provider-widget-host-lifecycle.d.ts +2 -1
- package/dist/provider-widget-host-lifecycle.js +19 -2
- package/dist/provider-widget-host-overlay.d.ts +13 -2
- package/dist/provider-widget-host-overlay.js +63 -16
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -689,6 +689,7 @@ export function GetUserFeedbackProvider({ autoInit = true, children, commandTime
|
|
|
689
689
|
onRequestDismiss: handleWidgetHostDismiss,
|
|
690
690
|
sheetHostLayoutUpdate,
|
|
691
691
|
transitionSequence: transitionPolicySequence,
|
|
692
|
+
transitionSchedule: widgetHostVisibility.transitionSchedule,
|
|
692
693
|
}, widgetHost));
|
|
693
694
|
}
|
|
694
695
|
export function useGetUserFeedbackNative() {
|
|
@@ -17,6 +17,7 @@ export const REACT_NATIVE_CLIENT_META = {
|
|
|
17
17
|
loader: "sdk",
|
|
18
18
|
protocolCapabilities: [
|
|
19
19
|
REACT_NATIVE_WEBVIEW_TRANSPORT_CAPABILITIES.LAYOUT_TRANSITION_POLICY,
|
|
20
|
+
REACT_NATIVE_WEBVIEW_TRANSPORT_CAPABILITIES.LAYOUT_TRANSITION_SCHEDULE,
|
|
20
21
|
],
|
|
21
22
|
};
|
|
22
23
|
export const REACT_NATIVE_LOADER_CLIENT_META = Object.assign(Object.assign({}, REACT_NATIVE_CLIENT_META), { transport: "loader" });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type InstanceViewHostSnapshotsChangedDetail, type ViewHostSnapshot, type WidgetFrameAppearance, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { type InstanceViewHostSnapshotsChangedDetail, type ViewHostSnapshot, type WidgetFrameAppearance, type WidgetLayoutTransitionPolicy, type WidgetLayoutTransitionSchedule } from "@getuserfeedback/protocol/host";
|
|
2
2
|
type ProviderWidgetHostReadyState = {
|
|
3
3
|
hostEpoch: number;
|
|
4
4
|
readySequence: number;
|
|
@@ -13,6 +13,7 @@ export type ProviderWidgetHostVisibility = {
|
|
|
13
13
|
readySequence: number | null;
|
|
14
14
|
sourceKey: string | null;
|
|
15
15
|
transitionPolicy?: WidgetLayoutTransitionPolicy;
|
|
16
|
+
transitionSchedule?: WidgetLayoutTransitionSchedule;
|
|
16
17
|
transitionPolicySequence?: number;
|
|
17
18
|
};
|
|
18
19
|
export declare const HIDDEN_PROVIDER_WIDGET_HOST_VISIBILITY: ProviderWidgetHostVisibility;
|
|
@@ -12,17 +12,26 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
12
12
|
let hostSourceVersion = 0;
|
|
13
13
|
let lastReady = null;
|
|
14
14
|
let transitionPolicySequence = 0;
|
|
15
|
+
let lastTransitionScheduleSequence;
|
|
15
16
|
const viewHostSnapshots = createActiveViewSnapshotListController();
|
|
16
17
|
let selectedViewHostSnapshot;
|
|
17
18
|
const toVisibility = (snapshot) => {
|
|
19
|
+
var _a;
|
|
18
20
|
if (lastReady === null) {
|
|
19
21
|
return null;
|
|
20
22
|
}
|
|
21
23
|
let nextTransitionPolicySequence;
|
|
22
|
-
|
|
24
|
+
const hasNewTransitionSchedule = snapshot.transitionSchedule !== undefined &&
|
|
25
|
+
(lastTransitionScheduleSequence === undefined ||
|
|
26
|
+
snapshot.transitionSchedule.sequence > lastTransitionScheduleSequence);
|
|
27
|
+
if (snapshot.transitionPolicy !== undefined &&
|
|
28
|
+
(snapshot.transitionSchedule === undefined || hasNewTransitionSchedule)) {
|
|
23
29
|
transitionPolicySequence += 1;
|
|
24
30
|
nextTransitionPolicySequence = transitionPolicySequence;
|
|
25
31
|
}
|
|
32
|
+
if (hasNewTransitionSchedule) {
|
|
33
|
+
lastTransitionScheduleSequence = (_a = snapshot.transitionSchedule) === null || _a === void 0 ? void 0 : _a.sequence;
|
|
34
|
+
}
|
|
26
35
|
return {
|
|
27
36
|
frameAppearance: snapshot.frameAppearance,
|
|
28
37
|
flowHeight: snapshot.height,
|
|
@@ -31,7 +40,12 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
31
40
|
isVisible: snapshot.shouldRender,
|
|
32
41
|
readySequence: lastReady.readySequence,
|
|
33
42
|
sourceKey: lastReady.sourceKey,
|
|
34
|
-
transitionPolicy:
|
|
43
|
+
transitionPolicy: nextTransitionPolicySequence === undefined
|
|
44
|
+
? undefined
|
|
45
|
+
: snapshot.transitionPolicy,
|
|
46
|
+
transitionSchedule: hasNewTransitionSchedule
|
|
47
|
+
? snapshot.transitionSchedule
|
|
48
|
+
: undefined,
|
|
35
49
|
transitionPolicySequence: nextTransitionPolicySequence,
|
|
36
50
|
};
|
|
37
51
|
};
|
|
@@ -53,6 +67,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
53
67
|
lastReady = null;
|
|
54
68
|
viewHostSnapshots.clear();
|
|
55
69
|
selectedViewHostSnapshot = undefined;
|
|
70
|
+
lastTransitionScheduleSequence = undefined;
|
|
56
71
|
return { wasReady };
|
|
57
72
|
},
|
|
58
73
|
markReady: (event, { hasDeliveredPendingCommands }) => {
|
|
@@ -71,6 +86,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
71
86
|
hostEpoch += 1;
|
|
72
87
|
viewHostSnapshots.clear();
|
|
73
88
|
selectedViewHostSnapshot = undefined;
|
|
89
|
+
lastTransitionScheduleSequence = undefined;
|
|
74
90
|
}
|
|
75
91
|
lastReady = Object.assign(Object.assign({}, event), { hostEpoch });
|
|
76
92
|
return {
|
|
@@ -107,6 +123,7 @@ export function createProviderWidgetHostLifecycleController(initialHostSourceKey
|
|
|
107
123
|
lastReady = null;
|
|
108
124
|
viewHostSnapshots.clear();
|
|
109
125
|
selectedViewHostSnapshot = undefined;
|
|
126
|
+
lastTransitionScheduleSequence = undefined;
|
|
110
127
|
return true;
|
|
111
128
|
},
|
|
112
129
|
toReadyVisibility: (visibility, event) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WidgetFrameAppearance, type WidgetLayoutComparableSizeUpdate, type WidgetLayoutSizeUpdate, type WidgetLayoutTimedCapableTransitionPlan, type WidgetLayoutTransitionPolicy } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { resolveWidgetLayoutTransitionExecution, type WidgetFrameAppearance, type WidgetLayoutComparableSizeUpdate, type WidgetLayoutSizeUpdate, type WidgetLayoutTimedCapableTransitionPlan, type WidgetLayoutTransitionPolicy, type WidgetLayoutTransitionSchedule } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { type ComponentType, type ReactElement, type ReactNode } from "react";
|
|
3
3
|
import type { WidgetHostProps } from "./widget-host.js";
|
|
4
4
|
type NativeViewComponent = ComponentType<Record<string, unknown>>;
|
|
@@ -7,6 +7,16 @@ type NativeReactVersion = {
|
|
|
7
7
|
minor?: unknown;
|
|
8
8
|
};
|
|
9
9
|
export type ProviderWidgetNativeBoxShadowSupport = "all" | "none" | "outset";
|
|
10
|
+
export declare function toProviderWidgetResumedTransitionTiming(input: {
|
|
11
|
+
durationMs: number;
|
|
12
|
+
easing: readonly [number, number, number, number];
|
|
13
|
+
execution: ReturnType<typeof resolveWidgetLayoutTransitionExecution>;
|
|
14
|
+
}): {
|
|
15
|
+
delayMs: number;
|
|
16
|
+
durationMs: number;
|
|
17
|
+
easing: (remainingProgress: number) => number;
|
|
18
|
+
initialProgress: number;
|
|
19
|
+
};
|
|
10
20
|
export declare function toProviderWidgetNativeBoxShadowSupport(input: {
|
|
11
21
|
hasFabricUIManager: boolean;
|
|
12
22
|
platform: {
|
|
@@ -47,7 +57,7 @@ export declare function toProviderWidgetSheetSurfaceStyles(input: {
|
|
|
47
57
|
frameStyle: Record<string, unknown>;
|
|
48
58
|
sheetStyle: Record<string, unknown>;
|
|
49
59
|
};
|
|
50
|
-
export declare function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, transitionSequence, }: {
|
|
60
|
+
export declare function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, transitionSequence, transitionSchedule, }: {
|
|
51
61
|
children?: ReactNode;
|
|
52
62
|
frameAppearance?: WidgetFrameAppearance;
|
|
53
63
|
isVisible: boolean;
|
|
@@ -55,5 +65,6 @@ export declare function ProviderWidgetHostOverlay({ children, frameAppearance, i
|
|
|
55
65
|
onRequestDismiss: () => void;
|
|
56
66
|
sheetHostLayoutUpdate: WidgetLayoutComparableSizeUpdate | undefined;
|
|
57
67
|
transitionSequence?: number;
|
|
68
|
+
transitionSchedule?: WidgetLayoutTransitionSchedule;
|
|
58
69
|
}): ReactElement;
|
|
59
70
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { areWidgetFrameAppearancesEqual, planWidgetLayoutTransition, toInstantWidgetLayoutSizeUpdate, } from "@getuserfeedback/protocol/host";
|
|
1
|
+
import { areWidgetFrameAppearancesEqual, planWidgetLayoutTransition, resolveWidgetLayoutResumedEasing, resolveWidgetLayoutTransitionExecution, toInstantWidgetLayoutSizeUpdate, } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { createElement, useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
3
|
import { toProviderWidgetFrameAppearance } from "./provider-widget-frame-appearance.js";
|
|
4
4
|
const HIDDEN_WIDGET_HOST_STYLE = {
|
|
@@ -134,6 +134,24 @@ function resolveNativeAnimationRuntime() {
|
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
export function toProviderWidgetResumedTransitionTiming(input) {
|
|
138
|
+
const elapsedProgress = Math.min(1, input.execution.elapsedMs / input.durationMs);
|
|
139
|
+
const initialProgress = resolveWidgetLayoutResumedEasing({
|
|
140
|
+
easing: input.easing,
|
|
141
|
+
elapsedProgress,
|
|
142
|
+
remainingProgress: 0,
|
|
143
|
+
}).initialProgress;
|
|
144
|
+
return {
|
|
145
|
+
delayMs: input.execution.delayMs,
|
|
146
|
+
durationMs: input.execution.durationMs,
|
|
147
|
+
easing: (remainingProgress) => resolveWidgetLayoutResumedEasing({
|
|
148
|
+
easing: input.easing,
|
|
149
|
+
elapsedProgress,
|
|
150
|
+
remainingProgress,
|
|
151
|
+
}).progress,
|
|
152
|
+
initialProgress,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
137
155
|
export function toProviderWidgetNativeBoxShadowSupport(input) {
|
|
138
156
|
var _a, _b;
|
|
139
157
|
if (!input.hasFabricUIManager) {
|
|
@@ -338,7 +356,7 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
338
356
|
presentationProgressRef.current = new animationRuntime.Animated.Value(0);
|
|
339
357
|
}
|
|
340
358
|
useEffect(() => {
|
|
341
|
-
var _a, _b, _c;
|
|
359
|
+
var _a, _b, _c, _d, _e, _f;
|
|
342
360
|
const stopAnimations = (property) => {
|
|
343
361
|
var _a, _b;
|
|
344
362
|
const retained = [];
|
|
@@ -368,9 +386,18 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
368
386
|
const previousFrame = previousFrameRef.current;
|
|
369
387
|
previousFrameRef.current = frame;
|
|
370
388
|
const transition = (_a = input.sheetHostLayoutUpdate) === null || _a === void 0 ? void 0 : _a.transition;
|
|
389
|
+
const transitionExecution = (transition === null || transition === void 0 ? void 0 : transition.kind) === "timed"
|
|
390
|
+
? resolveWidgetLayoutTransitionExecution({
|
|
391
|
+
schedule: input.transitionSchedule,
|
|
392
|
+
durationMs: transition.durationMs,
|
|
393
|
+
nowEpochMs: Date.now(),
|
|
394
|
+
})
|
|
395
|
+
: undefined;
|
|
371
396
|
const hasNewTransitionPolicy = input.transitionSequence !== undefined &&
|
|
372
397
|
consumedTransitionSequenceRef.current !== input.transitionSequence;
|
|
373
|
-
const shouldAnimate = (transition === null || transition === void 0 ? void 0 : transition.kind) === "timed" &&
|
|
398
|
+
const shouldAnimate = (transition === null || transition === void 0 ? void 0 : transition.kind) === "timed" &&
|
|
399
|
+
hasNewTransitionPolicy &&
|
|
400
|
+
(transitionExecution === null || transitionExecution === void 0 ? void 0 : transitionExecution.isComplete) !== true;
|
|
374
401
|
if (hasNewTransitionPolicy) {
|
|
375
402
|
consumedTransitionSequenceRef.current = input.transitionSequence;
|
|
376
403
|
}
|
|
@@ -442,18 +469,31 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
442
469
|
pendingFrameAppearanceRef.current = undefined;
|
|
443
470
|
setPresentationRevision((revision) => revision + 1);
|
|
444
471
|
};
|
|
445
|
-
const
|
|
446
|
-
|
|
472
|
+
const resumedTiming = transition.easing.kind === "cubic-bezier" &&
|
|
473
|
+
transitionExecution &&
|
|
474
|
+
transitionExecution.elapsedMs > 0
|
|
475
|
+
? toProviderWidgetResumedTransitionTiming({
|
|
476
|
+
durationMs: transition.durationMs,
|
|
477
|
+
easing: transition.easing.points,
|
|
478
|
+
execution: transitionExecution,
|
|
479
|
+
})
|
|
447
480
|
: undefined;
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
481
|
+
const easing = (_b = resumedTiming === null || resumedTiming === void 0 ? void 0 : resumedTiming.easing) !== null && _b !== void 0 ? _b : (transition.easing.kind === "cubic-bezier"
|
|
482
|
+
? (_d = (_c = animationRuntime.Easing) === null || _c === void 0 ? void 0 : _c.bezier) === null || _d === void 0 ? void 0 : _d.call(_c, ...transition.easing.points)
|
|
483
|
+
: undefined);
|
|
484
|
+
const animate = (property, value, toValue) => {
|
|
485
|
+
var _a, _b, _c, _d;
|
|
486
|
+
return ({
|
|
487
|
+
handle: animationRuntime.Animated.timing(value, {
|
|
488
|
+
toValue,
|
|
489
|
+
duration: (_b = (_a = resumedTiming === null || resumedTiming === void 0 ? void 0 : resumedTiming.durationMs) !== null && _a !== void 0 ? _a : transitionExecution === null || transitionExecution === void 0 ? void 0 : transitionExecution.durationMs) !== null && _b !== void 0 ? _b : transition.durationMs,
|
|
490
|
+
delay: (_d = (_c = resumedTiming === null || resumedTiming === void 0 ? void 0 : resumedTiming.delayMs) !== null && _c !== void 0 ? _c : transitionExecution === null || transitionExecution === void 0 ? void 0 : transitionExecution.delayMs) !== null && _d !== void 0 ? _d : 0,
|
|
491
|
+
easing,
|
|
492
|
+
useNativeDriver: false,
|
|
493
|
+
}),
|
|
494
|
+
property,
|
|
495
|
+
});
|
|
496
|
+
};
|
|
457
497
|
const activeProperties = new Set(animationRef.current.map((animation) => animation.property));
|
|
458
498
|
const animations = [];
|
|
459
499
|
for (const property of [
|
|
@@ -464,11 +504,16 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
464
504
|
if (previousFrame[property] !== frame[property] ||
|
|
465
505
|
activeProperties.has(property)) {
|
|
466
506
|
stopAnimations(property);
|
|
507
|
+
if (((_e = transitionExecution === null || transitionExecution === void 0 ? void 0 : transitionExecution.elapsedMs) !== null && _e !== void 0 ? _e : 0) > 0 && resumedTiming) {
|
|
508
|
+
values[property].setValue(previousFrame[property] +
|
|
509
|
+
(frame[property] - previousFrame[property]) *
|
|
510
|
+
resumedTiming.initialProgress);
|
|
511
|
+
}
|
|
467
512
|
animations.push(animate(property, values[property], frame[property]));
|
|
468
513
|
}
|
|
469
514
|
}
|
|
470
515
|
if (didFrameAppearanceChange && presentationProgressRef.current !== null) {
|
|
471
|
-
presentationProgressRef.current.setValue(0);
|
|
516
|
+
presentationProgressRef.current.setValue((_f = resumedTiming === null || resumedTiming === void 0 ? void 0 : resumedTiming.initialProgress) !== null && _f !== void 0 ? _f : 0);
|
|
472
517
|
pendingFrameAppearanceRef.current = targetFrameAppearance;
|
|
473
518
|
animations.push(animate("appearance", presentationProgressRef.current, 1));
|
|
474
519
|
}
|
|
@@ -499,6 +544,7 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
499
544
|
(_c = input.sheetHostLayoutUpdate) === null || _c === void 0 ? void 0 : _c.transition,
|
|
500
545
|
input.surfaceStyles,
|
|
501
546
|
input.transitionSequence,
|
|
547
|
+
input.transitionSchedule,
|
|
502
548
|
]);
|
|
503
549
|
useEffect(() => () => {
|
|
504
550
|
var _a, _b;
|
|
@@ -523,7 +569,7 @@ function useProviderWidgetSheetPresentation(input) {
|
|
|
523
569
|
surfaceView,
|
|
524
570
|
};
|
|
525
571
|
}
|
|
526
|
-
export function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, transitionSequence, }) {
|
|
572
|
+
export function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible, nativeView, onRequestDismiss, sheetHostLayoutUpdate, transitionSequence, transitionSchedule, }) {
|
|
527
573
|
const dragStartYRef = useRef(undefined);
|
|
528
574
|
const handleDragGrant = useCallback((event) => {
|
|
529
575
|
dragStartYRef.current = toResponderPageY(event);
|
|
@@ -591,6 +637,7 @@ export function ProviderWidgetHostOverlay({ children, frameAppearance, isVisible
|
|
|
591
637
|
sheetHostLayoutUpdate,
|
|
592
638
|
surfaceStyles,
|
|
593
639
|
transitionSequence,
|
|
640
|
+
transitionSchedule,
|
|
594
641
|
});
|
|
595
642
|
return createElement(nativeView, {
|
|
596
643
|
pointerEvents,
|
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.67";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getuserfeedback/react-native",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.67",
|
|
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": "^3.18.
|
|
48
|
-
"@getuserfeedback/sdk": "^0.12.
|
|
47
|
+
"@getuserfeedback/protocol": "^3.18.1",
|
|
48
|
+
"@getuserfeedback/sdk": "^0.12.1",
|
|
49
49
|
"robot3": "^1.2.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|