@mindbowser_inc/ui-feedback-plugin 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.
@@ -0,0 +1,190 @@
1
+ var k = Object.defineProperty;
2
+ var x = (g, t, s) => t in g ? k(g, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : g[t] = s;
3
+ var M = (g, t, s) => x(g, typeof t != "symbol" ? t + "" : t, s);
4
+ import { e as U } from "./index-B-1NC_TX.mjs";
5
+ import { E as j, a as A, H as K, I as L, M as O, b as $, S as q, c as F, d as G, g as J, f as Q, i as V, r as W, h as X } from "./index-B-1NC_TX.mjs";
6
+ import { b as I, i as B } from "./stream-collector-mh16BUWl.mjs";
7
+ class R {
8
+ constructor({ marshaller: t, serializer: s, deserializer: l, serdeContext: c, defaultContentType: d }) {
9
+ M(this, "marshaller");
10
+ M(this, "serializer");
11
+ M(this, "deserializer");
12
+ M(this, "serdeContext");
13
+ M(this, "defaultContentType");
14
+ this.marshaller = t, this.serializer = s, this.deserializer = l, this.serdeContext = c, this.defaultContentType = d;
15
+ }
16
+ async serializeEventStream({ eventStream: t, requestSchema: s, initialRequest: l }) {
17
+ const c = this.marshaller, d = s.getEventStreamMember(), u = s.getMemberSchema(d), y = this.serializer, h = this.defaultContentType, f = Symbol("initialRequestMarker"), S = {
18
+ async *[Symbol.asyncIterator]() {
19
+ if (l) {
20
+ const a = {
21
+ ":event-type": { type: "string", value: "initial-request" },
22
+ ":message-type": { type: "string", value: "event" },
23
+ ":content-type": { type: "string", value: h }
24
+ };
25
+ y.write(s, l);
26
+ const m = y.flush();
27
+ yield {
28
+ [f]: !0,
29
+ headers: a,
30
+ body: m
31
+ };
32
+ }
33
+ for await (const a of t)
34
+ yield a;
35
+ }
36
+ };
37
+ return c.serialize(S, (a) => {
38
+ if (a[f])
39
+ return {
40
+ headers: a.headers,
41
+ body: a.body
42
+ };
43
+ let m = "";
44
+ for (const i in a)
45
+ if (i !== "__type") {
46
+ m = i;
47
+ break;
48
+ }
49
+ const { additionalHeaders: r, body: e, eventType: n, explicitPayloadContentType: v } = this.writeEventBody(m, u, a);
50
+ return {
51
+ headers: {
52
+ ":event-type": { type: "string", value: n },
53
+ ":message-type": { type: "string", value: "event" },
54
+ ":content-type": { type: "string", value: v ?? h },
55
+ ...r
56
+ },
57
+ body: e
58
+ };
59
+ });
60
+ }
61
+ async deserializeEventStream({ response: t, responseSchema: s, initialResponseContainer: l }) {
62
+ var m;
63
+ const c = this.marshaller, d = s.getEventStreamMember(), y = s.getMemberSchema(d).getMemberSchemas(), h = Symbol("initialResponseMarker"), f = c.deserialize(t.body, async (r) => {
64
+ var v, z;
65
+ let e = "";
66
+ for (const i in r)
67
+ if (i !== "__type") {
68
+ e = i;
69
+ break;
70
+ }
71
+ const n = r[e].body;
72
+ if (e === "initial-response") {
73
+ const i = await this.deserializer.read(s, n);
74
+ return delete i[d], {
75
+ [h]: !0,
76
+ ...i
77
+ };
78
+ } else if (e in y) {
79
+ const i = y[e];
80
+ if (i.isStructSchema()) {
81
+ const o = {};
82
+ let E = !1;
83
+ for (const [b, w] of i.structIterator()) {
84
+ const { eventHeader: C, eventPayload: T } = w.getMergedTraits();
85
+ if (E = E || !!(C || T), T)
86
+ w.isBlobSchema() ? o[b] = n : w.isStringSchema() ? o[b] = (((v = this.serdeContext) == null ? void 0 : v.utf8Encoder) ?? I)(n) : w.isStructSchema() && (o[b] = await this.deserializer.read(w, n));
87
+ else if (C) {
88
+ const p = (z = r[e].headers[b]) == null ? void 0 : z.value;
89
+ p != null && (w.isNumericSchema() ? p && typeof p == "object" && "bytes" in p ? o[b] = BigInt(p.toString()) : o[b] = Number(p) : o[b] = p);
90
+ }
91
+ }
92
+ if (E)
93
+ return {
94
+ [e]: o
95
+ };
96
+ if (n.byteLength === 0)
97
+ return {
98
+ [e]: {}
99
+ };
100
+ }
101
+ return {
102
+ [e]: await this.deserializer.read(i, n)
103
+ };
104
+ } else
105
+ return {
106
+ $unknown: r
107
+ };
108
+ }), S = f[Symbol.asyncIterator](), a = await S.next();
109
+ if (a.done)
110
+ return f;
111
+ if ((m = a.value) != null && m[h]) {
112
+ if (!s)
113
+ throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
114
+ for (const r in a.value)
115
+ l[r] = a.value[r];
116
+ }
117
+ return {
118
+ async *[Symbol.asyncIterator]() {
119
+ var r;
120
+ for ((r = a == null ? void 0 : a.value) != null && r[h] || (yield a.value); ; ) {
121
+ const { done: e, value: n } = await S.next();
122
+ if (e)
123
+ break;
124
+ yield n;
125
+ }
126
+ }
127
+ };
128
+ }
129
+ writeEventBody(t, s, l) {
130
+ var m;
131
+ const c = this.serializer;
132
+ let d = t, u = null, y;
133
+ const h = s.getSchema()[4].includes(t), f = {};
134
+ if (h) {
135
+ const r = s.getMemberSchema(t);
136
+ if (r.isStructSchema()) {
137
+ for (const [e, n] of r.structIterator()) {
138
+ const { eventHeader: v, eventPayload: z } = n.getMergedTraits();
139
+ if (z)
140
+ u = e;
141
+ else if (v) {
142
+ const i = l[t][e];
143
+ let o = "binary";
144
+ n.isNumericSchema() ? (-2) ** 31 <= i && i <= 2 ** 31 - 1 ? o = "integer" : o = "long" : n.isTimestampSchema() ? o = "timestamp" : n.isStringSchema() ? o = "string" : n.isBooleanSchema() && (o = "boolean"), i != null && (f[e] = {
145
+ type: o,
146
+ value: i
147
+ }, delete l[t][e]);
148
+ }
149
+ }
150
+ if (u !== null) {
151
+ const e = r.getMemberSchema(u);
152
+ e.isBlobSchema() ? y = "application/octet-stream" : e.isStringSchema() && (y = "text/plain"), c.write(e, l[t][u]);
153
+ } else
154
+ c.write(r, l[t]);
155
+ } else if (r.isUnitSchema())
156
+ c.write(r, {});
157
+ else
158
+ throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
159
+ } else {
160
+ const [r, e] = l[t];
161
+ d = r, c.write(15, e);
162
+ }
163
+ const S = c.flush() ?? new Uint8Array();
164
+ return {
165
+ body: typeof S == "string" ? (((m = this.serdeContext) == null ? void 0 : m.utf8Decoder) ?? B)(S) : S,
166
+ eventType: d,
167
+ explicitPayloadContentType: y,
168
+ additionalHeaders: f
169
+ };
170
+ }
171
+ }
172
+ export {
173
+ j as EventStreamCodec,
174
+ A as EventStreamMarshaller,
175
+ R as EventStreamSerde,
176
+ K as HeaderMarshaller,
177
+ L as Int64,
178
+ O as MessageDecoderStream,
179
+ $ as MessageEncoderStream,
180
+ q as SmithyMessageDecoderStream,
181
+ F as SmithyMessageEncoderStream,
182
+ G as UniversalEventStreamMarshaller,
183
+ U as eventStreamSerdeProvider,
184
+ J as getChunkedStream,
185
+ Q as getMessageUnmarshaller,
186
+ V as iterableToReadableStream,
187
+ W as readableStreamToIterable,
188
+ X as resolveEventStreamSerdeConfig
189
+ };
190
+ //# sourceMappingURL=index.browser-CKeO7JYa.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser-CKeO7JYa.mjs","sources":["../node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js"],"sourcesContent":["import { fromUtf8, toUtf8 } from \"@smithy/core/serde\";\nexport class EventStreamSerde {\n marshaller;\n serializer;\n deserializer;\n serdeContext;\n defaultContentType;\n constructor({ marshaller, serializer, deserializer, serdeContext, defaultContentType, }) {\n this.marshaller = marshaller;\n this.serializer = serializer;\n this.deserializer = deserializer;\n this.serdeContext = serdeContext;\n this.defaultContentType = defaultContentType;\n }\n async serializeEventStream({ eventStream, requestSchema, initialRequest, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = requestSchema.getEventStreamMember();\n const unionSchema = requestSchema.getMemberSchema(eventStreamMember);\n const serializer = this.serializer;\n const defaultContentType = this.defaultContentType;\n const initialRequestMarker = Symbol(\"initialRequestMarker\");\n const eventStreamIterable = {\n async *[Symbol.asyncIterator]() {\n if (initialRequest) {\n const headers = {\n \":event-type\": { type: \"string\", value: \"initial-request\" },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: defaultContentType },\n };\n serializer.write(requestSchema, initialRequest);\n const body = serializer.flush();\n yield {\n [initialRequestMarker]: true,\n headers,\n body,\n };\n }\n for await (const page of eventStream) {\n yield page;\n }\n },\n };\n return marshaller.serialize(eventStreamIterable, (event) => {\n if (event[initialRequestMarker]) {\n return {\n headers: event.headers,\n body: event.body,\n };\n }\n let unionMember = \"\";\n for (const key in event) {\n if (key !== \"__type\") {\n unionMember = key;\n break;\n }\n }\n const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);\n const headers = {\n \":event-type\": { type: \"string\", value: eventType },\n \":message-type\": { type: \"string\", value: \"event\" },\n \":content-type\": { type: \"string\", value: explicitPayloadContentType ?? defaultContentType },\n ...additionalHeaders,\n };\n return {\n headers,\n body,\n };\n });\n }\n async deserializeEventStream({ response, responseSchema, initialResponseContainer, }) {\n const marshaller = this.marshaller;\n const eventStreamMember = responseSchema.getEventStreamMember();\n const unionSchema = responseSchema.getMemberSchema(eventStreamMember);\n const memberSchemas = unionSchema.getMemberSchemas();\n const initialResponseMarker = Symbol(\"initialResponseMarker\");\n const asyncIterable = marshaller.deserialize(response.body, async (event) => {\n let unionMember = \"\";\n for (const key in event) {\n if (key !== \"__type\") {\n unionMember = key;\n break;\n }\n }\n const body = event[unionMember].body;\n if (unionMember === \"initial-response\") {\n const dataObject = await this.deserializer.read(responseSchema, body);\n delete dataObject[eventStreamMember];\n return {\n [initialResponseMarker]: true,\n ...dataObject,\n };\n }\n else if (unionMember in memberSchemas) {\n const eventStreamSchema = memberSchemas[unionMember];\n if (eventStreamSchema.isStructSchema()) {\n const out = {};\n let hasBindings = false;\n for (const [name, member] of eventStreamSchema.structIterator()) {\n const { eventHeader, eventPayload } = member.getMergedTraits();\n hasBindings = hasBindings || Boolean(eventHeader || eventPayload);\n if (eventPayload) {\n if (member.isBlobSchema()) {\n out[name] = body;\n }\n else if (member.isStringSchema()) {\n out[name] = (this.serdeContext?.utf8Encoder ?? toUtf8)(body);\n }\n else if (member.isStructSchema()) {\n out[name] = await this.deserializer.read(member, body);\n }\n }\n else if (eventHeader) {\n const value = event[unionMember].headers[name]?.value;\n if (value != null) {\n if (member.isNumericSchema()) {\n if (value && typeof value === \"object\" && \"bytes\" in value) {\n out[name] = BigInt(value.toString());\n }\n else {\n out[name] = Number(value);\n }\n }\n else {\n out[name] = value;\n }\n }\n }\n }\n if (hasBindings) {\n return {\n [unionMember]: out,\n };\n }\n if (body.byteLength === 0) {\n return {\n [unionMember]: {},\n };\n }\n }\n return {\n [unionMember]: await this.deserializer.read(eventStreamSchema, body),\n };\n }\n else {\n return {\n $unknown: event,\n };\n }\n });\n const asyncIterator = asyncIterable[Symbol.asyncIterator]();\n const firstEvent = await asyncIterator.next();\n if (firstEvent.done) {\n return asyncIterable;\n }\n if (firstEvent.value?.[initialResponseMarker]) {\n if (!responseSchema) {\n throw new Error(\"@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.\");\n }\n for (const key in firstEvent.value) {\n initialResponseContainer[key] = firstEvent.value[key];\n }\n }\n return {\n async *[Symbol.asyncIterator]() {\n if (!firstEvent?.value?.[initialResponseMarker]) {\n yield firstEvent.value;\n }\n while (true) {\n const { done, value } = await asyncIterator.next();\n if (done) {\n break;\n }\n yield value;\n }\n },\n };\n }\n writeEventBody(unionMember, unionSchema, event) {\n const serializer = this.serializer;\n let eventType = unionMember;\n let explicitPayloadMember = null;\n let explicitPayloadContentType;\n const isKnownSchema = (() => {\n const struct = unionSchema.getSchema();\n return struct[4].includes(unionMember);\n })();\n const additionalHeaders = {};\n if (!isKnownSchema) {\n const [type, value] = event[unionMember];\n eventType = type;\n serializer.write(15, value);\n }\n else {\n const eventSchema = unionSchema.getMemberSchema(unionMember);\n if (eventSchema.isStructSchema()) {\n for (const [memberName, memberSchema] of eventSchema.structIterator()) {\n const { eventHeader, eventPayload } = memberSchema.getMergedTraits();\n if (eventPayload) {\n explicitPayloadMember = memberName;\n }\n else if (eventHeader) {\n const value = event[unionMember][memberName];\n let type = \"binary\";\n if (memberSchema.isNumericSchema()) {\n if ((-2) ** 31 <= value && value <= 2 ** 31 - 1) {\n type = \"integer\";\n }\n else {\n type = \"long\";\n }\n }\n else if (memberSchema.isTimestampSchema()) {\n type = \"timestamp\";\n }\n else if (memberSchema.isStringSchema()) {\n type = \"string\";\n }\n else if (memberSchema.isBooleanSchema()) {\n type = \"boolean\";\n }\n if (value != null) {\n additionalHeaders[memberName] = {\n type,\n value,\n };\n delete event[unionMember][memberName];\n }\n }\n }\n if (explicitPayloadMember !== null) {\n const payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);\n if (payloadSchema.isBlobSchema()) {\n explicitPayloadContentType = \"application/octet-stream\";\n }\n else if (payloadSchema.isStringSchema()) {\n explicitPayloadContentType = \"text/plain\";\n }\n serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);\n }\n else {\n serializer.write(eventSchema, event[unionMember]);\n }\n }\n else if (eventSchema.isUnitSchema()) {\n serializer.write(eventSchema, {});\n }\n else {\n throw new Error(\"@smithy/core/event-streams - non-struct member not supported in event stream union.\");\n }\n }\n const messageSerialization = serializer.flush() ?? new Uint8Array();\n const body = typeof messageSerialization === \"string\"\n ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization)\n : messageSerialization;\n return {\n body,\n eventType,\n explicitPayloadContentType,\n additionalHeaders,\n };\n }\n}\n"],"names":["EventStreamSerde","marshaller","serializer","deserializer","serdeContext","defaultContentType","__publicField","eventStream","requestSchema","initialRequest","eventStreamMember","unionSchema","initialRequestMarker","eventStreamIterable","headers","body","page","event","unionMember","key","additionalHeaders","eventType","explicitPayloadContentType","response","responseSchema","initialResponseContainer","memberSchemas","initialResponseMarker","asyncIterable","dataObject","eventStreamSchema","out","hasBindings","name","member","eventHeader","eventPayload","_a","toUtf8","value","_b","asyncIterator","firstEvent","done","explicitPayloadMember","isKnownSchema","eventSchema","memberName","memberSchema","type","payloadSchema","messageSerialization","fromUtf8"],"mappings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;AAAA,YAChC,GAC4B,OAAOtB,EAAMC,CAAW,EAAE6B,CAAU;AAAA,UAE5C;AAAA,QACJ;AACA,YAAIH,MAA0B,MAAM;AAChC,gBAAMM,IAAgBJ,EAAY,gBAAgBF,CAAqB;AACvE,UAAIM,EAAc,iBACd5B,IAA6B,6BAExB4B,EAAc,qBACnB5B,IAA6B,eAEjCpB,EAAW,MAAMgD,GAAejC,EAAMC,CAAW,EAAE0B,CAAqB,CAAC;AAAA,QAC7E;AAEI,UAAA1C,EAAW,MAAM4C,GAAa7B,EAAMC,CAAW,CAAC;AAAA,MAExD,WACS4B,EAAY;AACjB,QAAA5C,EAAW,MAAM4C,GAAa,EAAE;AAAA;AAGhC,cAAM,IAAI,MAAM,qFAAqF;AAAA,IAE7G,OA9DoB;AAChB,YAAM,CAACG,GAAMV,CAAK,IAAItB,EAAMC,CAAW;AACvC,MAAAG,IAAY4B,GACZ/C,EAAW,MAAM,IAAIqC,CAAK;AAAA,IAC9B;AA2DA,UAAMY,IAAuBjD,EAAW,MAAK,KAAM,IAAI,WAAU;AAIjE,WAAO;AAAA,MACH,MAJS,OAAOiD,KAAyB,cACtCd,IAAA,KAAK,iBAAL,gBAAAA,EAAmB,gBAAee,GAAUD,CAAoB,IACjEA;AAAA,MAGF,WAAA9B;AAAA,MACA,4BAAAC;AAAA,MACA,mBAAAF;AAAA,IACZ;AAAA,EACI;AACJ;","x_google_ignoreList":[0]}
package/dist/index.d.ts CHANGED
@@ -1,16 +1,40 @@
1
- declare type DatabaseConfig = FirebaseProviderConfig | SupabaseProviderConfig;
1
+ /**
2
+ * AWS backend — all data (comments, replies, screenshots) stored directly in S3.
3
+ * No Firebase or Supabase needed.
4
+ *
5
+ * The browser obtains temporary, rotating AWS credentials from a Cognito Identity Pool.
6
+ * No long-lived keys ever touch the browser. See src/adapters/aws.ts for AWS setup steps.
7
+ */
8
+ declare interface AWSProviderConfig {
9
+ provider: 'aws';
10
+ /** AWS region (e.g. 'us-east-1'). */
11
+ region: string;
12
+ /** S3 bucket name. */
13
+ bucket: string;
14
+ /**
15
+ * Cognito Identity Pool ID (e.g. 'us-east-1:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx').
16
+ * Used to obtain temporary AWS credentials in the browser.
17
+ */
18
+ identityPoolId: string;
19
+ /**
20
+ * How often (ms) to poll for new comments. S3 has no real-time push.
21
+ * Default: 5000 (5 seconds).
22
+ */
23
+ pollInterval?: number;
24
+ }
25
+
26
+ declare type BackendConfig = FirebaseProviderConfig | SupabaseProviderConfig | AWSProviderConfig;
2
27
 
28
+ /**
29
+ * Firebase backend — Firestore for comments/replies, Firebase Storage for screenshots.
30
+ * The API key is a public identifier, not a secret. Secure data with Firebase Security Rules.
31
+ */
3
32
  declare interface FirebaseProviderConfig {
4
33
  provider: 'firebase';
5
- /**
6
- * Firebase API key. This is a public identifier — not a secret.
7
- * Secure your data with Firebase Security Rules.
8
- * Store in an environment variable (VITE_FIREBASE_API_KEY, REACT_APP_FIREBASE_API_KEY, etc.)
9
- */
10
34
  apiKey: string;
11
35
  authDomain: string;
12
36
  projectId: string;
13
- /** Required when using Firebase Storage for screenshots. */
37
+ /** Required for screenshot storage. */
14
38
  storageBucket?: string;
15
39
  messagingSenderId?: string;
16
40
  appId?: string;
@@ -19,15 +43,14 @@ declare interface FirebaseProviderConfig {
19
43
  export declare function initFeedbackPlugin(config: PluginConfig): () => void;
20
44
 
21
45
  export declare interface PluginConfig {
22
- /** Database provider for storing comments and replies. */
23
- database: DatabaseConfig;
24
46
  /**
25
- * Screenshot storage provider.
26
- * Defaults to the same provider as `database`.
27
- * Use `s3` to keep screenshots off Firebase/Supabase.
47
+ * Storage backend. Pick one:
48
+ * - `firebase` — Firestore + Firebase Storage
49
+ * - `supabase` — Postgres + Supabase Storage
50
+ * - `aws` — Everything in AWS S3 via Cognito Identity Pool (no backend needed)
28
51
  */
29
- screenshots?: ScreenshotConfig;
30
- /** Namespace comments by project. Use this when multiple prototypes share a backend. */
52
+ backend: BackendConfig;
53
+ /** Namespace comments by project (default: 'default'). */
31
54
  projectKey?: string;
32
55
  position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
33
56
  theme?: {
@@ -36,37 +59,13 @@ export declare interface PluginConfig {
36
59
  }
37
60
 
38
61
  /**
39
- * S3 screenshot storage via a backend proxy endpoint.
40
- * NEVER pass AWS credentials to the frontend — your backend holds those.
41
- * Your endpoint receives { commentId, imageData } and returns { url }.
42
- */
43
- declare interface S3ScreenshotConfig {
44
- provider: 's3';
45
- /** Your backend endpoint that accepts the screenshot and returns { url: string } */
46
- uploadEndpoint: string;
47
- /** Optional headers (e.g. an authorization token for your own backend) */
48
- headers?: Record<string, string>;
49
- }
50
-
51
- /**
52
- * Controls where screenshots are stored.
53
- * - `'firebase'` / `'supabase'`: reuse the same provider configured in `database`
54
- * - `'s3'`: forward screenshots to your own backend proxy (AWS credentials stay on your server)
62
+ * Supabase backend — Postgres for comments/replies, Supabase Storage for screenshots.
63
+ * The anonKey is a public key by design. Secure data with Row Level Security (RLS) policies.
64
+ * See src/adapters/supabase.ts for the required SQL setup.
55
65
  */
56
- declare type ScreenshotConfig = {
57
- provider: 'firebase';
58
- } | {
59
- provider: 'supabase';
60
- } | S3ScreenshotConfig;
61
-
62
66
  declare interface SupabaseProviderConfig {
63
67
  provider: 'supabase';
64
68
  url: string;
65
- /**
66
- * Supabase anon key. This is a public key — not a secret.
67
- * Secure your data with Supabase Row Level Security (RLS) policies.
68
- * Store in an environment variable.
69
- */
70
69
  anonKey: string;
71
70
  }
72
71