@bangkeut-technology/supportdock-sdk 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -88,6 +88,24 @@ await sdk.sendFeedback({
88
88
  subject?: string, // auto-generated from type if omitted
89
89
  metadata?: Record<string, string>,
90
90
  source?: string, // default: 'mobile-app'
91
+ images?: string[], // up to 3 base64 data URLs (PNG/JPEG/WebP/GIF, each ≤ 2 MB)
92
+ });
93
+ ```
94
+
95
+ #### Attaching images
96
+
97
+ ```ts
98
+ // Convert a local image to base64 (React Native example)
99
+ import * as FileSystem from 'expo-file-system';
100
+
101
+ const base64 = await FileSystem.readAsStringAsync(imageUri, {
102
+ encoding: FileSystem.EncodingType.Base64,
103
+ });
104
+
105
+ await sdk.sendFeedback({
106
+ type: 'bug',
107
+ message: 'UI is broken on this screen',
108
+ images: [`data:image/png;base64,${base64}`],
91
109
  });
92
110
  ```
93
111
 
@@ -117,7 +135,7 @@ try {
117
135
  } catch (err) {
118
136
  if (err instanceof SupportDockError) {
119
137
  console.log(err.message); // Error message from API
120
- console.log(err.status); // HTTP status code (401, 429, etc.)
138
+ console.log(err.status); // HTTP status code (401, 429, etc.)
121
139
  }
122
140
  }
123
141
  ```
package/dist/client.js CHANGED
@@ -45,6 +45,16 @@ class SupportDockClient {
45
45
  */
46
46
  async sendFeedback(options) {
47
47
  const metadata = { ...this.defaultMetadata, ...options.metadata };
48
+ if (options.images) {
49
+ if (options.images.length > 3) {
50
+ throw new SupportDockError('Maximum 3 images allowed', 400);
51
+ }
52
+ for (const img of options.images) {
53
+ if (!/^data:image\/(png|jpeg|webp|gif);base64,/.test(img)) {
54
+ throw new SupportDockError('Images must be base64-encoded data URLs (PNG, JPEG, WebP, or GIF)', 400);
55
+ }
56
+ }
57
+ }
48
58
  return this.request('/api/feedback/remote', {
49
59
  method: 'POST',
50
60
  body: JSON.stringify({
@@ -55,6 +65,7 @@ class SupportDockClient {
55
65
  subject: options.subject,
56
66
  metadata: Object.keys(metadata).length > 0 ? metadata : undefined,
57
67
  source: options.source ?? 'mobile-app',
68
+ images: options.images,
58
69
  }),
59
70
  });
60
71
  }
package/dist/types.d.ts CHANGED
@@ -14,6 +14,8 @@ export interface FeedbackOptions {
14
14
  metadata?: Record<string, string>;
15
15
  /** Source identifier (defaults to 'mobile-app'). */
16
16
  source?: string;
17
+ /** Up to 3 base64-encoded data-URL images (PNG, JPEG, WebP, or GIF; each ≤ 2 MB). */
18
+ images?: string[];
17
19
  }
18
20
  export interface FeedbackResult {
19
21
  success: boolean;
package/package.json CHANGED
@@ -1,15 +1,24 @@
1
1
  {
2
2
  "name": "@bangkeut-technology/supportdock-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "SupportDock SDK — submit feedback and manage FAQs from your React Native / Expo app",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "files": ["dist"],
7
+ "files": [
8
+ "dist"
9
+ ],
8
10
  "scripts": {
9
11
  "build": "tsc",
10
12
  "prepublishOnly": "npm run build"
11
13
  },
12
- "keywords": ["supportdock", "feedback", "faq", "react-native", "expo", "sdk"],
14
+ "keywords": [
15
+ "supportdock",
16
+ "feedback",
17
+ "faq",
18
+ "react-native",
19
+ "expo",
20
+ "sdk"
21
+ ],
13
22
  "license": "MIT",
14
23
  "publishConfig": {
15
24
  "access": "public"