@myapihq/sdk 2.18.0 → 2.19.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.
@@ -85,6 +85,20 @@ export interface ListFeedbackOptions {
85
85
  limit?: number;
86
86
  offset?: number;
87
87
  }
88
+ /** What a widget is allowed to collect from the reporter's page.
89
+ *
90
+ * Both default to true server-side. An ABSENT field means "leave it alone",
91
+ * never "off" — every widget embedded before capture existed keeps behaving
92
+ * exactly as it did, and a partial update must not flip the field the operator
93
+ * did not mention.
94
+ *
95
+ * `text: false` keeps the SHAPE of the element the reporter pointed at — tag,
96
+ * role, id, data-feedback-id — and drops the words inside it. On a table row
97
+ * that is the difference between "row, id row-8" and the tenant's name. */
98
+ export interface WidgetCapture {
99
+ screenshot?: boolean;
100
+ text?: boolean;
101
+ }
88
102
  export interface Widget {
89
103
  id: string;
90
104
  org_id: string;
@@ -97,6 +111,7 @@ export interface Widget {
97
111
  position?: string;
98
112
  label?: string;
99
113
  };
114
+ capture?: WidgetCapture;
100
115
  script_tag?: string;
101
116
  created_at: string;
102
117
  }
@@ -121,7 +136,7 @@ export interface CreateFeedbackInput {
121
136
  export declare function createFeedback(apiKey: string, orgId: string, input: CreateFeedbackInput): Promise<FeedbackItem>;
122
137
  export declare function resolveFeedback(apiKey: string, orgId: string, id: string): Promise<void>;
123
138
  export declare function deleteFeedback(apiKey: string, orgId: string, id: string): Promise<void>;
124
- export declare function createWidget(apiKey: string, orgId: string, name: string, allowedOrigins?: string[]): Promise<Widget>;
139
+ export declare function createWidget(apiKey: string, orgId: string, name: string, allowedOrigins?: string[], capture?: WidgetCapture): Promise<Widget>;
125
140
  /** Where the button appears and how it looks. Routes are compiled into the
126
141
  * hosted widget.js, which is why changing them here reaches browsers within
127
142
  * ~5 minutes without the customer redeploying their site. */
@@ -134,6 +149,7 @@ export interface WidgetUpdate {
134
149
  position?: string;
135
150
  label?: string;
136
151
  };
152
+ capture?: WidgetCapture;
137
153
  }
138
154
  export declare function updateWidget(apiKey: string, orgId: string, id: string, patch: WidgetUpdate): Promise<Widget>;
139
155
  export declare function listWidgets(apiKey: string, orgId: string): Promise<Widget[]>;
package/dist/feedback.js CHANGED
@@ -61,10 +61,12 @@ async function deleteFeedback(apiKey, orgId, id) {
61
61
  // nobody — it names an org so a page can submit without a credential. Set
62
62
  // `allowed_origins` so another site cannot post through it, and revoke it if
63
63
  // it is abused; the feedback already collected is kept.
64
- async function createWidget(apiKey, orgId, name, allowedOrigins) {
64
+ async function createWidget(apiKey, orgId, name, allowedOrigins, capture) {
65
65
  const body = { name };
66
66
  if (allowedOrigins?.length)
67
67
  body.allowed_origins = allowedOrigins;
68
+ if (capture && Object.keys(capture).length)
69
+ body.capture = capture;
68
70
  return (0, client_1.request)('POST', `${orgBase(orgId)}/widgets`, apiKey, body);
69
71
  }
70
72
  // Every field optional, and an omitted field keeps its value — so this is a
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.18.0";
1
+ export declare const SDK_VERSION = "2.19.0";
package/dist/version.js CHANGED
@@ -8,4 +8,4 @@ exports.SDK_VERSION = void 0;
8
8
  // Why a constant and not a package.json read: the SDK runs inside edge
9
9
  // functions (Cloudflare Workers), so it must not import node:fs. A literal
10
10
  // is the only version source that works in every runtime we ship to.
11
- exports.SDK_VERSION = '2.18.0';
11
+ exports.SDK_VERSION = '2.19.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@myapihq/sdk",
3
3
  "license": "Apache-2.0",
4
- "version": "2.18.0",
4
+ "version": "2.19.0",
5
5
  "description": "TypeScript SDK for the MyAPI ecosystem",
6
6
  "repository": {
7
7
  "type": "git",