@webority/mobile-support 0.0.9

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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -0
  3. package/lib/commonjs/SupportProvider.js +335 -0
  4. package/lib/commonjs/client.js +164 -0
  5. package/lib/commonjs/clipboard.js +10 -0
  6. package/lib/commonjs/components/Attachments.js +246 -0
  7. package/lib/commonjs/components/NewSupportTicket.js +210 -0
  8. package/lib/commonjs/components/PhotoTray.js +141 -0
  9. package/lib/commonjs/components/SupportContact.js +134 -0
  10. package/lib/commonjs/components/SupportTicketDetail.js +348 -0
  11. package/lib/commonjs/components/SupportTicketList.js +279 -0
  12. package/lib/commonjs/device.js +29 -0
  13. package/lib/commonjs/files.js +37 -0
  14. package/lib/commonjs/format.js +29 -0
  15. package/lib/commonjs/index.js +97 -0
  16. package/lib/commonjs/package.json +1 -0
  17. package/lib/commonjs/photos.js +67 -0
  18. package/lib/commonjs/report/ReportIssueButton.js +57 -0
  19. package/lib/commonjs/report/captureAndReport.js +34 -0
  20. package/lib/commonjs/report/index.js +20 -0
  21. package/lib/commonjs/share/index.js +44 -0
  22. package/lib/commonjs/types.js +2 -0
  23. package/lib/commonjs/validation.js +45 -0
  24. package/lib/module/SupportProvider.js +323 -0
  25. package/lib/module/client.js +156 -0
  26. package/lib/module/clipboard.js +5 -0
  27. package/lib/module/components/Attachments.js +240 -0
  28. package/lib/module/components/NewSupportTicket.js +205 -0
  29. package/lib/module/components/PhotoTray.js +136 -0
  30. package/lib/module/components/SupportContact.js +129 -0
  31. package/lib/module/components/SupportTicketDetail.js +343 -0
  32. package/lib/module/components/SupportTicketList.js +273 -0
  33. package/lib/module/device.js +24 -0
  34. package/lib/module/files.js +31 -0
  35. package/lib/module/format.js +23 -0
  36. package/lib/module/index.js +10 -0
  37. package/lib/module/package.json +1 -0
  38. package/lib/module/photos.js +61 -0
  39. package/lib/module/report/ReportIssueButton.js +52 -0
  40. package/lib/module/report/captureAndReport.js +29 -0
  41. package/lib/module/report/index.js +12 -0
  42. package/lib/module/share/index.js +37 -0
  43. package/lib/module/types.js +2 -0
  44. package/lib/module/validation.js +38 -0
  45. package/lib/typescript/commonjs/SupportProvider.d.ts +82 -0
  46. package/lib/typescript/commonjs/client.d.ts +63 -0
  47. package/lib/typescript/commonjs/clipboard.d.ts +3 -0
  48. package/lib/typescript/commonjs/components/Attachments.d.ts +16 -0
  49. package/lib/typescript/commonjs/components/NewSupportTicket.d.ts +12 -0
  50. package/lib/typescript/commonjs/components/PhotoTray.d.ts +17 -0
  51. package/lib/typescript/commonjs/components/SupportContact.d.ts +7 -0
  52. package/lib/typescript/commonjs/components/SupportTicketDetail.d.ts +7 -0
  53. package/lib/typescript/commonjs/components/SupportTicketList.d.ts +28 -0
  54. package/lib/typescript/commonjs/device.d.ts +6 -0
  55. package/lib/typescript/commonjs/files.d.ts +10 -0
  56. package/lib/typescript/commonjs/format.d.ts +10 -0
  57. package/lib/typescript/commonjs/index.d.ts +15 -0
  58. package/lib/typescript/commonjs/package.json +1 -0
  59. package/lib/typescript/commonjs/photos.d.ts +16 -0
  60. package/lib/typescript/commonjs/report/ReportIssueButton.d.ts +14 -0
  61. package/lib/typescript/commonjs/report/captureAndReport.d.ts +15 -0
  62. package/lib/typescript/commonjs/report/index.d.ts +11 -0
  63. package/lib/typescript/commonjs/share/index.d.ts +10 -0
  64. package/lib/typescript/commonjs/types.d.ts +152 -0
  65. package/lib/typescript/commonjs/validation.d.ts +10 -0
  66. package/lib/typescript/module/SupportProvider.d.ts +82 -0
  67. package/lib/typescript/module/client.d.ts +63 -0
  68. package/lib/typescript/module/clipboard.d.ts +3 -0
  69. package/lib/typescript/module/components/Attachments.d.ts +16 -0
  70. package/lib/typescript/module/components/NewSupportTicket.d.ts +12 -0
  71. package/lib/typescript/module/components/PhotoTray.d.ts +17 -0
  72. package/lib/typescript/module/components/SupportContact.d.ts +7 -0
  73. package/lib/typescript/module/components/SupportTicketDetail.d.ts +7 -0
  74. package/lib/typescript/module/components/SupportTicketList.d.ts +28 -0
  75. package/lib/typescript/module/device.d.ts +6 -0
  76. package/lib/typescript/module/files.d.ts +10 -0
  77. package/lib/typescript/module/format.d.ts +10 -0
  78. package/lib/typescript/module/index.d.ts +15 -0
  79. package/lib/typescript/module/package.json +1 -0
  80. package/lib/typescript/module/photos.d.ts +16 -0
  81. package/lib/typescript/module/report/ReportIssueButton.d.ts +14 -0
  82. package/lib/typescript/module/report/captureAndReport.d.ts +15 -0
  83. package/lib/typescript/module/report/index.d.ts +11 -0
  84. package/lib/typescript/module/share/index.d.ts +10 -0
  85. package/lib/typescript/module/types.d.ts +152 -0
  86. package/lib/typescript/module/validation.d.ts +10 -0
  87. package/package.json +124 -0
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Wire shapes of the Webority Support HTTP contract. Field names are the camelCase
3
+ * of the backend's view records and enums travel as their member names, so these
4
+ * mirror `Webority.Support/SupportViews.cs` and `SupportEnums.cs` exactly.
5
+ */
6
+ export type SupportTicketStatus = 'Open' | 'InProgress' | 'Resolved' | 'Closed';
7
+ export type SupportTicketPriority = 'Low' | 'Normal' | 'High' | 'Urgent';
8
+ export type SupportMessageAuthorKind = 'Customer' | 'Agent' | 'System';
9
+ export type SupportAttachmentKind = 'Screenshot' | 'File';
10
+ export type SupportSatisfaction = 'Satisfied' | 'Unsatisfied';
11
+ export interface SupportContactInfo {
12
+ productName: string;
13
+ supportEmail: string;
14
+ supportName: string;
15
+ supportPhone: string | null;
16
+ supportHours: string | null;
17
+ categories: string[];
18
+ maxAttachmentBytes: number;
19
+ maxAttachmentsPerMessage: number;
20
+ allowedContentTypes: string[];
21
+ subjectMaxLength: number;
22
+ bodyMaxLength: number;
23
+ satisfactionCommentMaxLength: number;
24
+ }
25
+ export interface SupportTicketSummary {
26
+ id: string;
27
+ number: string;
28
+ category: string;
29
+ subject: string;
30
+ status: SupportTicketStatus;
31
+ statusLabel: string;
32
+ messageCount: number;
33
+ awaitingCustomer: boolean;
34
+ createdDateTimeUtc: string;
35
+ updatedDateTimeUtc: string;
36
+ }
37
+ /** The fleet pagination shape `GET {base}/tickets` returns. */
38
+ export interface SupportPage<T> {
39
+ items: T[];
40
+ page: number;
41
+ pageSize: number;
42
+ totalCount: number;
43
+ totalPages: number;
44
+ }
45
+ /** `GET {base}/tickets`. Empty or missing fields are left off the request. */
46
+ export interface SupportTicketQuery {
47
+ status?: SupportTicketStatus;
48
+ /** Matches the subject or the ticket number. */
49
+ search?: string;
50
+ /** 1-based. The server defaults to 1. */
51
+ page?: number;
52
+ /** The server defaults to 20 and caps at 100. */
53
+ pageSize?: number;
54
+ }
55
+ /** `GET {base}/tickets/counts`: the caller's tickets by status. */
56
+ export interface SupportTicketCounts {
57
+ open: number;
58
+ inProgress: number;
59
+ resolved: number;
60
+ closed: number;
61
+ total: number;
62
+ }
63
+ export interface SupportAttachmentView {
64
+ id: string;
65
+ fileName: string;
66
+ contentType: string;
67
+ sizeBytes: number;
68
+ kind: SupportAttachmentKind;
69
+ }
70
+ export interface SupportMessageView {
71
+ id: string;
72
+ authorKind: SupportMessageAuthorKind;
73
+ authorName: string | null;
74
+ body: string;
75
+ isInternal: boolean;
76
+ createdDateTimeUtc: string;
77
+ attachments: SupportAttachmentView[];
78
+ }
79
+ export interface SupportTicketDetail {
80
+ id: string;
81
+ number: string;
82
+ /** Null on the customer view: internal ids never leave the platform. */
83
+ accountId: number | null;
84
+ /** Null on the customer view. */
85
+ realm: string | null;
86
+ category: string;
87
+ subject: string;
88
+ status: SupportTicketStatus;
89
+ statusLabel: string;
90
+ priority: SupportTicketPriority | null;
91
+ reporterName: string;
92
+ reporterEmail: string;
93
+ assignedAgentUserId: number | null;
94
+ assignedAgentName: string | null;
95
+ dueDateTimeUtc: string | null;
96
+ isOverdue: boolean;
97
+ pageUrl: string | null;
98
+ userAgent: string | null;
99
+ appVersion: string | null;
100
+ satisfaction: SupportSatisfaction | null;
101
+ satisfactionComment: string | null;
102
+ canReopen: boolean;
103
+ canRate: boolean;
104
+ createdDateTimeUtc: string;
105
+ updatedDateTimeUtc: string;
106
+ resolvedDateTimeUtc: string | null;
107
+ closedDateTimeUtc: string | null;
108
+ messages: SupportMessageView[];
109
+ /** Opaque. Changes whenever the ticket changes. */
110
+ version: string;
111
+ }
112
+ /** A local file as React Native's FormData takes it. */
113
+ export interface SupportFilePart {
114
+ uri: string;
115
+ name: string;
116
+ type: string;
117
+ /** Bytes, when the picker knew it. Used for the size check only; never sent. */
118
+ size?: number;
119
+ }
120
+ export interface NewSupportTicketInput {
121
+ category: string;
122
+ subject: string;
123
+ body: string;
124
+ pageUrl?: string;
125
+ userAgent?: string;
126
+ appVersion?: string;
127
+ files?: SupportFilePart[];
128
+ screenshots?: SupportFilePart[];
129
+ }
130
+ export interface SupportReplyInput {
131
+ body: string;
132
+ files?: SupportFilePart[];
133
+ screenshots?: SupportFilePart[];
134
+ }
135
+ export interface SupportRatingInput {
136
+ satisfaction: SupportSatisfaction;
137
+ comment?: string;
138
+ }
139
+ /**
140
+ * What the report-an-issue flow hands to the new ticket screen: the captured
141
+ * screenshot and where it was taken.
142
+ */
143
+ export interface SupportTicketDraft {
144
+ category?: string;
145
+ subject?: string;
146
+ body?: string;
147
+ pageUrl?: string;
148
+ userAgent?: string;
149
+ appVersion?: string;
150
+ screenshots?: SupportFilePart[];
151
+ }
152
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { SupportContactInfo, SupportFilePart } from './types.js';
2
+ export declare const validateCategory: (category: string, config: SupportContactInfo) => string | undefined;
3
+ /** Limits come from GET /settings, so the product's own values are the only copy. */
4
+ type Limits = Pick<SupportContactInfo, 'subjectMaxLength' | 'bodyMaxLength'>;
5
+ export declare const validateSubject: (subject: string, limits: Limits) => string | undefined;
6
+ export declare const validateBody: (body: string, limits: Limits) => string | undefined;
7
+ /** Checks every file on one message against the product's limits. The first problem wins. */
8
+ export declare const validateFiles: (files: SupportFilePart[], config: SupportContactInfo) => string | undefined;
9
+ export {};
10
+ //# sourceMappingURL=validation.d.ts.map
package/package.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "@webority/mobile-support",
3
+ "version": "0.0.9",
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
+ "keywords": [
6
+ "react-native",
7
+ "support",
8
+ "helpdesk",
9
+ "tickets",
10
+ "feedback",
11
+ "webority"
12
+ ],
13
+ "homepage": "https://www.webority.com",
14
+ "license": "MIT",
15
+ "author": {
16
+ "name": "Webority Technologies",
17
+ "email": "contact@webority.com",
18
+ "url": "https://www.webority.com"
19
+ },
20
+ "exports": {
21
+ ".": {
22
+ "import": {
23
+ "types": "./lib/typescript/module/index.d.ts",
24
+ "default": "./lib/module/index.js"
25
+ },
26
+ "require": {
27
+ "types": "./lib/typescript/commonjs/index.d.ts",
28
+ "default": "./lib/commonjs/index.js"
29
+ }
30
+ },
31
+ "./report": {
32
+ "import": {
33
+ "types": "./lib/typescript/module/report/index.d.ts",
34
+ "default": "./lib/module/report/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./lib/typescript/commonjs/report/index.d.ts",
38
+ "default": "./lib/commonjs/report/index.js"
39
+ }
40
+ },
41
+ "./share": {
42
+ "import": {
43
+ "types": "./lib/typescript/module/share/index.d.ts",
44
+ "default": "./lib/module/share/index.js"
45
+ },
46
+ "require": {
47
+ "types": "./lib/typescript/commonjs/share/index.d.ts",
48
+ "default": "./lib/commonjs/share/index.js"
49
+ }
50
+ },
51
+ "./package.json": "./package.json"
52
+ },
53
+ "main": "./lib/commonjs/index.js",
54
+ "module": "./lib/module/index.js",
55
+ "react-native": "./lib/module/index.js",
56
+ "types": "./lib/typescript/commonjs/index.d.ts",
57
+ "files": [
58
+ "lib",
59
+ "!**/__tests__",
60
+ "!**/*.test.*",
61
+ "!**/*.spec.*",
62
+ "!**/*.map"
63
+ ],
64
+ "scripts": {
65
+ "build": "bob build",
66
+ "clean": "rimraf lib",
67
+ "lint": "biome lint ./src",
68
+ "lint:fix": "biome lint --write ./src",
69
+ "test": "jest",
70
+ "typecheck": "tsc --noEmit"
71
+ },
72
+ "dependencies": {
73
+ "@webority/mobile-core": "^0.0.23",
74
+ "@webority/mobile-ui": "^0.0.33"
75
+ },
76
+ "peerDependencies": {
77
+ "expo": ">=57.0.0",
78
+ "expo-clipboard": ">=57.0.0",
79
+ "expo-file-system": ">=57.0.0",
80
+ "expo-image-manipulator": ">=57.0.0",
81
+ "expo-image-picker": ">=57.0.0",
82
+ "expo-sharing": ">=57.0.0",
83
+ "react": "^19.1.0",
84
+ "react-native": ">=0.81.0",
85
+ "react-native-gesture-handler": "^2.21.0 || ^3.0.0",
86
+ "react-native-view-shot": ">=4.0.0"
87
+ },
88
+ "peerDependenciesMeta": {
89
+ "expo-sharing": {
90
+ "optional": true
91
+ },
92
+ "react-native-view-shot": {
93
+ "optional": true
94
+ }
95
+ },
96
+ "publishConfig": {
97
+ "access": "public",
98
+ "registry": "https://registry.npmjs.org/"
99
+ },
100
+ "react-native-builder-bob": {
101
+ "source": "src",
102
+ "output": "lib",
103
+ "targets": [
104
+ [
105
+ "commonjs",
106
+ {
107
+ "esm": true
108
+ }
109
+ ],
110
+ [
111
+ "module",
112
+ {
113
+ "esm": true
114
+ }
115
+ ],
116
+ [
117
+ "typescript",
118
+ {
119
+ "project": "tsconfig.build.json"
120
+ }
121
+ ]
122
+ ]
123
+ }
124
+ }