@omg-dev/sdk 0.4.24
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/dist/OmgBadge-LAcimQp0.mjs +345 -0
- package/dist/VibesFeedback-BF2Vf6FK.mjs +808 -0
- package/dist/brand/auto.mjs +18 -0
- package/dist/feedback/auto.mjs +26 -0
- package/dist/index.mjs +1611 -0
- package/package.json +43 -0
- package/src/auth/auto-prompt.tsx +50 -0
- package/src/auth/bridge.ts +63 -0
- package/src/auth/client.ts +222 -0
- package/src/auth/fetch.ts +23 -0
- package/src/auth/guard.tsx +24 -0
- package/src/auth/index.ts +23 -0
- package/src/auth/login.tsx +267 -0
- package/src/auth/mail-apps.ts +52 -0
- package/src/auth/react.tsx +248 -0
- package/src/brand/OmgBadge.tsx +366 -0
- package/src/brand/auto.tsx +35 -0
- package/src/brand/index.ts +1 -0
- package/src/feedback/VibesFeedback.tsx +360 -0
- package/src/feedback/auto.tsx +47 -0
- package/src/feedback/gestures.ts +296 -0
- package/src/feedback/index.ts +18 -0
- package/src/feedback/screenshot.ts +37 -0
- package/src/feedback/trace.ts +166 -0
- package/src/index.ts +1042 -0
- package/src/notifications/index.tsx +179 -0
- package/src/sandbox.test.ts +61 -0
- package/src/sandbox.ts +106 -0
- package/src/storage/VibesUpload.tsx +140 -0
- package/src/storage/index.ts +12 -0
- package/src/storage/useUpload.ts +167 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import { t as VibesFeedback } from "./VibesFeedback-BF2Vf6FK.mjs";
|
|
2
|
+
import { useId, useState } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/brand/OmgBadge.tsx
|
|
5
|
+
const BRAND = "#FF5530";
|
|
6
|
+
const Z_BADGE = 2147482e3;
|
|
7
|
+
const Z_DIALOG = 2147483100;
|
|
8
|
+
const FEEDBACK_OPEN_EVENT = "vibes:feedback:open";
|
|
9
|
+
function feedbackBundled() {
|
|
10
|
+
try {
|
|
11
|
+
return typeof __VIBES_BRAND_FEEDBACK__ === "undefined" ? true : __VIBES_BRAND_FEEDBACK__;
|
|
12
|
+
} catch {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const DISMISS_KEY = "vibes-remix:dismissed";
|
|
17
|
+
const REMIX_ORIGIN = typeof import.meta !== "undefined" && import.meta.env?.VITE_REMIX_ORIGIN || "https://omg.dev";
|
|
18
|
+
function appSlug() {
|
|
19
|
+
if (typeof import.meta === "undefined") return null;
|
|
20
|
+
const slug = import.meta.env?.VITE_APP_SLUG?.trim();
|
|
21
|
+
if (!slug || !/^[a-z0-9-]+$/.test(slug)) return null;
|
|
22
|
+
return slug;
|
|
23
|
+
}
|
|
24
|
+
function isDismissed() {
|
|
25
|
+
try {
|
|
26
|
+
return localStorage.getItem(DISMISS_KEY) === "1";
|
|
27
|
+
} catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function setDismissedFlag() {
|
|
32
|
+
try {
|
|
33
|
+
localStorage.setItem(DISMISS_KEY, "1");
|
|
34
|
+
} catch {}
|
|
35
|
+
}
|
|
36
|
+
function OmgBadge({ href = "https://omg.dev", label = "What is omg?" }) {
|
|
37
|
+
const [open, setOpen] = useState(false);
|
|
38
|
+
const slug = appSlug();
|
|
39
|
+
const [remix, setRemix] = useState(() => slug !== null && !isDismissed());
|
|
40
|
+
const titleId = useId();
|
|
41
|
+
const descriptionId = useId();
|
|
42
|
+
const markId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
43
|
+
function dismissRemix() {
|
|
44
|
+
setDismissedFlag();
|
|
45
|
+
setRemix(false);
|
|
46
|
+
}
|
|
47
|
+
function summonFeedback() {
|
|
48
|
+
setOpen(false);
|
|
49
|
+
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent(FEEDBACK_OPEN_EVENT));
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
+
remix && slug ? /* @__PURE__ */ jsxs("a", {
|
|
53
|
+
href: `${REMIX_ORIGIN}/remix/${slug}?ref=pwa`,
|
|
54
|
+
"aria-label": "Make this app mine",
|
|
55
|
+
"data-vibes-feedback": "",
|
|
56
|
+
style: badgeStyle,
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ jsx(OmgMark, {
|
|
59
|
+
size: 18,
|
|
60
|
+
id: `remix-${markId}`
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsx("span", {
|
|
63
|
+
style: badgeTextStyle,
|
|
64
|
+
children: "Make it mine"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("button", {
|
|
67
|
+
type: "button",
|
|
68
|
+
"aria-label": "Dismiss",
|
|
69
|
+
onClick: (event) => {
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
dismissRemix();
|
|
73
|
+
},
|
|
74
|
+
style: dismissStyle,
|
|
75
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
width: "13",
|
|
78
|
+
height: "13",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "none",
|
|
81
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
82
|
+
d: "M6 6l12 12M18 6 6 18",
|
|
83
|
+
stroke: "currentColor",
|
|
84
|
+
strokeWidth: "2.4",
|
|
85
|
+
strokeLinecap: "round"
|
|
86
|
+
})
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
]
|
|
90
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
91
|
+
type: "button",
|
|
92
|
+
"aria-label": label,
|
|
93
|
+
"data-vibes-feedback": "",
|
|
94
|
+
onClick: () => setOpen(true),
|
|
95
|
+
style: badgeStyle,
|
|
96
|
+
children: [/* @__PURE__ */ jsx(OmgMark, {
|
|
97
|
+
size: 18,
|
|
98
|
+
id: `badge-${markId}`
|
|
99
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
100
|
+
style: badgeTextStyle,
|
|
101
|
+
children: "omg"
|
|
102
|
+
})]
|
|
103
|
+
}),
|
|
104
|
+
open && /* @__PURE__ */ jsx("div", {
|
|
105
|
+
"data-vibes-feedback": "",
|
|
106
|
+
role: "presentation",
|
|
107
|
+
style: backdropStyle,
|
|
108
|
+
onMouseDown: (event) => {
|
|
109
|
+
if (event.target === event.currentTarget) setOpen(false);
|
|
110
|
+
},
|
|
111
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
112
|
+
role: "dialog",
|
|
113
|
+
"aria-modal": "true",
|
|
114
|
+
"aria-labelledby": titleId,
|
|
115
|
+
"aria-describedby": descriptionId,
|
|
116
|
+
style: dialogStyle,
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx("button", {
|
|
119
|
+
type: "button",
|
|
120
|
+
"aria-label": "Close",
|
|
121
|
+
onClick: () => setOpen(false),
|
|
122
|
+
style: closeButtonStyle,
|
|
123
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
124
|
+
"aria-hidden": "true",
|
|
125
|
+
width: "18",
|
|
126
|
+
height: "18",
|
|
127
|
+
viewBox: "0 0 24 24",
|
|
128
|
+
fill: "none",
|
|
129
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
130
|
+
d: "M6 6l12 12M18 6 6 18",
|
|
131
|
+
stroke: "currentColor",
|
|
132
|
+
strokeWidth: "2",
|
|
133
|
+
strokeLinecap: "round"
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ jsx("div", {
|
|
138
|
+
style: markWrapStyle,
|
|
139
|
+
children: /* @__PURE__ */ jsx(OmgMark, {
|
|
140
|
+
size: 34,
|
|
141
|
+
id: `dialog-${markId}`
|
|
142
|
+
})
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ jsx("h2", {
|
|
145
|
+
id: titleId,
|
|
146
|
+
style: titleStyle,
|
|
147
|
+
children: "Built with omg"
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ jsx("p", {
|
|
150
|
+
id: descriptionId,
|
|
151
|
+
style: bodyStyle,
|
|
152
|
+
children: "omg turns a plain-language idea into a real app, then hosts it with sign-in, data storage, and publishing already handled."
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ jsx("a", {
|
|
155
|
+
href,
|
|
156
|
+
target: "_blank",
|
|
157
|
+
rel: "noopener noreferrer",
|
|
158
|
+
style: ctaStyle,
|
|
159
|
+
children: "Learn about omg"
|
|
160
|
+
}),
|
|
161
|
+
feedbackBundled() && /* @__PURE__ */ jsx("button", {
|
|
162
|
+
type: "button",
|
|
163
|
+
onClick: summonFeedback,
|
|
164
|
+
style: secondaryStyle,
|
|
165
|
+
children: "Send feedback"
|
|
166
|
+
})
|
|
167
|
+
]
|
|
168
|
+
})
|
|
169
|
+
}),
|
|
170
|
+
feedbackBundled() && /* @__PURE__ */ jsx(VibesFeedback, {
|
|
171
|
+
showButton: false,
|
|
172
|
+
accent: BRAND,
|
|
173
|
+
title: "Send feedback"
|
|
174
|
+
})
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
function OmgMark({ size, id }) {
|
|
178
|
+
const maskId = `omg-mark-cut-${id}`;
|
|
179
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
180
|
+
"aria-hidden": "true",
|
|
181
|
+
width: size,
|
|
182
|
+
height: size,
|
|
183
|
+
viewBox: "0 0 100 100",
|
|
184
|
+
fill: "none",
|
|
185
|
+
style: {
|
|
186
|
+
display: "block",
|
|
187
|
+
flex: "0 0 auto"
|
|
188
|
+
},
|
|
189
|
+
children: [/* @__PURE__ */ jsxs("mask", {
|
|
190
|
+
id: maskId,
|
|
191
|
+
children: [/* @__PURE__ */ jsx("rect", {
|
|
192
|
+
width: "100",
|
|
193
|
+
height: "100",
|
|
194
|
+
fill: "white"
|
|
195
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
196
|
+
cx: "71",
|
|
197
|
+
cy: "29",
|
|
198
|
+
r: size <= 16 ? 16.5 : size <= 20 ? 15.2 : size <= 32 ? 14 : 13.2,
|
|
199
|
+
fill: "black"
|
|
200
|
+
})]
|
|
201
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
202
|
+
cx: "50",
|
|
203
|
+
cy: "50",
|
|
204
|
+
r: "44",
|
|
205
|
+
fill: BRAND,
|
|
206
|
+
mask: `url(#${maskId})`
|
|
207
|
+
})]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
const font = "system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif";
|
|
211
|
+
const badgeStyle = {
|
|
212
|
+
position: "fixed",
|
|
213
|
+
right: "max(14px, env(safe-area-inset-right))",
|
|
214
|
+
bottom: "calc(16px + env(safe-area-inset-bottom))",
|
|
215
|
+
zIndex: Z_BADGE,
|
|
216
|
+
height: 38,
|
|
217
|
+
padding: "0 8px 0 10px",
|
|
218
|
+
border: "1px solid rgba(20, 16, 12, 0.12)",
|
|
219
|
+
borderRadius: 999,
|
|
220
|
+
background: "rgba(255, 255, 255, 0.94)",
|
|
221
|
+
color: "#15110d",
|
|
222
|
+
boxShadow: "0 8px 28px rgba(0, 0, 0, 0.16)",
|
|
223
|
+
display: "inline-flex",
|
|
224
|
+
alignItems: "center",
|
|
225
|
+
gap: 7,
|
|
226
|
+
fontFamily: font,
|
|
227
|
+
cursor: "pointer",
|
|
228
|
+
textDecoration: "none",
|
|
229
|
+
WebkitTapHighlightColor: "transparent",
|
|
230
|
+
backdropFilter: "blur(10px)"
|
|
231
|
+
};
|
|
232
|
+
const badgeTextStyle = {
|
|
233
|
+
fontSize: 13,
|
|
234
|
+
lineHeight: "18px",
|
|
235
|
+
fontWeight: 700,
|
|
236
|
+
letterSpacing: 0,
|
|
237
|
+
padding: "0 3px"
|
|
238
|
+
};
|
|
239
|
+
const dismissStyle = {
|
|
240
|
+
width: 22,
|
|
241
|
+
height: 22,
|
|
242
|
+
flex: "0 0 auto",
|
|
243
|
+
borderRadius: 999,
|
|
244
|
+
border: "none",
|
|
245
|
+
background: "rgba(20, 16, 12, 0.06)",
|
|
246
|
+
color: "#6b6459",
|
|
247
|
+
display: "grid",
|
|
248
|
+
placeItems: "center",
|
|
249
|
+
cursor: "pointer",
|
|
250
|
+
padding: 0
|
|
251
|
+
};
|
|
252
|
+
const backdropStyle = {
|
|
253
|
+
position: "fixed",
|
|
254
|
+
inset: 0,
|
|
255
|
+
zIndex: Z_DIALOG,
|
|
256
|
+
display: "grid",
|
|
257
|
+
placeItems: "center",
|
|
258
|
+
padding: "24px 16px calc(24px + env(safe-area-inset-bottom))",
|
|
259
|
+
background: "rgba(15, 13, 11, 0.34)",
|
|
260
|
+
boxSizing: "border-box"
|
|
261
|
+
};
|
|
262
|
+
const dialogStyle = {
|
|
263
|
+
position: "relative",
|
|
264
|
+
width: "min(100%, 360px)",
|
|
265
|
+
borderRadius: 18,
|
|
266
|
+
padding: "26px 22px 20px",
|
|
267
|
+
background: "#fffaf4",
|
|
268
|
+
color: "#15110d",
|
|
269
|
+
boxShadow: "0 24px 70px rgba(0, 0, 0, 0.28)",
|
|
270
|
+
border: "1px solid rgba(21, 17, 13, 0.08)",
|
|
271
|
+
fontFamily: font,
|
|
272
|
+
boxSizing: "border-box"
|
|
273
|
+
};
|
|
274
|
+
const closeButtonStyle = {
|
|
275
|
+
position: "absolute",
|
|
276
|
+
top: 10,
|
|
277
|
+
right: 10,
|
|
278
|
+
width: 34,
|
|
279
|
+
height: 34,
|
|
280
|
+
borderRadius: 999,
|
|
281
|
+
border: "none",
|
|
282
|
+
background: "transparent",
|
|
283
|
+
color: "#6b6459",
|
|
284
|
+
display: "grid",
|
|
285
|
+
placeItems: "center",
|
|
286
|
+
cursor: "pointer"
|
|
287
|
+
};
|
|
288
|
+
const markWrapStyle = {
|
|
289
|
+
width: 52,
|
|
290
|
+
height: 52,
|
|
291
|
+
borderRadius: 16,
|
|
292
|
+
display: "grid",
|
|
293
|
+
placeItems: "center",
|
|
294
|
+
background: "#fff",
|
|
295
|
+
boxShadow: "inset 0 0 0 1px rgba(21, 17, 13, 0.08)",
|
|
296
|
+
marginBottom: 16
|
|
297
|
+
};
|
|
298
|
+
const titleStyle = {
|
|
299
|
+
margin: 0,
|
|
300
|
+
color: "#15110d",
|
|
301
|
+
fontSize: 23,
|
|
302
|
+
lineHeight: "28px",
|
|
303
|
+
fontWeight: 750,
|
|
304
|
+
letterSpacing: 0
|
|
305
|
+
};
|
|
306
|
+
const bodyStyle = {
|
|
307
|
+
margin: "10px 0 18px",
|
|
308
|
+
color: "#5f574d",
|
|
309
|
+
fontSize: 15,
|
|
310
|
+
lineHeight: "22px",
|
|
311
|
+
letterSpacing: 0
|
|
312
|
+
};
|
|
313
|
+
const ctaStyle = {
|
|
314
|
+
display: "inline-flex",
|
|
315
|
+
alignItems: "center",
|
|
316
|
+
justifyContent: "center",
|
|
317
|
+
width: "100%",
|
|
318
|
+
height: 44,
|
|
319
|
+
borderRadius: 12,
|
|
320
|
+
background: "#15110d",
|
|
321
|
+
color: "#fffaf4",
|
|
322
|
+
fontSize: 15,
|
|
323
|
+
fontWeight: 700,
|
|
324
|
+
textDecoration: "none",
|
|
325
|
+
letterSpacing: 0
|
|
326
|
+
};
|
|
327
|
+
const secondaryStyle = {
|
|
328
|
+
display: "inline-flex",
|
|
329
|
+
alignItems: "center",
|
|
330
|
+
justifyContent: "center",
|
|
331
|
+
width: "100%",
|
|
332
|
+
height: 44,
|
|
333
|
+
marginTop: 8,
|
|
334
|
+
borderRadius: 12,
|
|
335
|
+
background: "transparent",
|
|
336
|
+
border: "1px solid rgba(21, 17, 13, 0.14)",
|
|
337
|
+
color: "#15110d",
|
|
338
|
+
fontSize: 15,
|
|
339
|
+
fontWeight: 650,
|
|
340
|
+
cursor: "pointer",
|
|
341
|
+
fontFamily: font,
|
|
342
|
+
letterSpacing: 0
|
|
343
|
+
};
|
|
344
|
+
//#endregion
|
|
345
|
+
export { OmgBadge as t };
|