@webority/mobile-support 0.15.0 → 0.16.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.ReportIssueButton=void 0;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_captureAndReport=require("./captureAndReport.js"),_jsxRuntime=require("react/jsx-runtime");const ReportIssueButton=({onReport:e,onCaptureError:t,screenName:r,appVersion:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReportIssueButton=void 0;var _mobileUi=require("@webority/mobile-ui"),_react=require("react"),_reactNative=require("react-native"),_captureAndReport=require("./captureAndReport.js"),_jsxRuntime=require("react/jsx-runtime");const ReportIssueButton=({onReport:e,onCaptureError:t,captureScreenshot:s=!1,screenName:r,appVersion:i,category:a,subject:o,title:n="Report an issue",accessibilityLabel:u="Report an issue with this screen",testID:c="support-report-issue",...p})=>{const l=(0,_mobileUi.useTheme)(),[d,b]=(0,_react.useState)(!1),draftWithoutScreenshot=()=>({category:a,subject:o,pageUrl:r,appVersion:i}),_=(0,_jsxRuntime.jsx)(_mobileUi.Button,{leftIcon:"message-question",...p,title:n,accessibilityLabel:u,testID:c,disabled:p.disabled||d,onPress:()=>e(draftWithoutScreenshot())});return s?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:{gap:l.spacing.sm},children:[_,(0,_jsxRuntime.jsx)(_mobileUi.Button,{variant:"outline",title:"Add a screenshot",accessibilityLabel:"Add a screenshot",testID:`${c}-screenshot`,loading:d,disabled:p.disabled,onPress:()=>{(async()=>{b(!0);try{e(await(0,_captureAndReport.captureAndReport)({screenName:r,appVersion:i,category:a,subject:o}))}catch(s){t?.(s),e(draftWithoutScreenshot())}finally{b(!1)}})()}})]}):_};exports.ReportIssueButton=ReportIssueButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{Button}from"@webority/mobile-ui";import{useState}from"react";import{captureAndReport}from"./captureAndReport.js";import{jsx as _jsx}from"react/jsx-runtime";export const ReportIssueButton=({onReport:
|
|
1
|
+
"use strict";import{Button,useTheme}from"@webority/mobile-ui";import{useState}from"react";import{View}from"react-native";import{captureAndReport}from"./captureAndReport.js";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";export const ReportIssueButton=({onReport:e,onCaptureError:t,captureScreenshot:s=!1,screenName:r,appVersion:a,category:o,subject:i,title:n="Report an issue",accessibilityLabel:c="Report an issue with this screen",testID:p="support-report-issue",...u})=>{const l=useTheme(),[m,d]=useState(!1),draftWithoutScreenshot=()=>({category:o,subject:i,pageUrl:r,appVersion:a}),b=_jsx(Button,{leftIcon:"message-question",...u,title:n,accessibilityLabel:c,testID:p,disabled:u.disabled||m,onPress:()=>e(draftWithoutScreenshot())});return s?_jsxs(View,{style:{gap:l.spacing.sm},children:[b,_jsx(Button,{variant:"outline",title:"Add a screenshot",accessibilityLabel:"Add a screenshot",testID:`${p}-screenshot`,loading:m,disabled:u.disabled,onPress:()=>{(async()=>{d(!0);try{e(await captureAndReport({screenName:r,appVersion:a,category:o,subject:i}))}catch(s){t?.(s),e(draftWithoutScreenshot())}finally{d(!1)}})()}})]}):b};
|
|
@@ -5,10 +5,15 @@ import { type CaptureAndReportOptions } from './captureAndReport';
|
|
|
5
5
|
export interface ReportIssueButtonProps extends CaptureAndReportOptions, Omit<ButtonProps, 'onPress' | 'title' | 'children' | 'loading'> {
|
|
6
6
|
/** Open the new ticket screen with this draft, for example `navigation.navigate('NewTicket', { draft })`. */
|
|
7
7
|
onReport: (draft: SupportTicketDraft) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Adds an Add a screenshot button beside the report button. Only that button
|
|
10
|
+
* captures the screen, so nothing is captured unless the person asks.
|
|
11
|
+
*/
|
|
12
|
+
captureScreenshot?: boolean;
|
|
8
13
|
/** Called when the screen could not be captured. The draft still opens, without a screenshot. */
|
|
9
14
|
onCaptureError?: (error: unknown) => void;
|
|
10
15
|
title?: string;
|
|
11
16
|
}
|
|
12
|
-
/** A button that
|
|
17
|
+
/** A button that hands a prefilled ticket draft to the app, with a screenshot only when the person asks for one. */
|
|
13
18
|
export declare const ReportIssueButton: React.FC<ReportIssueButtonProps>;
|
|
14
19
|
//# sourceMappingURL=ReportIssueButton.d.ts.map
|
|
@@ -5,10 +5,15 @@ import { type CaptureAndReportOptions } from './captureAndReport.js';
|
|
|
5
5
|
export interface ReportIssueButtonProps extends CaptureAndReportOptions, Omit<ButtonProps, 'onPress' | 'title' | 'children' | 'loading'> {
|
|
6
6
|
/** Open the new ticket screen with this draft, for example `navigation.navigate('NewTicket', { draft })`. */
|
|
7
7
|
onReport: (draft: SupportTicketDraft) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Adds an Add a screenshot button beside the report button. Only that button
|
|
10
|
+
* captures the screen, so nothing is captured unless the person asks.
|
|
11
|
+
*/
|
|
12
|
+
captureScreenshot?: boolean;
|
|
8
13
|
/** Called when the screen could not be captured. The draft still opens, without a screenshot. */
|
|
9
14
|
onCaptureError?: (error: unknown) => void;
|
|
10
15
|
title?: string;
|
|
11
16
|
}
|
|
12
|
-
/** A button that
|
|
17
|
+
/** A button that hands a prefilled ticket draft to the app, with a screenshot only when the person asks for one. */
|
|
13
18
|
export declare const ReportIssueButton: React.FC<ReportIssueButtonProps>;
|
|
14
19
|
//# sourceMappingURL=ReportIssueButton.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-support",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "Customer support tickets for Webority React Native apps: the support API client, hooks, ticket screens, contact card and a report-an-issue button that attaches a screenshot.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"!**/*.map"
|
|
63
63
|
],
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@webority/mobile-core": ">=0.
|
|
66
|
-
"@webority/mobile-ui": ">=0.
|
|
65
|
+
"@webority/mobile-core": ">=0.16.0 <0.17.0",
|
|
66
|
+
"@webority/mobile-ui": ">=0.16.0 <0.17.0",
|
|
67
67
|
"expo": ">=57.0.0",
|
|
68
68
|
"expo-clipboard": ">=57.0.0",
|
|
69
69
|
"expo-file-system": ">=57.0.0",
|
|
@@ -114,8 +114,8 @@
|
|
|
114
114
|
]
|
|
115
115
|
},
|
|
116
116
|
"devDependencies": {
|
|
117
|
-
"@webority/mobile-
|
|
118
|
-
"@webority/mobile-
|
|
117
|
+
"@webority/mobile-ui": "0.16.1",
|
|
118
|
+
"@webority/mobile-core": "0.16.1"
|
|
119
119
|
},
|
|
120
120
|
"scripts": {
|
|
121
121
|
"build": "bob build && node ../../scripts/minify-lib.mjs",
|