@webority/mobile-insights 0.129.0 → 0.130.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FeedbackButton=void 0;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_client=require("./client.js"),_InsightsFeedbackProvider=require("./InsightsFeedbackProvider.js"),_jsxRuntime=require("react/jsx-runtime");const MAX_LENGTH=1e3,FeedbackButton=({label:e="Feedback",title:t="Send us feedback",placeholder:i="Tell us what works and what does not",sendLabel:s="Send",cancelLabel:a="Cancel",thanks:n="Thanks, we read every message.",pagePath:l})=>{const{client:r}=(0,_InsightsFeedbackProvider.useInsightsFeedback)(),o=(0,_mobileUi.useTheme)(),c=(0,_react.useMemo)(()=>buildStyles(o),[o]),[d,u]=(0,_react.useState)(!1),[b
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FeedbackButton=void 0;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_client=require("./client.js"),_InsightsFeedbackProvider=require("./InsightsFeedbackProvider.js"),_jsxRuntime=require("react/jsx-runtime");const MAX_LENGTH=1e3,FeedbackButton=({label:e="Feedback",title:t="Send us feedback",placeholder:i="Tell us what works and what does not",sendLabel:s="Send",cancelLabel:a="Cancel",thanks:n="Thanks, we read every message.",pagePath:l})=>{const{client:r}=(0,_InsightsFeedbackProvider.useInsightsFeedback)(),o=(0,_mobileUi.useTheme)(),c=(0,_react.useMemo)(()=>buildStyles(o),[o]),[d,u]=(0,_react.useState)(!1),[m,b]=(0,_react.useState)(""),[_,x]=(0,_react.useState)(!1),[j,h]=(0,_react.useState)(!1),[g,p]=(0,_react.useState)(null),v=m.trim(),y=v.length-1e3,R=v.length>0&&y<=0;return(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:e,onPress:()=>{h(!1),p(null),u(!0)}}),(0,_jsxRuntime.jsx)(_mobileUi.Modal,{open:d,onClose:()=>u(!1),accessibilityLabel:t,children:(0,_jsxRuntime.jsxs)(_mobileUi.KeyboardAwareScrollView,{contentContainerStyle:c.content,safeAreaEdges:[],children:[(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"title",children:t}),j?(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"body",color:"secondary",accessibilityLiveRegion:"polite",children:n}):(0,_jsxRuntime.jsxs)(_jsxRuntime.Fragment,{children:[(0,_jsxRuntime.jsx)(_mobileUi.Input,{accessibilityLabel:i,placeholder:i,multiline:!0,value:m,onChangeText:b,disabled:_,helperText:`${v.length} / 1000`,error:y>0?`Up to 1000 characters; remove ${y} to send.`:void 0}),null!==g&&(0,_jsxRuntime.jsx)(_mobileUi.Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:g}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:c.actions,children:[(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:a,variant:"ghost",onPress:()=>u(!1),disabled:_}),(0,_jsxRuntime.jsx)(_mobileUi.Button,{label:s,onPress:()=>{(async()=>{x(!0),p(null);try{await r.leaveComment({comment:v,pagePath:l}),b(""),h(!0)}catch(e){p((0,_client.toInsightsApiError)(e).message)}finally{x(!1)}})()},disabled:!R||_,loading:_})]})]})]})})]})};exports.FeedbackButton=FeedbackButton;const buildStyles=e=>_reactNative.StyleSheet.create({content:{padding:e.space.md,gap:e.space.md},actions:{flexDirection:"row",justifyContent:"flex-end",gap:e.space.sm}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Button,Input,KeyboardAwareScrollView,Modal,Text,useTheme}from"@webority/mobile-ui";import{useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{toInsightsApiError}from"./client.js";import{useInsightsFeedback}from"./InsightsFeedbackProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MAX_LENGTH=1e3;export const FeedbackButton=({label:e="Feedback",title:t="Send us feedback",placeholder:s="Tell us what works and what does not",sendLabel:a="Send",cancelLabel:n="Cancel",thanks:l="Thanks, we read every message.",pagePath:
|
|
1
|
+
"use strict";import{Button,Input,KeyboardAwareScrollView,Modal,Text,useTheme}from"@webority/mobile-ui";import{useMemo,useState}from"react";import{StyleSheet,View}from"react-native";import{toInsightsApiError}from"./client.js";import{useInsightsFeedback}from"./InsightsFeedbackProvider.js";import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from"react/jsx-runtime";const MAX_LENGTH=1e3;export const FeedbackButton=({label:e="Feedback",title:t="Send us feedback",placeholder:s="Tell us what works and what does not",sendLabel:a="Send",cancelLabel:n="Cancel",thanks:l="Thanks, we read every message.",pagePath:o})=>{const{client:i}=useInsightsFeedback(),r=useTheme(),c=useMemo(()=>buildStyles(r),[r]),[d,m]=useState(!1),[u,h]=useState(""),[b,g]=useState(!1),[p,x]=useState(!1),[y,j]=useState(null),S=u.trim(),_=S.length-1e3,v=S.length>0&&_<=0;return _jsxs(_Fragment,{children:[_jsx(Button,{label:e,onPress:()=>{x(!1),j(null),m(!0)}}),_jsx(Modal,{open:d,onClose:()=>m(!1),accessibilityLabel:t,children:_jsxs(KeyboardAwareScrollView,{contentContainerStyle:c.content,safeAreaEdges:[],children:[_jsx(Text,{variant:"title",children:t}),p?_jsx(Text,{variant:"body",color:"secondary",accessibilityLiveRegion:"polite",children:l}):_jsxs(_Fragment,{children:[_jsx(Input,{accessibilityLabel:s,placeholder:s,multiline:!0,value:u,onChangeText:h,disabled:b,helperText:`${S.length} / 1000`,error:_>0?`Up to 1000 characters; remove ${_} to send.`:void 0}),null!==y&&_jsx(Text,{variant:"bodySmall",color:"danger",accessibilityLiveRegion:"polite",children:y}),_jsxs(View,{style:c.actions,children:[_jsx(Button,{label:n,variant:"ghost",onPress:()=>m(!1),disabled:b}),_jsx(Button,{label:a,onPress:()=>{(async()=>{g(!0),j(null);try{await i.leaveComment({comment:S,pagePath:o}),h(""),x(!0)}catch(e){j(toInsightsApiError(e).message)}finally{g(!1)}})()},disabled:!v||b,loading:b})]})]})]})})]})};const buildStyles=e=>StyleSheet.create({content:{padding:e.space.md,gap:e.space.md},actions:{flexDirection:"row",justifyContent:"flex-end",gap:e.space.sm}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-insights",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.130.1",
|
|
4
4
|
"description": "Product feedback for Webority React Native apps: the NPS question and a feedback button that post to the product's Webority.Insights feedback API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"!**/*.map"
|
|
41
41
|
],
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@webority/mobile-core": "0.
|
|
44
|
-
"@webority/mobile-ui": "0.
|
|
43
|
+
"@webority/mobile-core": "0.130.1",
|
|
44
|
+
"@webority/mobile-ui": "0.130.1",
|
|
45
45
|
"expo": ">=57.0.0",
|
|
46
46
|
"react": "^19.1.0",
|
|
47
47
|
"react-native": ">=0.81.0",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"@react-native/metro-config": "0.86.3",
|
|
82
82
|
"@testing-library/react-native": "12.9.0",
|
|
83
83
|
"@types/react": "19.2.18",
|
|
84
|
-
"@webority/mobile-core": "0.
|
|
84
|
+
"@webority/mobile-core": "0.130.1",
|
|
85
85
|
"@webority/mobile-dev": "0.0.0",
|
|
86
|
-
"@webority/mobile-ui": "0.
|
|
86
|
+
"@webority/mobile-ui": "0.130.1",
|
|
87
87
|
"expo": "57.0.31",
|
|
88
88
|
"jest": "29.7.0",
|
|
89
89
|
"react": "19.2.8",
|