@getuserfeedback/react-native 3.0.45 → 3.0.46
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WidgetFrameAppearance } from "@getuserfeedback/protocol/host";
|
|
2
|
+
export type ProviderWidgetFrameAppearanceProjection = {
|
|
3
|
+
shadowPolicy: "clear" | "legacy";
|
|
4
|
+
topLeftRadius: number;
|
|
5
|
+
topRightRadius: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function safeParseProviderWidgetCanonicalTopRadii(value: string): {
|
|
8
|
+
topLeft: number;
|
|
9
|
+
topRight: number;
|
|
10
|
+
} | undefined;
|
|
11
|
+
export declare function toProviderWidgetFrameAppearance(appearance?: WidgetFrameAppearance): ProviderWidgetFrameAppearanceProjection;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const LEGACY_WIDGET_SHEET_RADIUS = 24;
|
|
2
|
+
const CANONICAL_PX_PATTERN = /^(?:0|[1-9]\d*)(?:\.\d+)?px$/;
|
|
3
|
+
const safeParseCanonicalPx = (value) => {
|
|
4
|
+
if (!CANONICAL_PX_PATTERN.test(value)) {
|
|
5
|
+
return undefined;
|
|
6
|
+
}
|
|
7
|
+
const parsed = Number.parseFloat(value);
|
|
8
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
9
|
+
};
|
|
10
|
+
export function safeParseProviderWidgetCanonicalTopRadii(value) {
|
|
11
|
+
if (value.includes("/")) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const radii = value.split(/\s+/).map(safeParseCanonicalPx);
|
|
15
|
+
if (radii.length === 0 ||
|
|
16
|
+
radii.length > 4 ||
|
|
17
|
+
radii.some((radius) => radius === undefined)) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
const [topLeft, topRight = topLeft] = radii;
|
|
21
|
+
return topLeft === undefined || topRight === undefined
|
|
22
|
+
? undefined
|
|
23
|
+
: { topLeft, topRight };
|
|
24
|
+
}
|
|
25
|
+
export function toProviderWidgetFrameAppearance(appearance) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (appearance === undefined) {
|
|
28
|
+
return {
|
|
29
|
+
shadowPolicy: "legacy",
|
|
30
|
+
topLeftRadius: LEGACY_WIDGET_SHEET_RADIUS,
|
|
31
|
+
topRightRadius: LEGACY_WIDGET_SHEET_RADIUS,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (appearance.kind === "none") {
|
|
35
|
+
return {
|
|
36
|
+
shadowPolicy: "clear",
|
|
37
|
+
topLeftRadius: 0,
|
|
38
|
+
topRightRadius: 0,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const radius = safeParseProviderWidgetCanonicalTopRadii(appearance.borderRadius);
|
|
42
|
+
return {
|
|
43
|
+
shadowPolicy: "clear",
|
|
44
|
+
topLeftRadius: (_a = radius === null || radius === void 0 ? void 0 : radius.topLeft) !== null && _a !== void 0 ? _a : 0,
|
|
45
|
+
topRightRadius: (_b = radius === null || radius === void 0 ? void 0 : radius.topRight) !== null && _b !== void 0 ? _b : 0,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { planWidgetLayoutTransition, toInstantWidgetLayoutSizeUpdate, } from "@getuserfeedback/protocol/host";
|
|
2
2
|
import { createElement, useCallback, useEffect, useMemo, useRef, } from "react";
|
|
3
|
+
import { toProviderWidgetFrameAppearance } from "./provider-widget-frame-appearance.js";
|
|
3
4
|
const HIDDEN_WIDGET_HOST_STYLE = {
|
|
4
5
|
bottom: 0,
|
|
5
6
|
left: 0,
|
|
@@ -31,22 +32,25 @@ const WIDGET_SHEET_LAYOUT_STYLE = {
|
|
|
31
32
|
position: "absolute",
|
|
32
33
|
right: 0,
|
|
33
34
|
};
|
|
34
|
-
const
|
|
35
|
+
const WIDGET_SHEET_LEGACY_FRAME_STYLE = {
|
|
35
36
|
shadowColor: "#000000",
|
|
36
37
|
shadowOffset: { height: -4, width: 0 },
|
|
37
38
|
shadowOpacity: 0.16,
|
|
38
39
|
shadowRadius: 18,
|
|
39
40
|
elevation: 18,
|
|
40
41
|
};
|
|
42
|
+
const WIDGET_SHEET_CLEARED_FRAME_STYLE = {
|
|
43
|
+
shadowColor: "transparent",
|
|
44
|
+
shadowOffset: { height: 0, width: 0 },
|
|
45
|
+
shadowOpacity: 0,
|
|
46
|
+
shadowRadius: 0,
|
|
47
|
+
elevation: 0,
|
|
48
|
+
};
|
|
41
49
|
const WIDGET_SHEET_CONTENT_BASE_STYLE = {
|
|
42
50
|
backgroundColor: "#ffffff",
|
|
43
51
|
flex: 1,
|
|
44
52
|
overflow: "hidden",
|
|
45
53
|
};
|
|
46
|
-
const WIDGET_SHEET_RADIUS_STYLE = {
|
|
47
|
-
borderTopLeftRadius: 24,
|
|
48
|
-
borderTopRightRadius: 24,
|
|
49
|
-
};
|
|
50
54
|
const WIDGET_SHEET_DRAG_HANDLE_TOUCH_STYLE = {
|
|
51
55
|
alignItems: "center",
|
|
52
56
|
elevation: 19,
|
|
@@ -199,14 +203,20 @@ export function toProviderWidgetHostStyle({ isVisible, webViewStyle, }) {
|
|
|
199
203
|
: VISIBLE_WIDGET_HOST_STYLE;
|
|
200
204
|
}
|
|
201
205
|
export function toProviderWidgetSheetSurfaceStyles(input) {
|
|
202
|
-
var _a
|
|
206
|
+
var _a;
|
|
203
207
|
const sheetHostViewport = (_a = input.sheetHostLayoutUpdate) === null || _a === void 0 ? void 0 : _a.size;
|
|
204
|
-
const
|
|
208
|
+
const appearance = toProviderWidgetFrameAppearance(input.frameAppearance);
|
|
209
|
+
const radiusStyle = {
|
|
210
|
+
borderTopLeftRadius: appearance.topLeftRadius,
|
|
211
|
+
borderTopRightRadius: appearance.topRightRadius,
|
|
212
|
+
};
|
|
213
|
+
const frameStyle = appearance.shadowPolicy === "legacy"
|
|
214
|
+
? WIDGET_SHEET_LEGACY_FRAME_STYLE
|
|
215
|
+
: WIDGET_SHEET_CLEARED_FRAME_STYLE;
|
|
205
216
|
return {
|
|
206
|
-
contentStyle: Object.assign(Object.assign({}, WIDGET_SHEET_CONTENT_BASE_STYLE),
|
|
217
|
+
contentStyle: Object.assign(Object.assign({}, WIDGET_SHEET_CONTENT_BASE_STYLE), radiusStyle),
|
|
207
218
|
sheetStyle: input.isVisible && sheetHostViewport !== undefined
|
|
208
|
-
? Object.assign(Object.assign(Object.assign({}, WIDGET_SHEET_LAYOUT_STYLE),
|
|
209
|
-
? Object.assign(Object.assign({}, WIDGET_SHEET_RADIUS_STYLE), WIDGET_SHEET_FRAME_STYLE) : {})), { height: sheetHostViewport.height }) : HIDDEN_WIDGET_HOST_STYLE,
|
|
219
|
+
? Object.assign(Object.assign(Object.assign(Object.assign({}, WIDGET_SHEET_LAYOUT_STYLE), radiusStyle), frameStyle), { height: sheetHostViewport.height }) : HIDDEN_WIDGET_HOST_STYLE,
|
|
210
220
|
};
|
|
211
221
|
}
|
|
212
222
|
function useProviderWidgetSheetPresentation(input) {
|
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.46";
|