@solucx/react-native-solucx-widget 0.2.1 → 0.2.2
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/lib/SoluCXWidget.d.ts +12 -0
- package/lib/SoluCXWidget.d.ts.map +1 -0
- package/lib/SoluCXWidget.js +110 -0
- package/lib/SoluCXWidget.js.map +1 -0
- package/lib/components/CloseButton.d.ts +8 -0
- package/lib/components/CloseButton.d.ts.map +1 -0
- package/lib/components/CloseButton.js +31 -0
- package/lib/components/CloseButton.js.map +1 -0
- package/lib/components/InlineWidget.d.ts +10 -0
- package/lib/components/InlineWidget.d.ts.map +1 -0
- package/lib/components/InlineWidget.js +19 -0
- package/lib/components/InlineWidget.js.map +1 -0
- package/lib/components/ModalWidget.d.ts +10 -0
- package/lib/components/ModalWidget.d.ts.map +1 -0
- package/lib/components/ModalWidget.js +27 -0
- package/lib/components/ModalWidget.js.map +1 -0
- package/lib/components/OverlayWidget.d.ts +12 -0
- package/lib/components/OverlayWidget.d.ts.map +1 -0
- package/lib/components/OverlayWidget.js +55 -0
- package/lib/components/OverlayWidget.js.map +1 -0
- package/lib/constants/Constants.d.ts +3 -0
- package/lib/constants/Constants.d.ts.map +1 -0
- package/lib/constants/Constants.js +10 -0
- package/lib/constants/Constants.js.map +1 -0
- package/lib/constants/webViewConstants.d.ts +12 -0
- package/lib/constants/webViewConstants.d.ts.map +1 -0
- package/lib/constants/webViewConstants.js +19 -0
- package/lib/constants/webViewConstants.js.map +1 -0
- package/lib/hooks/index.d.ts +3 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/index.js +8 -0
- package/lib/hooks/index.js.map +1 -0
- package/lib/hooks/useDeviceInfoCollector.d.ts +14 -0
- package/lib/hooks/useDeviceInfoCollector.d.ts.map +1 -0
- package/lib/hooks/useDeviceInfoCollector.js +54 -0
- package/lib/hooks/useDeviceInfoCollector.js.map +1 -0
- package/lib/hooks/useHeightAnimation.d.ts +9 -0
- package/lib/hooks/useHeightAnimation.d.ts.map +1 -0
- package/lib/hooks/useHeightAnimation.js +19 -0
- package/lib/hooks/useHeightAnimation.js.map +1 -0
- package/lib/hooks/useWidgetHeight.d.ts +13 -0
- package/lib/hooks/useWidgetHeight.d.ts.map +1 -0
- package/lib/hooks/useWidgetHeight.js +21 -0
- package/lib/hooks/useWidgetHeight.js.map +1 -0
- package/lib/hooks/useWidgetState.d.ts +15 -0
- package/lib/hooks/useWidgetState.d.ts.map +1 -0
- package/lib/hooks/useWidgetState.js +79 -0
- package/lib/hooks/useWidgetState.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/interfaces/WidgetCallbacks.d.ts +14 -0
- package/lib/interfaces/WidgetCallbacks.d.ts.map +1 -0
- package/lib/interfaces/WidgetCallbacks.js +3 -0
- package/lib/interfaces/WidgetCallbacks.js.map +1 -0
- package/lib/interfaces/WidgetData.d.ts +21 -0
- package/lib/interfaces/WidgetData.d.ts.map +1 -0
- package/lib/interfaces/WidgetData.js +3 -0
- package/lib/interfaces/WidgetData.js.map +1 -0
- package/lib/interfaces/WidgetOptions.d.ts +9 -0
- package/lib/interfaces/WidgetOptions.d.ts.map +1 -0
- package/lib/interfaces/WidgetOptions.js +3 -0
- package/lib/interfaces/WidgetOptions.js.map +1 -0
- package/lib/interfaces/WidgetResponse.d.ts +10 -0
- package/lib/interfaces/WidgetResponse.d.ts.map +1 -0
- package/lib/interfaces/WidgetResponse.js +12 -0
- package/lib/interfaces/WidgetResponse.js.map +1 -0
- package/lib/interfaces/WidgetSamplerLog.d.ts +7 -0
- package/lib/interfaces/WidgetSamplerLog.d.ts.map +1 -0
- package/lib/interfaces/WidgetSamplerLog.js +3 -0
- package/lib/interfaces/WidgetSamplerLog.js.map +1 -0
- package/lib/interfaces/index.d.ts +12 -0
- package/lib/interfaces/index.d.ts.map +1 -0
- package/lib/interfaces/index.js +3 -0
- package/lib/interfaces/index.js.map +1 -0
- package/lib/services/ClientVersionCollector.d.ts +2 -0
- package/lib/services/ClientVersionCollector.d.ts.map +1 -0
- package/lib/services/ClientVersionCollector.js +20 -0
- package/lib/services/ClientVersionCollector.js.map +1 -0
- package/lib/services/storage.d.ts +8 -0
- package/lib/services/storage.d.ts.map +1 -0
- package/lib/services/storage.js +23 -0
- package/lib/services/storage.js.map +1 -0
- package/lib/services/widgetBootstrapService.d.ts +5 -0
- package/lib/services/widgetBootstrapService.d.ts.map +1 -0
- package/lib/services/widgetBootstrapService.js +60 -0
- package/lib/services/widgetBootstrapService.js.map +1 -0
- package/lib/services/widgetEventService.d.ts +19 -0
- package/lib/services/widgetEventService.d.ts.map +1 -0
- package/lib/services/widgetEventService.js +79 -0
- package/lib/services/widgetEventService.js.map +1 -0
- package/lib/services/widgetValidationService.d.ts +18 -0
- package/lib/services/widgetValidationService.d.ts.map +1 -0
- package/lib/services/widgetValidationService.js +71 -0
- package/lib/services/widgetValidationService.js.map +1 -0
- package/lib/styles/widgetStyles.d.ts +87 -0
- package/lib/styles/widgetStyles.d.ts.map +1 -0
- package/lib/styles/widgetStyles.js +59 -0
- package/lib/styles/widgetStyles.js.map +1 -0
- package/lib/utils/urlUtils.d.ts +3 -0
- package/lib/utils/urlUtils.d.ts.map +1 -0
- package/lib/utils/urlUtils.js +13 -0
- package/lib/utils/urlUtils.js.map +1 -0
- package/package.json +5 -3
- package/src/SoluCXWidget.tsx +15 -11
- package/src/__tests__/SoluCXWidget.rendering.test.tsx +150 -0
- package/src/__tests__/widgetBootstrapService.test.ts +45 -10
- package/src/services/widgetBootstrapService.ts +13 -4
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SoluCXKey, WidgetData, WidgetOptions, WidgetType, WidgetCallbacks } from "./interfaces";
|
|
3
|
+
interface SoluCXWidgetProps {
|
|
4
|
+
soluCXKey: SoluCXKey;
|
|
5
|
+
type: WidgetType;
|
|
6
|
+
data: WidgetData;
|
|
7
|
+
options: WidgetOptions;
|
|
8
|
+
callbacks?: WidgetCallbacks;
|
|
9
|
+
}
|
|
10
|
+
export declare const SoluCXWidget: React.FC<SoluCXWidgetProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=SoluCXWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoluCXWidget.d.ts","sourceRoot":"","sources":["../src/SoluCXWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAIjF,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAUtG,UAAU,iBAAiB;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA2JpD,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SoluCXWidget = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const react_native_webview_1 = require("react-native-webview");
|
|
8
|
+
const useWidgetState_1 = require("./hooks/useWidgetState");
|
|
9
|
+
const widgetEventService_1 = require("./services/widgetEventService");
|
|
10
|
+
const widgetValidationService_1 = require("./services/widgetValidationService");
|
|
11
|
+
const webViewConstants_1 = require("./constants/webViewConstants");
|
|
12
|
+
const ModalWidget_1 = require("./components/ModalWidget");
|
|
13
|
+
const InlineWidget_1 = require("./components/InlineWidget");
|
|
14
|
+
const OverlayWidget_1 = require("./components/OverlayWidget");
|
|
15
|
+
const widgetBootstrapService_1 = require("./services/widgetBootstrapService");
|
|
16
|
+
const SoluCXWidget = ({ soluCXKey, type, data, options, callbacks }) => {
|
|
17
|
+
const webviewRef = (0, react_1.useRef)(null);
|
|
18
|
+
const { width } = react_native_1.Dimensions.get("window");
|
|
19
|
+
const callbacksRef = (0, react_1.useRef)(callbacks);
|
|
20
|
+
callbacksRef.current = callbacks;
|
|
21
|
+
const serializedData = JSON.stringify(data);
|
|
22
|
+
const normalizedData = (0, react_1.useMemo)(() => data, [serializedData]);
|
|
23
|
+
const { widgetHeight, isWidgetVisible, setIsWidgetVisible, loadSavedData, resize, open, close, userId } = (0, useWidgetState_1.useWidgetState)(normalizedData, options, type);
|
|
24
|
+
const eventService = (0, react_1.useMemo)(() => new widgetEventService_1.WidgetEventService(setIsWidgetVisible, resize, userId, callbacksRef.current), [setIsWidgetVisible, resize]);
|
|
25
|
+
const validationService = (0, react_1.useMemo)(() => new widgetValidationService_1.WidgetValidationService(userId), [userId]);
|
|
26
|
+
const isForm = Boolean(normalizedData?.form_id);
|
|
27
|
+
const [widgetUri, setWidgetUri] = (0, react_1.useState)(null);
|
|
28
|
+
(0, react_1.useEffect)(() => {
|
|
29
|
+
loadSavedData();
|
|
30
|
+
}, [loadSavedData]);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
let isActive = true;
|
|
33
|
+
const prepareWidgetURL = async () => {
|
|
34
|
+
if (!data)
|
|
35
|
+
return;
|
|
36
|
+
setWidgetUri(null);
|
|
37
|
+
try {
|
|
38
|
+
const widgetUrl = await (0, widgetBootstrapService_1.requestWidgetUrl)(soluCXKey, normalizedData, userId);
|
|
39
|
+
if (!isActive || !widgetUrl)
|
|
40
|
+
return;
|
|
41
|
+
const result = await validationService.shouldDisplayWidget(options);
|
|
42
|
+
if (!isActive)
|
|
43
|
+
return;
|
|
44
|
+
if (!result.canDisplay) {
|
|
45
|
+
const blockReason = result?.blockReason;
|
|
46
|
+
callbacksRef.current?.onBlock?.(blockReason);
|
|
47
|
+
setIsWidgetVisible(false);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
callbacksRef.current?.onPreOpen?.(userId);
|
|
51
|
+
open();
|
|
52
|
+
setWidgetUri(widgetUrl);
|
|
53
|
+
callbacksRef.current?.onOpened?.(userId);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (isActive) {
|
|
57
|
+
let errorMessage = "Unknown error";
|
|
58
|
+
if (error instanceof Error)
|
|
59
|
+
errorMessage = error.message;
|
|
60
|
+
else if (typeof error === "string")
|
|
61
|
+
errorMessage = error;
|
|
62
|
+
else if (error !== null && typeof error === "object")
|
|
63
|
+
errorMessage = JSON.stringify(error);
|
|
64
|
+
callbacksRef.current?.onError?.(errorMessage);
|
|
65
|
+
setIsWidgetVisible(false);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
prepareWidgetURL();
|
|
70
|
+
return () => {
|
|
71
|
+
isActive = false;
|
|
72
|
+
};
|
|
73
|
+
}, [validationService, soluCXKey, normalizedData, isForm, setIsWidgetVisible, options, open, userId]);
|
|
74
|
+
const handleWebViewMessage = (0, react_1.useCallback)(async (message) => {
|
|
75
|
+
if (message && message.length > 0) {
|
|
76
|
+
try {
|
|
77
|
+
await eventService.handleMessage(message, isForm);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error("Error handling widget message:", error);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}, [eventService, isForm]);
|
|
84
|
+
const handleWebViewLoad = (0, react_1.useCallback)(() => {
|
|
85
|
+
webviewRef.current?.injectJavaScript(webViewConstants_1.WEB_VIEW_MESSAGE_LISTENER);
|
|
86
|
+
}, []);
|
|
87
|
+
const handleClose = (0, react_1.useCallback)(() => {
|
|
88
|
+
if (type === "inline" || type === "modal") {
|
|
89
|
+
close();
|
|
90
|
+
}
|
|
91
|
+
setIsWidgetVisible(false);
|
|
92
|
+
}, [setIsWidgetVisible, close, type]);
|
|
93
|
+
const webViewStyle = [{ height: widgetHeight }, { width }];
|
|
94
|
+
if (!data) {
|
|
95
|
+
callbacksRef.current?.onError?.("Widget data is required but was not provided");
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
if (!widgetUri) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
if (type === "modal") {
|
|
102
|
+
return ((0, jsx_runtime_1.jsx)(ModalWidget_1.ModalWidget, { visible: isWidgetVisible, height: widgetHeight, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: webviewRef, style: webViewStyle, source: { uri: widgetUri }, onLoadEnd: handleWebViewLoad, onMessage: (event) => handleWebViewMessage(event.nativeEvent.data), originWhitelist: ["*"] }) }));
|
|
103
|
+
}
|
|
104
|
+
if (type === "inline") {
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(InlineWidget_1.InlineWidget, { visible: isWidgetVisible, height: widgetHeight, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: webviewRef, style: webViewStyle, source: { uri: widgetUri }, onLoadEnd: handleWebViewLoad, onMessage: (event) => handleWebViewMessage(event.nativeEvent.data), originWhitelist: ["*"] }) }));
|
|
106
|
+
}
|
|
107
|
+
return ((0, jsx_runtime_1.jsx)(OverlayWidget_1.OverlayWidget, { visible: isWidgetVisible, width: width, height: widgetHeight, position: type, onClose: handleClose, children: (0, jsx_runtime_1.jsx)(react_native_webview_1.WebView, { ref: webviewRef, style: webViewStyle, source: { uri: widgetUri }, onLoadEnd: handleWebViewLoad, onMessage: (event) => handleWebViewMessage(event.nativeEvent.data), originWhitelist: ["*"] }) }));
|
|
108
|
+
};
|
|
109
|
+
exports.SoluCXWidget = SoluCXWidget;
|
|
110
|
+
//# sourceMappingURL=SoluCXWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SoluC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+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CloseButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const CloseButton = ({ onPress, visible = true }) => {
|
|
7
|
+
if (!visible)
|
|
8
|
+
return null;
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: styles.closeButton, onPress: onPress, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: styles.closeButtonText, children: "\u2715" }) }));
|
|
10
|
+
};
|
|
11
|
+
exports.CloseButton = CloseButton;
|
|
12
|
+
const styles = react_native_1.StyleSheet.create({
|
|
13
|
+
closeButton: {
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
top: 10,
|
|
16
|
+
right: 10,
|
|
17
|
+
width: 30,
|
|
18
|
+
height: 30,
|
|
19
|
+
borderRadius: 15,
|
|
20
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
zIndex: 10001,
|
|
24
|
+
},
|
|
25
|
+
closeButtonText: {
|
|
26
|
+
color: 'white',
|
|
27
|
+
fontSize: 16,
|
|
28
|
+
fontWeight: 'bold',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=CloseButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloseButton.js","sourceRoot":"","sources":["../../src/components/CloseButton.tsx"],"names":[],"mappings":";;;;AACA,+CAAkE;AAO3D,MAAM,WAAW,GAA+B,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,EAAE,EAAE,EAAE;IACnF,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,OAAO,CACH,uBAAC,+BAAgB,IAAC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,YACzD,uBAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,eAAe,uBAAU,GAC9B,CACtB,CAAC;AACN,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC7B,WAAW,EAAE;QACT,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,EAAE;QACP,KAAK,EAAE,EAAE;QACT,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,oBAAoB;QACrC,cAAc,EAAE,QAAQ;QACxB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE,KAAK;KAChB;IACD,eAAe,EAAE;QACb,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACrB;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface InlineWidgetProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
height: number;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const InlineWidget: React.FC<InlineWidgetProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=InlineWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineWidget.d.ts","sourceRoot":"","sources":["../../src/components/InlineWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,UAAU,iBAAiB;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqBpD,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InlineWidget = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const widgetStyles_1 = require("../styles/widgetStyles");
|
|
8
|
+
const CloseButton_1 = require("./CloseButton");
|
|
9
|
+
const react_native_2 = require("react-native");
|
|
10
|
+
const useHeightAnimation_1 = require("../hooks/useHeightAnimation");
|
|
11
|
+
const InlineWidget = ({ visible, height, children, onClose, }) => {
|
|
12
|
+
const { animatedHeightStyle, updateHeight } = (0, useHeightAnimation_1.useHeightAnimation)(height);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
updateHeight(height);
|
|
15
|
+
}, [height, updateHeight]);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [widgetStyles_1.styles.inlineWrapper, (0, widgetStyles_1.getWidgetVisibility)(visible)], children: (0, jsx_runtime_1.jsxs)(react_native_2.Animated.View, { style: [widgetStyles_1.styles.inline, animatedHeightStyle, (0, widgetStyles_1.getWidgetVisibility)(visible)], children: [children, (0, jsx_runtime_1.jsx)(CloseButton_1.CloseButton, { visible: visible, onPress: onClose || (() => { }) })] }) }));
|
|
17
|
+
};
|
|
18
|
+
exports.InlineWidget = InlineWidget;
|
|
19
|
+
//# sourceMappingURL=InlineWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InlineWidget.js","sourceRoot":"","sources":["../../src/components/InlineWidget.tsx"],"names":[],"mappings":";;;;AAAA,iCAAyC;AACzC,+CAAoC;AACpC,yDAAqE;AACrE,+CAA4C;AAC5C,+CAAwC;AACxC,oEAAiE;AAS1D,MAAM,YAAY,GAAgC,CAAC,EACtD,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAkB,EAAC,MAAM,CAAC,CAAC;IAEzE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAE3B,OAAO,CACH,uBAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,qBAAM,CAAC,aAAa,EAAE,IAAA,kCAAmB,EAAC,OAAO,CAAC,CAAC,YAC7D,wBAAC,uBAAQ,CAAC,IAAI,IACV,KAAK,EAAE,CAAC,qBAAM,CAAC,MAAM,EAAE,mBAAmB,EAAE,IAAA,kCAAmB,EAAC,OAAO,CAAC,CAAC,aACxE,QAAQ,EACT,uBAAC,yBAAW,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAI,IACtD,GACb,CACV,CAAC;AACN,CAAC,CAAC;AArBW,QAAA,YAAY,gBAqBvB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ModalWidgetProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
height: number;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
onClose?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ModalWidget: React.FC<ModalWidgetProps>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ModalWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalWidget.d.ts","sourceRoot":"","sources":["../../src/components/ModalWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAOnD,UAAU,gBAAgB;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA0ClD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ModalWidget = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
8
|
+
const widgetStyles_1 = require("../styles/widgetStyles");
|
|
9
|
+
const CloseButton_1 = require("./CloseButton");
|
|
10
|
+
const useHeightAnimation_1 = require("../hooks/useHeightAnimation");
|
|
11
|
+
const ModalWidget = ({ visible, height, children, onClose, }) => {
|
|
12
|
+
const { animatedHeightStyle, updateHeight } = (0, useHeightAnimation_1.useHeightAnimation)(height);
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
updateHeight(height);
|
|
15
|
+
}, [height, updateHeight]);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(react_native_safe_area_context_1.SafeAreaView, { children: (0, jsx_runtime_1.jsx)(react_native_1.Modal, { transparent: true, visible: visible, animationType: "slide", hardwareAccelerated: true, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [widgetStyles_1.styles.modalOverlay, (0, widgetStyles_1.getWidgetVisibility)(visible)], children: (0, jsx_runtime_1.jsxs)(react_native_1.Animated.View, { style: [
|
|
17
|
+
widgetStyles_1.styles.modalContent,
|
|
18
|
+
(0, widgetStyles_1.getWidgetVisibility)(visible),
|
|
19
|
+
animatedHeightStyle,
|
|
20
|
+
], children: [children, (0, jsx_runtime_1.jsx)(CloseButton_1.CloseButton, { visible: visible, onPress: () => {
|
|
21
|
+
if (onClose) {
|
|
22
|
+
onClose();
|
|
23
|
+
}
|
|
24
|
+
} })] }) }) }) }));
|
|
25
|
+
};
|
|
26
|
+
exports.ModalWidget = ModalWidget;
|
|
27
|
+
//# sourceMappingURL=ModalWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalWidget.js","sourceRoot":"","sources":["../../src/components/ModalWidget.tsx"],"names":[],"mappings":";;;;AAAA,iCAAmD;AACnD,+CAAqD;AACrD,mFAA8D;AAC9D,yDAAqE;AACrE,+CAA4C;AAC5C,oEAAiE;AAS1D,MAAM,WAAW,GAA+B,CAAC,EACpD,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAkB,EAAC,MAAM,CAAC,CAAC;IAEzE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAE3B,OAAO,CACH,uBAAC,6CAAY,cACT,uBAAC,oBAAK,IACF,WAAW,QACX,OAAO,EAAE,OAAO,EAChB,aAAa,EAAC,OAAO,EACrB,mBAAmB,kBAEnB,uBAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,qBAAM,CAAC,YAAY,EAAE,IAAA,kCAAmB,EAAC,OAAO,CAAC,CAAC,YAC5D,wBAAC,uBAAQ,CAAC,IAAI,IACV,KAAK,EAAE;wBACH,qBAAM,CAAC,YAAY;wBACnB,IAAA,kCAAmB,EAAC,OAAO,CAAC;wBAC5B,mBAAmB;qBACtB,aAEA,QAAQ,EACT,uBAAC,yBAAW,IACR,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,GAAG,EAAE;gCACV,IAAI,OAAO,EAAE,CAAC;oCACV,OAAO,EAAE,CAAC;gCACd,CAAC;4BACL,CAAC,GACH,IACU,GACb,GACH,GACG,CAClB,CAAC;AACN,CAAC,CAAC;AA1CW,QAAA,WAAW,eA0CtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface OverlayWidgetProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
position: 'top' | 'bottom';
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
onClose?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const OverlayWidget: React.FC<OverlayWidgetProps>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=OverlayWidget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayWidget.d.ts","sourceRoot":"","sources":["../../src/components/OverlayWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAQnD,UAAU,kBAAkB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAsEtD,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OverlayWidget = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
const react_native_safe_area_context_1 = require("react-native-safe-area-context");
|
|
8
|
+
const widgetStyles_1 = require("../styles/widgetStyles");
|
|
9
|
+
const webViewConstants_1 = require("../constants/webViewConstants");
|
|
10
|
+
const CloseButton_1 = require("./CloseButton");
|
|
11
|
+
const useHeightAnimation_1 = require("../hooks/useHeightAnimation");
|
|
12
|
+
const OverlayWidget = ({ visible, width, height, position, children, onClose, }) => {
|
|
13
|
+
const insets = react_native_safe_area_context_1.initialWindowMetrics?.insets ?? { top: 0, bottom: 0, left: 0, right: 0 };
|
|
14
|
+
const [isWidgetVisible, setIsWidgetVisible] = (0, react_1.useState)(true);
|
|
15
|
+
const { animatedHeightStyle, updateHeight } = (0, useHeightAnimation_1.useHeightAnimation)(height);
|
|
16
|
+
(0, react_1.useEffect)(() => {
|
|
17
|
+
updateHeight(height);
|
|
18
|
+
}, [height, updateHeight]);
|
|
19
|
+
const containerStyle = {
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
right: 0,
|
|
24
|
+
bottom: 0,
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: '100%',
|
|
27
|
+
zIndex: webViewConstants_1.FIXED_Z_INDEX,
|
|
28
|
+
pointerEvents: 'box-none',
|
|
29
|
+
};
|
|
30
|
+
const contentStyle = [
|
|
31
|
+
(0, widgetStyles_1.getWidgetStyles)(position).content,
|
|
32
|
+
{
|
|
33
|
+
width,
|
|
34
|
+
pointerEvents: 'auto',
|
|
35
|
+
...(position === 'top' && {
|
|
36
|
+
top: insets.top,
|
|
37
|
+
}),
|
|
38
|
+
...(position === 'bottom' && {
|
|
39
|
+
bottom: insets.bottom,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isWidgetVisible && ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: [containerStyle, (0, widgetStyles_1.getWidgetVisibility)(visible)], children: (0, jsx_runtime_1.jsxs)(react_native_1.Animated.View, { style: [
|
|
44
|
+
contentStyle,
|
|
45
|
+
animatedHeightStyle,
|
|
46
|
+
(0, widgetStyles_1.getWidgetVisibility)(visible),
|
|
47
|
+
], children: [children, (0, jsx_runtime_1.jsx)(CloseButton_1.CloseButton, { visible: visible, onPress: () => {
|
|
48
|
+
setIsWidgetVisible(false);
|
|
49
|
+
if (onClose) {
|
|
50
|
+
onClose();
|
|
51
|
+
}
|
|
52
|
+
} })] }) })) }));
|
|
53
|
+
};
|
|
54
|
+
exports.OverlayWidget = OverlayWidget;
|
|
55
|
+
//# sourceMappingURL=OverlayWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayWidget.js","sourceRoot":"","sources":["../../src/components/OverlayWidget.tsx"],"names":[],"mappings":";;;;AAAA,iCAAmD;AACnD,+CAA8D;AAC9D,mFAAsE;AACtE,yDAA8E;AAC9E,oEAA8D;AAC9D,+CAA4C;AAC5C,oEAAiE;AAW1D,MAAM,aAAa,GAAiC,CAAC,EACxD,OAAO,EACP,KAAK,EACL,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,OAAO,GACV,EAAE,EAAE;IACD,MAAM,MAAM,GACR,qDAAoB,EAAE,MAAM,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAC7E,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAU,IAAI,CAAC,CAAC;IAEtE,MAAM,EAAE,mBAAmB,EAAE,YAAY,EAAE,GAAG,IAAA,uCAAkB,EAAC,MAAM,CAAC,CAAC;IAEzE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAE3B,MAAM,cAAc,GAAc;QAC9B,QAAQ,EAAE,UAAU;QACpB,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,gCAAa;QACrB,aAAa,EAAE,UAAU;KAC5B,CAAC;IAEF,MAAM,YAAY,GAAG;QACjB,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,OAAO;QACjC;YACI,KAAK;YACL,aAAa,EAAE,MAAe;YAC9B,GAAG,CAAC,QAAQ,KAAK,KAAK,IAAI;gBACtB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;YACF,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI;gBACzB,MAAM,EAAE,MAAM,CAAC,MAAM;aACxB,CAAC;SACL;KACJ,CAAC;IAEF,OAAO,CACH,2DACK,eAAe,IAAI,CAChB,uBAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,cAAc,EAAE,IAAA,kCAAmB,EAAC,OAAO,CAAC,CAAC,YACvD,wBAAC,uBAAQ,CAAC,IAAI,IACV,KAAK,EAAE;oBACH,YAAY;oBACZ,mBAAmB;oBACnB,IAAA,kCAAmB,EAAC,OAAO,CAAC;iBAC/B,aAEA,QAAQ,EACT,uBAAC,yBAAW,IACR,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,GAAG,EAAE;4BACV,kBAAkB,CAAC,KAAK,CAAC,CAAC;4BAC1B,IAAI,OAAO,EAAE,CAAC;gCACV,OAAO,EAAE,CAAC;4BACd,CAAC;wBACL,CAAC,GACH,IACU,GACb,CACV,GACF,CACN,CAAC;AACN,CAAC,CAAC;AAtEW,QAAA,aAAa,iBAsExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/constants/Constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAsB,CAAC;AAC/C,eAAO,MAAM,QAAQ,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SDK_NAME = exports.SDK_VERSION = void 0;
|
|
7
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
|
+
exports.SDK_VERSION = package_json_1.default.version;
|
|
9
|
+
exports.SDK_NAME = "rn-widget-sdk";
|
|
10
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../src/constants/Constants.ts"],"names":[],"mappings":";;;;;;AAAA,sEAA6C;AAEhC,QAAA,WAAW,GAAG,sBAAW,CAAC,OAAO,CAAC;AAClC,QAAA,QAAQ,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const BASE_URL = "https://survey-link.solucx.com.br/link";
|
|
2
|
+
export declare const RATING_FORM_ENDPOINT = "https://widget-api.solucx.com.br/widget/preflight";
|
|
3
|
+
export declare const STORAGE_KEY = "@solucxWidgetLog";
|
|
4
|
+
export declare const DEFAULT_CHANNEL_NUMBER = 1;
|
|
5
|
+
export declare const DEFAULT_CHANNEL = "widget";
|
|
6
|
+
export declare const DEFAULT_WIDTH = 380;
|
|
7
|
+
export declare const MIN_HEIGHT = 200;
|
|
8
|
+
export declare const FIXED_Z_INDEX = 9999;
|
|
9
|
+
export declare const MODAL_Z_INDEX = 10000;
|
|
10
|
+
export declare const DESIGN_HEIGHT = 700;
|
|
11
|
+
export declare const WEB_VIEW_MESSAGE_LISTENER = "\n window.addEventListener('message', function(event) {\n window.ReactNativeWebView.postMessage(event.data);\n });\n";
|
|
12
|
+
//# sourceMappingURL=webViewConstants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webViewConstants.d.ts","sourceRoot":"","sources":["../../src/constants/webViewConstants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,2CAA2C,CAAC;AACjE,eAAO,MAAM,oBAAoB,sDAAsD,CAAC;AACxF,eAAO,MAAM,WAAW,qBAAqB,CAAC;AAC9C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,UAAU,MAAM,CAAC;AAC9B,eAAO,MAAM,aAAa,OAAO,CAAC;AAClC,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,yBAAyB,8HAIrC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WEB_VIEW_MESSAGE_LISTENER = exports.DESIGN_HEIGHT = exports.MODAL_Z_INDEX = exports.FIXED_Z_INDEX = exports.MIN_HEIGHT = exports.DEFAULT_WIDTH = exports.DEFAULT_CHANNEL = exports.DEFAULT_CHANNEL_NUMBER = exports.STORAGE_KEY = exports.RATING_FORM_ENDPOINT = exports.BASE_URL = void 0;
|
|
4
|
+
exports.BASE_URL = 'https://survey-link.solucx.com.br/link';
|
|
5
|
+
exports.RATING_FORM_ENDPOINT = 'https://widget-api.solucx.com.br/widget/preflight';
|
|
6
|
+
exports.STORAGE_KEY = '@solucxWidgetLog';
|
|
7
|
+
exports.DEFAULT_CHANNEL_NUMBER = 1;
|
|
8
|
+
exports.DEFAULT_CHANNEL = 'widget';
|
|
9
|
+
exports.DEFAULT_WIDTH = 380;
|
|
10
|
+
exports.MIN_HEIGHT = 200;
|
|
11
|
+
exports.FIXED_Z_INDEX = 9999;
|
|
12
|
+
exports.MODAL_Z_INDEX = 10000;
|
|
13
|
+
exports.DESIGN_HEIGHT = 700;
|
|
14
|
+
exports.WEB_VIEW_MESSAGE_LISTENER = `
|
|
15
|
+
window.addEventListener('message', function(event) {
|
|
16
|
+
window.ReactNativeWebView.postMessage(event.data);
|
|
17
|
+
});
|
|
18
|
+
`;
|
|
19
|
+
//# sourceMappingURL=webViewConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webViewConstants.js","sourceRoot":"","sources":["../../src/constants/webViewConstants.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,wCAAwC,CAAC;AACpD,QAAA,oBAAoB,GAAG,mDAAmD,CAAC;AAC3E,QAAA,WAAW,GAAG,kBAAkB,CAAC;AACjC,QAAA,sBAAsB,GAAG,CAAC,CAAC;AAC3B,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,aAAa,GAAG,GAAG,CAAC;AACpB,QAAA,UAAU,GAAG,GAAG,CAAC;AACjB,QAAA,aAAa,GAAG,IAAI,CAAC;AACrB,QAAA,aAAa,GAAG,KAAK,CAAC;AACtB,QAAA,aAAa,GAAG,GAAG,CAAC;AACpB,QAAA,yBAAyB,GAAG;;;;CAIxC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useWidgetHeight = exports.useWidgetState = void 0;
|
|
4
|
+
var useWidgetState_1 = require("./useWidgetState");
|
|
5
|
+
Object.defineProperty(exports, "useWidgetState", { enumerable: true, get: function () { return useWidgetState_1.useWidgetState; } });
|
|
6
|
+
var useWidgetHeight_1 = require("./useWidgetHeight");
|
|
7
|
+
Object.defineProperty(exports, "useWidgetHeight", { enumerable: true, get: function () { return useWidgetHeight_1.useWidgetHeight; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AACvB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface DeviceInfo {
|
|
2
|
+
platform: "ios" | "android" | "web" | "windows" | "macos";
|
|
3
|
+
osVersion: string;
|
|
4
|
+
screenWidth: number;
|
|
5
|
+
screenHeight: number;
|
|
6
|
+
windowWidth: number;
|
|
7
|
+
windowHeight: number;
|
|
8
|
+
scale: number;
|
|
9
|
+
fontScale: number;
|
|
10
|
+
deviceType?: "tablet" | "phone";
|
|
11
|
+
model: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const getDeviceInfo: () => DeviceInfo;
|
|
14
|
+
//# sourceMappingURL=useDeviceInfoCollector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeviceInfoCollector.d.ts","sourceRoot":"","sources":["../../src/hooks/useDeviceInfoCollector.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;CACjB;AAqCD,eAAO,MAAM,aAAa,QAAO,UAgBhC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeviceInfo = void 0;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const isTablet = () => {
|
|
6
|
+
const { width, height } = react_native_1.Dimensions.get("screen");
|
|
7
|
+
const aspectRatio = height / width;
|
|
8
|
+
return Math.min(width, height) >= 600 && aspectRatio < 1.6;
|
|
9
|
+
};
|
|
10
|
+
const getDeviceModel = () => {
|
|
11
|
+
try {
|
|
12
|
+
const DeviceInfo = require('react-native-device-info');
|
|
13
|
+
if (DeviceInfo?.default?.getModel) {
|
|
14
|
+
return DeviceInfo.default.getModel();
|
|
15
|
+
}
|
|
16
|
+
if (DeviceInfo?.getModel) {
|
|
17
|
+
return DeviceInfo.getModel();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
// react-native-device-info não disponível
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const constants = react_native_1.Platform.constants;
|
|
25
|
+
if (constants?.Model) {
|
|
26
|
+
return constants.Model;
|
|
27
|
+
}
|
|
28
|
+
if (constants?.model) {
|
|
29
|
+
return constants.model;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
// Nada disponível
|
|
34
|
+
}
|
|
35
|
+
return 'unknown';
|
|
36
|
+
};
|
|
37
|
+
const getDeviceInfo = () => {
|
|
38
|
+
const screen = react_native_1.Dimensions.get("screen");
|
|
39
|
+
const window = react_native_1.Dimensions.get("window");
|
|
40
|
+
return {
|
|
41
|
+
platform: react_native_1.Platform.OS,
|
|
42
|
+
osVersion: react_native_1.Platform.Version.toString(),
|
|
43
|
+
screenWidth: screen.width,
|
|
44
|
+
screenHeight: screen.height,
|
|
45
|
+
windowWidth: window.width,
|
|
46
|
+
windowHeight: window.height,
|
|
47
|
+
scale: screen.scale,
|
|
48
|
+
fontScale: screen.fontScale,
|
|
49
|
+
deviceType: isTablet() ? "tablet" : "phone",
|
|
50
|
+
model: getDeviceModel(),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
exports.getDeviceInfo = getDeviceInfo;
|
|
54
|
+
//# sourceMappingURL=useDeviceInfoCollector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeviceInfoCollector.js","sourceRoot":"","sources":["../../src/hooks/useDeviceInfoCollector.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AAepD,MAAM,QAAQ,GAAG,GAAY,EAAE;IAC3B,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,MAAM,GAAG,KAAK,CAAC;IAEnC,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,GAAG,IAAI,WAAW,GAAG,GAAG,CAAC;AAC/D,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,GAAW,EAAE;IAChC,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;QACvD,IAAI,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YAChC,OAAO,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,UAAU,EAAE,QAAQ,EAAE,CAAC;YACvB,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;QACjC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,0CAA0C;IAC9C,CAAC;IAED,IAAI,CAAC;QACD,MAAM,SAAS,GAAG,uBAAQ,CAAC,SAAgB,CAAC;QAC5C,IAAI,SAAS,EAAE,KAAK,EAAE,CAAC;YACnB,OAAO,SAAS,CAAC,KAAK,CAAC;QAC3B,CAAC;QACD,IAAI,SAAS,EAAE,KAAK,EAAE,CAAC;YACnB,OAAO,SAAS,CAAC,KAAK,CAAC;QAC3B,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,kBAAkB;IACtB,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC,CAAC;AAEK,MAAM,aAAa,GAAG,GAAe,EAAE;IAC1C,MAAM,MAAM,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,MAAM,GAAG,yBAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAExC,OAAO;QACH,QAAQ,EAAE,uBAAQ,CAAC,EAAE;QACrB,SAAS,EAAE,uBAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE;QACtC,WAAW,EAAE,MAAM,CAAC,KAAK;QACzB,YAAY,EAAE,MAAM,CAAC,MAAM;QAC3B,WAAW,EAAE,MAAM,CAAC,KAAK;QACzB,YAAY,EAAE,MAAM,CAAC,MAAM;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;QAC3C,KAAK,EAAE,cAAc,EAAE;KAC1B,CAAC;AACN,CAAC,CAAC;AAhBW,QAAA,aAAa,iBAgBxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
export declare function useHeightAnimation(initialHeight?: number, duration?: number): {
|
|
3
|
+
animatedHeightStyle: {
|
|
4
|
+
height: Animated.Value;
|
|
5
|
+
};
|
|
6
|
+
updateHeight: (toValue: number) => void;
|
|
7
|
+
height: Animated.Value;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useHeightAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeightAnimation.d.ts","sourceRoot":"","sources":["../../src/hooks/useHeightAnimation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,wBAAgB,kBAAkB,CAAC,aAAa,SAAI,EAAE,QAAQ,SAAM;;;;4BAIlD,MAAM;;EAavB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useHeightAnimation = useHeightAnimation;
|
|
4
|
+
// hooks/useHeightAnimation.ts
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native");
|
|
7
|
+
function useHeightAnimation(initialHeight = 0, duration = 300) {
|
|
8
|
+
const height = (0, react_1.useRef)(new react_native_1.Animated.Value(initialHeight)).current;
|
|
9
|
+
const updateHeight = (0, react_1.useCallback)((toValue) => {
|
|
10
|
+
react_native_1.Animated.timing(height, {
|
|
11
|
+
toValue,
|
|
12
|
+
duration,
|
|
13
|
+
useNativeDriver: false,
|
|
14
|
+
}).start();
|
|
15
|
+
}, [height, duration]);
|
|
16
|
+
const animatedHeightStyle = { height };
|
|
17
|
+
return { animatedHeightStyle, updateHeight, height };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=useHeightAnimation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHeightAnimation.js","sourceRoot":"","sources":["../../src/hooks/useHeightAnimation.ts"],"names":[],"mappings":";;AAIA,gDAiBC;AArBD,8BAA8B;AAC9B,iCAA4C;AAC5C,+CAAwC;AAExC,SAAgB,kBAAkB,CAAC,aAAa,GAAG,CAAC,EAAE,QAAQ,GAAG,GAAG;IAChE,MAAM,MAAM,GAAG,IAAA,cAAM,EAAC,IAAI,uBAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC;IAEjE,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC5B,CAAC,OAAe,EAAE,EAAE;QAChB,uBAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;YACpB,OAAO;YACP,QAAQ;YACR,eAAe,EAAE,KAAK;SACzB,CAAC,CAAC,KAAK,EAAE,CAAC;IACf,CAAC,EACD,CAAC,MAAM,EAAE,QAAQ,CAAC,CACrB,CAAC;IAEF,MAAM,mBAAmB,GAAG,EAAE,MAAM,EAAE,CAAC;IAEvC,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WidgetOptions } from '../interfaces';
|
|
2
|
+
interface UseWidgetHeightProps {
|
|
3
|
+
options?: WidgetOptions;
|
|
4
|
+
initialHeight?: number;
|
|
5
|
+
}
|
|
6
|
+
interface UseWidgetHeightReturn {
|
|
7
|
+
height: number;
|
|
8
|
+
isFixedHeight: boolean;
|
|
9
|
+
handleResize: (newHeight: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const useWidgetHeight: ({ options, initialHeight }: UseWidgetHeightProps) => UseWidgetHeightReturn;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useWidgetHeight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetHeight.d.ts","sourceRoot":"","sources":["../../src/hooks/useWidgetHeight.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,UAAU,oBAAoB;IAC5B,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,eAAe,GAAI,4BAG7B,oBAAoB,KAAG,qBAoBzB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useWidgetHeight = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useWidgetHeight = ({ options, initialHeight = 300 }) => {
|
|
6
|
+
const [dynamicHeight, setDynamicHeight] = (0, react_1.useState)(initialHeight);
|
|
7
|
+
const hasFixedHeight = typeof options?.height === 'number';
|
|
8
|
+
const height = hasFixedHeight ? options.height : dynamicHeight;
|
|
9
|
+
const handleResize = (0, react_1.useCallback)((newHeight) => {
|
|
10
|
+
if (!hasFixedHeight && newHeight > 0) {
|
|
11
|
+
setDynamicHeight(newHeight);
|
|
12
|
+
}
|
|
13
|
+
}, [hasFixedHeight]);
|
|
14
|
+
return {
|
|
15
|
+
height,
|
|
16
|
+
isFixedHeight: hasFixedHeight,
|
|
17
|
+
handleResize
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
exports.useWidgetHeight = useWidgetHeight;
|
|
21
|
+
//# sourceMappingURL=useWidgetHeight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWidgetHeight.js","sourceRoot":"","sources":["../../src/hooks/useWidgetHeight.ts"],"names":[],"mappings":";;;AAAA,iCAA8C;AAcvC,MAAM,eAAe,GAAG,CAAC,EAC9B,OAAO,EACP,aAAa,GAAG,GAAG,EACE,EAAyB,EAAE;IAChD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAS,aAAa,CAAC,CAAC;IAC1E,MAAM,cAAc,GAAG,OAAO,OAAO,EAAE,MAAM,KAAK,QAAQ,CAAC;IAE3D,MAAM,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC,OAAQ,CAAC,MAAO,CAAC,CAAC,CAAC,aAAa,CAAC;IAEjE,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,SAAiB,EAAE,EAAE;QACpB,IAAI,CAAC,cAAc,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YACrC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO;QACL,MAAM;QACN,aAAa,EAAE,cAAc;QAC7B,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,eAAe,mBAuB1B"}
|