@bangkeut-technology/supportdock-sdk 0.1.0 → 0.3.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SupportDock
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.
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,7 +45,17 @@ class SupportDockClient {
45
45
  */
46
46
  async sendFeedback(options) {
47
47
  const metadata = { ...this.defaultMetadata, ...options.metadata };
48
- return this.request('/api/feedback/remote', {
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
+ }
58
+ return this.request('/api/v1/feedback/remote', {
49
59
  method: 'POST',
50
60
  body: JSON.stringify({
51
61
  type: options.type ?? 'general',
@@ -55,31 +65,32 @@ 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
  }
61
72
  // ─── FAQ ─────────────────────────────────────────────────────
62
73
  /** List all FAQ entries for this app. */
63
74
  async listFAQs() {
64
- return this.request('/api/faqs/remote');
75
+ return this.request('/api/v1/faqs/remote');
65
76
  }
66
77
  /** Create a new FAQ entry. */
67
78
  async createFAQ(options) {
68
- return this.request('/api/faqs/remote', {
79
+ return this.request('/api/v1/faqs/remote', {
69
80
  method: 'POST',
70
81
  body: JSON.stringify(options),
71
82
  });
72
83
  }
73
84
  /** Update an existing FAQ entry. */
74
85
  async updateFAQ(faqId, options) {
75
- return this.request(`/api/faqs/remote/${faqId}`, {
86
+ return this.request(`/api/v1/faqs/remote/${faqId}`, {
76
87
  method: 'PATCH',
77
88
  body: JSON.stringify(options),
78
89
  });
79
90
  }
80
91
  /** Delete a FAQ entry. */
81
92
  async deleteFAQ(faqId) {
82
- return this.request(`/api/faqs/remote/${faqId}`, {
93
+ return this.request(`/api/v1/faqs/remote/${faqId}`, {
83
94
  method: 'DELETE',
84
95
  });
85
96
  }
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.3.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"