@webority/mobile-support 0.0.11 → 0.0.13
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/LICENSE.txt +9 -0
- package/lib/commonjs/client.js +3 -18
- package/lib/module/client.js +2 -15
- package/lib/typescript/commonjs/client.d.ts +0 -1
- package/lib/typescript/module/client.d.ts +0 -1
- package/package.json +8 -6
- package/LICENSE +0 -21
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Copyright (c) Webority Technologies. All rights reserved.
|
|
2
|
+
|
|
3
|
+
This software and its NuGet packages are the proprietary and confidential property
|
|
4
|
+
of Webority Technologies. They are published publicly only for the convenience of
|
|
5
|
+
Webority's own projects and internal consumption.
|
|
6
|
+
|
|
7
|
+
No license or right to use, copy, modify, merge, publish, distribute, sublicense,
|
|
8
|
+
or create derivative works is granted to any third party. Unauthorized use,
|
|
9
|
+
reproduction, or distribution is prohibited.
|
package/lib/commonjs/client.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.toSupportApiError = exports.
|
|
6
|
+
exports.toSupportApiError = exports.createSupportClient = exports.SupportApiError = exports.OFFLINE_MESSAGE = exports.GENERIC_MESSAGE = void 0;
|
|
7
|
+
var _mobileCore = require("@webority/mobile-core");
|
|
7
8
|
/**
|
|
8
9
|
* The slice of an HTTP client the support client needs. The app's signed-in
|
|
9
10
|
* axios instance (mobile-core's `userClient`, or its own) satisfies it as is, so
|
|
@@ -56,22 +57,6 @@ const UPLOAD_TIMEOUT_MS = 300000;
|
|
|
56
57
|
const MULTIPART = {
|
|
57
58
|
'Content-Type': 'multipart/form-data'
|
|
58
59
|
};
|
|
59
|
-
const B64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
60
|
-
const encodeBase64 = buffer => {
|
|
61
|
-
const bytes = new Uint8Array(buffer);
|
|
62
|
-
let out = '';
|
|
63
|
-
for (let i = 0; i < bytes.length; i += 3) {
|
|
64
|
-
const b0 = bytes[i];
|
|
65
|
-
const b1 = i + 1 < bytes.length ? bytes[i + 1] : undefined;
|
|
66
|
-
const b2 = i + 2 < bytes.length ? bytes[i + 2] : undefined;
|
|
67
|
-
out += B64[b0 >> 2];
|
|
68
|
-
out += B64[(b0 & 0x03) << 4 | (b1 ?? 0) >> 4];
|
|
69
|
-
out += b1 === undefined ? '=' : B64[(b1 & 0x0f) << 2 | (b2 ?? 0) >> 6];
|
|
70
|
-
out += b2 === undefined ? '=' : B64[b2 & 0x3f];
|
|
71
|
-
}
|
|
72
|
-
return out;
|
|
73
|
-
};
|
|
74
|
-
exports.encodeBase64 = encodeBase64;
|
|
75
60
|
const appendParts = (form, field, parts) => {
|
|
76
61
|
for (const part of parts ?? []) {
|
|
77
62
|
// React Native's FormData takes a { uri, name, type } object as a file part.
|
|
@@ -153,7 +138,7 @@ const createSupportClient = (http, basePath = '/api/support') => {
|
|
|
153
138
|
getAttachmentBytes: getBytes,
|
|
154
139
|
getAttachmentDataUri: async attachment => {
|
|
155
140
|
const bytes = await getBytes(attachment.id);
|
|
156
|
-
return `data:${attachment.contentType};base64,${encodeBase64(bytes)}`;
|
|
141
|
+
return `data:${attachment.contentType};base64,${(0, _mobileCore.encodeBase64)(bytes)}`;
|
|
157
142
|
},
|
|
158
143
|
confirmAction: token => call(() => http.post(`${base}/actions/confirm`, {
|
|
159
144
|
token
|
package/lib/module/client.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { encodeBase64 } from '@webority/mobile-core';
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* The slice of an HTTP client the support client needs. The app's signed-in
|
|
5
7
|
* axios instance (mobile-core's `userClient`, or its own) satisfies it as is, so
|
|
@@ -50,21 +52,6 @@ const UPLOAD_TIMEOUT_MS = 300000;
|
|
|
50
52
|
const MULTIPART = {
|
|
51
53
|
'Content-Type': 'multipart/form-data'
|
|
52
54
|
};
|
|
53
|
-
const B64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
54
|
-
export const encodeBase64 = buffer => {
|
|
55
|
-
const bytes = new Uint8Array(buffer);
|
|
56
|
-
let out = '';
|
|
57
|
-
for (let i = 0; i < bytes.length; i += 3) {
|
|
58
|
-
const b0 = bytes[i];
|
|
59
|
-
const b1 = i + 1 < bytes.length ? bytes[i + 1] : undefined;
|
|
60
|
-
const b2 = i + 2 < bytes.length ? bytes[i + 2] : undefined;
|
|
61
|
-
out += B64[b0 >> 2];
|
|
62
|
-
out += B64[(b0 & 0x03) << 4 | (b1 ?? 0) >> 4];
|
|
63
|
-
out += b1 === undefined ? '=' : B64[(b1 & 0x0f) << 2 | (b2 ?? 0) >> 6];
|
|
64
|
-
out += b2 === undefined ? '=' : B64[b2 & 0x3f];
|
|
65
|
-
}
|
|
66
|
-
return out;
|
|
67
|
-
};
|
|
68
55
|
const appendParts = (form, field, parts) => {
|
|
69
56
|
for (const part of parts ?? []) {
|
|
70
57
|
// React Native's FormData takes a { uri, name, type } object as a file part.
|
|
@@ -32,7 +32,6 @@ export declare class SupportApiError extends Error {
|
|
|
32
32
|
}
|
|
33
33
|
/** Turns whatever the HTTP client threw into a SupportApiError. */
|
|
34
34
|
export declare const toSupportApiError: (error: unknown) => SupportApiError;
|
|
35
|
-
export declare const encodeBase64: (buffer: ArrayBuffer) => string;
|
|
36
35
|
export interface SupportClient {
|
|
37
36
|
readonly basePath: string;
|
|
38
37
|
getConfig(): Promise<SupportContactInfo>;
|
|
@@ -32,7 +32,6 @@ export declare class SupportApiError extends Error {
|
|
|
32
32
|
}
|
|
33
33
|
/** Turns whatever the HTTP client threw into a SupportApiError. */
|
|
34
34
|
export declare const toSupportApiError: (error: unknown) => SupportApiError;
|
|
35
|
-
export declare const encodeBase64: (buffer: ArrayBuffer) => string;
|
|
36
35
|
export interface SupportClient {
|
|
37
36
|
readonly basePath: string;
|
|
38
37
|
getConfig(): Promise<SupportContactInfo>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-support",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
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",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"webority"
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://www.webority.com",
|
|
14
|
-
"license": "
|
|
14
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
15
15
|
"author": {
|
|
16
16
|
"name": "Webority Technologies",
|
|
17
17
|
"email": "contact@webority.com",
|
|
@@ -69,11 +69,9 @@
|
|
|
69
69
|
"test": "jest",
|
|
70
70
|
"typecheck": "tsc --noEmit"
|
|
71
71
|
},
|
|
72
|
-
"dependencies": {
|
|
73
|
-
"@webority/mobile-core": "^0.0.25",
|
|
74
|
-
"@webority/mobile-ui": "^0.0.35"
|
|
75
|
-
},
|
|
76
72
|
"peerDependencies": {
|
|
73
|
+
"@webority/mobile-core": ">=0.0.27 <0.1.0",
|
|
74
|
+
"@webority/mobile-ui": ">=0.0.36 <0.1.0",
|
|
77
75
|
"expo": ">=57.0.0",
|
|
78
76
|
"expo-clipboard": ">=57.0.0",
|
|
79
77
|
"expo-file-system": ">=57.0.0",
|
|
@@ -120,5 +118,9 @@
|
|
|
120
118
|
}
|
|
121
119
|
]
|
|
122
120
|
]
|
|
121
|
+
},
|
|
122
|
+
"devDependencies": {
|
|
123
|
+
"@webority/mobile-core": "file:../core",
|
|
124
|
+
"@webority/mobile-ui": "file:../ui"
|
|
123
125
|
}
|
|
124
126
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Webority Technologies
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|