@saas-support/react 0.4.0 → 0.5.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/dist/index.cjs +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +218 -209
- package/dist/react.cjs +23 -3
- package/dist/react.d.ts +39 -4
- package/dist/react.js +1452 -1145
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { SaaSSupport as
|
|
4
|
-
import { SaaSError as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
const
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
1
|
+
import { jsx as s, jsxs as n, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ge, useContext as he, useState as m, useEffect as U, useRef as j, useCallback as N, useMemo as _ } from "react";
|
|
3
|
+
import { SaaSSupport as fe, isMfaRequired as be, BillingClient as ye, Transport as J, ReportClient as K } from "./index.js";
|
|
4
|
+
import { SaaSError as bs } from "./index.js";
|
|
5
|
+
import { createPortal as ve } from "react-dom";
|
|
6
|
+
const se = ge(null);
|
|
7
|
+
function L() {
|
|
8
|
+
const e = he(se);
|
|
9
|
+
if (!e)
|
|
10
10
|
throw new Error("useSaaSContext must be used within a <SaaSProvider>");
|
|
11
|
-
return
|
|
11
|
+
return e;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const [
|
|
15
|
-
return
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
|
|
13
|
+
function Ze({ publishableKey: e, apiKey: a, baseUrl: r, appearance: o, children: t }) {
|
|
14
|
+
const [u] = m(() => new fe({ publishableKey: e, apiKey: a, baseUrl: r })), [i, c] = m(null), [d, l] = m(!1), [g, p] = m(null);
|
|
15
|
+
return U(() => {
|
|
16
|
+
let f = !1;
|
|
17
|
+
u.load().then(async () => {
|
|
18
|
+
if (f) return;
|
|
19
|
+
const k = await u.auth.getUser(), v = await u.auth.getSettings();
|
|
20
|
+
c(k), p(v), l(!0);
|
|
21
21
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
22
|
+
const b = u.auth.onAuthStateChange((k) => {
|
|
23
|
+
f || c(k);
|
|
24
24
|
});
|
|
25
25
|
return () => {
|
|
26
|
-
|
|
26
|
+
f = !0, b(), u.destroy();
|
|
27
27
|
};
|
|
28
|
-
}, [
|
|
28
|
+
}, [u]), /* @__PURE__ */ s(se.Provider, { value: { client: u, user: i, isLoaded: d, appearance: o, settings: g }, children: t });
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const xe = {
|
|
31
31
|
colorPrimary: "#6366f1",
|
|
32
32
|
colorPrimaryHover: "#4f46e5",
|
|
33
33
|
colorBackground: "#ffffff",
|
|
@@ -40,7 +40,7 @@ const ds = {
|
|
|
40
40
|
colorWarning: "#f59e0b",
|
|
41
41
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
42
42
|
borderRadius: "8px"
|
|
43
|
-
},
|
|
43
|
+
}, we = {
|
|
44
44
|
colorPrimary: "#818cf8",
|
|
45
45
|
colorPrimaryHover: "#6366f1",
|
|
46
46
|
colorBackground: "#1e1e2e",
|
|
@@ -54,11 +54,11 @@ const ds = {
|
|
|
54
54
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
55
55
|
borderRadius: "8px"
|
|
56
56
|
};
|
|
57
|
-
function
|
|
58
|
-
const a = (
|
|
57
|
+
function Z(e) {
|
|
58
|
+
const a = (e == null ? void 0 : e.baseTheme) === "dark" ? we : xe, r = e == null ? void 0 : e.variables;
|
|
59
59
|
return {
|
|
60
60
|
colorPrimary: (r == null ? void 0 : r.colorPrimary) ?? a.colorPrimary,
|
|
61
|
-
colorPrimaryHover: r != null && r.colorPrimary ?
|
|
61
|
+
colorPrimaryHover: r != null && r.colorPrimary ? Ne(r.colorPrimary, 10) : a.colorPrimaryHover,
|
|
62
62
|
colorBackground: (r == null ? void 0 : r.colorBackground) ?? a.colorBackground,
|
|
63
63
|
colorText: (r == null ? void 0 : r.colorText) ?? a.colorText,
|
|
64
64
|
colorTextSecondary: a.colorTextSecondary,
|
|
@@ -71,16 +71,16 @@ function V(s) {
|
|
|
71
71
|
borderRadius: (r == null ? void 0 : r.borderRadius) ?? a.borderRadius
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
const r = parseInt(
|
|
76
|
-
return `#${(
|
|
74
|
+
function Ne(e, a) {
|
|
75
|
+
const r = parseInt(e.replace("#", ""), 16), o = Math.max(0, (r >> 16) - Math.round(2.55 * a)), t = Math.max(0, (r >> 8 & 255) - Math.round(2.55 * a)), u = Math.max(0, (r & 255) - Math.round(2.55 * a));
|
|
76
|
+
return `#${(o << 16 | t << 8 | u).toString(16).padStart(6, "0")}`;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function X(e) {
|
|
79
79
|
return `
|
|
80
80
|
:host {
|
|
81
81
|
all: initial;
|
|
82
|
-
font-family: ${
|
|
83
|
-
color: ${
|
|
82
|
+
font-family: ${e.fontFamily};
|
|
83
|
+
color: ${e.colorText};
|
|
84
84
|
line-height: 1.5;
|
|
85
85
|
-webkit-font-smoothing: antialiased;
|
|
86
86
|
}
|
|
@@ -88,13 +88,13 @@ function G(s) {
|
|
|
88
88
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
89
89
|
|
|
90
90
|
.ss-card {
|
|
91
|
-
background: ${
|
|
92
|
-
border-radius: ${
|
|
91
|
+
background: ${e.colorBackground};
|
|
92
|
+
border-radius: ${e.borderRadius};
|
|
93
93
|
padding: 32px;
|
|
94
94
|
width: 100%;
|
|
95
|
-
max-width:
|
|
95
|
+
max-width: 480px;
|
|
96
96
|
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
|
|
97
|
-
border: 1px solid ${
|
|
97
|
+
border: 1px solid ${e.colorInputBorder};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
.ss-card-wide { max-width: 640px; }
|
|
@@ -102,14 +102,14 @@ function G(s) {
|
|
|
102
102
|
.ss-title {
|
|
103
103
|
font-size: 22px;
|
|
104
104
|
font-weight: 700;
|
|
105
|
-
color: ${
|
|
105
|
+
color: ${e.colorText};
|
|
106
106
|
text-align: center;
|
|
107
107
|
margin-bottom: 24px;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
.ss-subtitle {
|
|
111
111
|
font-size: 14px;
|
|
112
|
-
color: ${
|
|
112
|
+
color: ${e.colorTextSecondary};
|
|
113
113
|
text-align: center;
|
|
114
114
|
margin-top: -16px;
|
|
115
115
|
margin-bottom: 24px;
|
|
@@ -121,7 +121,7 @@ function G(s) {
|
|
|
121
121
|
display: block;
|
|
122
122
|
font-size: 14px;
|
|
123
123
|
font-weight: 500;
|
|
124
|
-
color: ${
|
|
124
|
+
color: ${e.colorText};
|
|
125
125
|
margin-bottom: 6px;
|
|
126
126
|
}
|
|
127
127
|
|
|
@@ -130,20 +130,20 @@ function G(s) {
|
|
|
130
130
|
padding: 10px 12px;
|
|
131
131
|
font-size: 14px;
|
|
132
132
|
font-family: inherit;
|
|
133
|
-
border: 1px solid ${
|
|
134
|
-
border-radius: calc(${
|
|
135
|
-
background: ${
|
|
136
|
-
color: ${
|
|
133
|
+
border: 1px solid ${e.colorInputBorder};
|
|
134
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
135
|
+
background: ${e.colorInputBackground};
|
|
136
|
+
color: ${e.colorText};
|
|
137
137
|
outline: none;
|
|
138
138
|
transition: border-color 0.15s;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
.ss-input:focus {
|
|
142
|
-
border-color: ${
|
|
143
|
-
box-shadow: 0 0 0 3px ${
|
|
142
|
+
border-color: ${e.colorPrimary};
|
|
143
|
+
box-shadow: 0 0 0 3px ${e.colorPrimary}22;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
.ss-input.ss-input-error { border-color: ${
|
|
146
|
+
.ss-input.ss-input-error { border-color: ${e.colorError}; }
|
|
147
147
|
|
|
148
148
|
.ss-query-textarea {
|
|
149
149
|
resize: vertical;
|
|
@@ -153,16 +153,16 @@ function G(s) {
|
|
|
153
153
|
|
|
154
154
|
.ss-error {
|
|
155
155
|
font-size: 13px;
|
|
156
|
-
color: ${
|
|
156
|
+
color: ${e.colorError};
|
|
157
157
|
margin-top: 4px;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
.ss-global-error {
|
|
161
161
|
font-size: 13px;
|
|
162
|
-
color: ${
|
|
163
|
-
background: ${
|
|
164
|
-
border: 1px solid ${
|
|
165
|
-
border-radius: calc(${
|
|
162
|
+
color: ${e.colorError};
|
|
163
|
+
background: ${e.colorError}11;
|
|
164
|
+
border: 1px solid ${e.colorError}33;
|
|
165
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
166
166
|
padding: 10px 12px;
|
|
167
167
|
margin-bottom: 16px;
|
|
168
168
|
text-align: center;
|
|
@@ -170,10 +170,10 @@ function G(s) {
|
|
|
170
170
|
|
|
171
171
|
.ss-success-msg {
|
|
172
172
|
font-size: 13px;
|
|
173
|
-
color: ${
|
|
174
|
-
background: ${
|
|
175
|
-
border: 1px solid ${
|
|
176
|
-
border-radius: calc(${
|
|
173
|
+
color: ${e.colorSuccess};
|
|
174
|
+
background: ${e.colorSuccess}11;
|
|
175
|
+
border: 1px solid ${e.colorSuccess}33;
|
|
176
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
177
177
|
padding: 10px 12px;
|
|
178
178
|
margin-bottom: 16px;
|
|
179
179
|
text-align: center;
|
|
@@ -182,14 +182,14 @@ function G(s) {
|
|
|
182
182
|
.ss-loading {
|
|
183
183
|
text-align: center;
|
|
184
184
|
padding: 24px;
|
|
185
|
-
color: ${
|
|
185
|
+
color: ${e.colorTextSecondary};
|
|
186
186
|
font-size: 14px;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
.ss-empty {
|
|
190
190
|
text-align: center;
|
|
191
191
|
padding: 24px;
|
|
192
|
-
color: ${
|
|
192
|
+
color: ${e.colorTextSecondary};
|
|
193
193
|
font-size: 14px;
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -202,7 +202,7 @@ function G(s) {
|
|
|
202
202
|
font-weight: 600;
|
|
203
203
|
font-family: inherit;
|
|
204
204
|
border: none;
|
|
205
|
-
border-radius: calc(${
|
|
205
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
206
206
|
cursor: pointer;
|
|
207
207
|
transition: background 0.15s, opacity 0.15s;
|
|
208
208
|
}
|
|
@@ -210,23 +210,23 @@ function G(s) {
|
|
|
210
210
|
.ss-btn:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
211
211
|
|
|
212
212
|
.ss-btn-primary {
|
|
213
|
-
background: ${
|
|
213
|
+
background: ${e.colorPrimary};
|
|
214
214
|
color: #fff;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
.ss-btn-primary:hover:not(:disabled) { background: ${
|
|
217
|
+
.ss-btn-primary:hover:not(:disabled) { background: ${e.colorPrimaryHover}; }
|
|
218
218
|
|
|
219
219
|
.ss-btn-danger {
|
|
220
|
-
background: ${
|
|
220
|
+
background: ${e.colorError};
|
|
221
221
|
color: #fff;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
.ss-btn-danger:hover:not(:disabled) { opacity: 0.9; }
|
|
225
225
|
|
|
226
226
|
.ss-btn-current {
|
|
227
|
-
background: ${
|
|
228
|
-
color: ${
|
|
229
|
-
border: 1px solid ${
|
|
227
|
+
background: ${e.colorInputBackground};
|
|
228
|
+
color: ${e.colorTextSecondary};
|
|
229
|
+
border: 1px solid ${e.colorInputBorder};
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
.ss-btn-sm {
|
|
@@ -247,13 +247,13 @@ function G(s) {
|
|
|
247
247
|
display: flex;
|
|
248
248
|
align-items: center;
|
|
249
249
|
gap: 8px;
|
|
250
|
-
background: ${
|
|
251
|
-
border: 1px solid ${
|
|
252
|
-
color: ${
|
|
250
|
+
background: ${e.colorInputBackground};
|
|
251
|
+
border: 1px solid ${e.colorInputBorder};
|
|
252
|
+
color: ${e.colorText};
|
|
253
253
|
padding: 8px 12px;
|
|
254
254
|
font-size: 14px;
|
|
255
255
|
font-family: inherit;
|
|
256
|
-
border-radius: calc(${
|
|
256
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
257
257
|
cursor: pointer;
|
|
258
258
|
width: auto;
|
|
259
259
|
}
|
|
@@ -270,16 +270,16 @@ function G(s) {
|
|
|
270
270
|
font-size: 14px;
|
|
271
271
|
font-weight: 500;
|
|
272
272
|
font-family: inherit;
|
|
273
|
-
border: 1px solid ${
|
|
274
|
-
border-radius: calc(${
|
|
275
|
-
background: ${
|
|
276
|
-
color: ${
|
|
273
|
+
border: 1px solid ${e.colorInputBorder};
|
|
274
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
275
|
+
background: ${e.colorInputBackground};
|
|
276
|
+
color: ${e.colorText};
|
|
277
277
|
cursor: pointer;
|
|
278
278
|
transition: background 0.15s;
|
|
279
279
|
margin-bottom: 8px;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
.ss-btn-social:hover:not(:disabled) { background: ${
|
|
282
|
+
.ss-btn-social:hover:not(:disabled) { background: ${e.colorInputBorder}; }
|
|
283
283
|
.ss-btn-social:disabled { opacity: 0.6; cursor: not-allowed; }
|
|
284
284
|
.ss-btn-social svg { width: 18px; height: 18px; flex-shrink: 0; }
|
|
285
285
|
|
|
@@ -288,7 +288,7 @@ function G(s) {
|
|
|
288
288
|
align-items: center;
|
|
289
289
|
gap: 12px;
|
|
290
290
|
margin: 20px 0;
|
|
291
|
-
color: ${
|
|
291
|
+
color: ${e.colorTextSecondary};
|
|
292
292
|
font-size: 13px;
|
|
293
293
|
}
|
|
294
294
|
|
|
@@ -297,18 +297,18 @@ function G(s) {
|
|
|
297
297
|
content: '';
|
|
298
298
|
flex: 1;
|
|
299
299
|
height: 1px;
|
|
300
|
-
background: ${
|
|
300
|
+
background: ${e.colorInputBorder};
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
.ss-footer {
|
|
304
304
|
text-align: center;
|
|
305
305
|
margin-top: 20px;
|
|
306
306
|
font-size: 14px;
|
|
307
|
-
color: ${
|
|
307
|
+
color: ${e.colorTextSecondary};
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
.ss-link {
|
|
311
|
-
color: ${
|
|
311
|
+
color: ${e.colorPrimary};
|
|
312
312
|
text-decoration: none;
|
|
313
313
|
cursor: pointer;
|
|
314
314
|
font-weight: 500;
|
|
@@ -338,7 +338,7 @@ function G(s) {
|
|
|
338
338
|
width: 36px;
|
|
339
339
|
height: 36px;
|
|
340
340
|
border-radius: 50%;
|
|
341
|
-
background: ${
|
|
341
|
+
background: ${e.colorPrimary};
|
|
342
342
|
color: #fff;
|
|
343
343
|
display: flex;
|
|
344
344
|
align-items: center;
|
|
@@ -351,15 +351,15 @@ function G(s) {
|
|
|
351
351
|
transition: box-shadow 0.15s;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
.ss-avatar:hover { box-shadow: 0 0 0 3px ${
|
|
354
|
+
.ss-avatar:hover { box-shadow: 0 0 0 3px ${e.colorPrimary}33; }
|
|
355
355
|
|
|
356
356
|
.ss-dropdown {
|
|
357
357
|
position: absolute;
|
|
358
358
|
top: calc(100% + 8px);
|
|
359
359
|
right: 0;
|
|
360
|
-
background: ${
|
|
361
|
-
border: 1px solid ${
|
|
362
|
-
border-radius: ${
|
|
360
|
+
background: ${e.colorBackground};
|
|
361
|
+
border: 1px solid ${e.colorInputBorder};
|
|
362
|
+
border-radius: ${e.borderRadius};
|
|
363
363
|
padding: 8px 0;
|
|
364
364
|
min-width: 200px;
|
|
365
365
|
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
|
|
@@ -370,13 +370,13 @@ function G(s) {
|
|
|
370
370
|
|
|
371
371
|
.ss-dropdown-header {
|
|
372
372
|
padding: 8px 16px 12px;
|
|
373
|
-
border-bottom: 1px solid ${
|
|
373
|
+
border-bottom: 1px solid ${e.colorInputBorder};
|
|
374
374
|
margin-bottom: 4px;
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
.ss-dropdown-email {
|
|
378
378
|
font-size: 13px;
|
|
379
|
-
color: ${
|
|
379
|
+
color: ${e.colorTextSecondary};
|
|
380
380
|
word-break: break-all;
|
|
381
381
|
}
|
|
382
382
|
|
|
@@ -386,7 +386,7 @@ function G(s) {
|
|
|
386
386
|
padding: 8px 16px;
|
|
387
387
|
font-size: 14px;
|
|
388
388
|
font-family: inherit;
|
|
389
|
-
color: ${
|
|
389
|
+
color: ${e.colorText};
|
|
390
390
|
background: none;
|
|
391
391
|
border: none;
|
|
392
392
|
text-align: left;
|
|
@@ -394,9 +394,29 @@ function G(s) {
|
|
|
394
394
|
transition: background 0.1s;
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
.ss-dropdown-item:hover { background: ${
|
|
398
|
-
.ss-dropdown-item-danger { color: ${
|
|
399
|
-
.ss-dropdown-item-active { font-weight: 600; color: ${
|
|
397
|
+
.ss-dropdown-item:hover { background: ${e.colorInputBackground}; }
|
|
398
|
+
.ss-dropdown-item-danger { color: ${e.colorError}; }
|
|
399
|
+
.ss-dropdown-item-active { font-weight: 600; color: ${e.colorPrimary}; }
|
|
400
|
+
|
|
401
|
+
.ss-dropdown-section-title {
|
|
402
|
+
padding: 8px 16px 4px;
|
|
403
|
+
font-size: 11px;
|
|
404
|
+
font-weight: 600;
|
|
405
|
+
text-transform: uppercase;
|
|
406
|
+
letter-spacing: 0.5px;
|
|
407
|
+
color: ${e.colorTextSecondary};
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.ss-org-check {
|
|
411
|
+
margin-right: 6px;
|
|
412
|
+
font-size: 12px;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.ss-danger-zone {
|
|
416
|
+
padding-top: 20px;
|
|
417
|
+
margin-top: 20px;
|
|
418
|
+
border-top: 2px solid ${e.colorError}33;
|
|
419
|
+
}
|
|
400
420
|
|
|
401
421
|
/* Badges */
|
|
402
422
|
|
|
@@ -408,21 +428,21 @@ function G(s) {
|
|
|
408
428
|
border-radius: 999px;
|
|
409
429
|
text-transform: uppercase;
|
|
410
430
|
letter-spacing: 0.3px;
|
|
411
|
-
background: ${
|
|
412
|
-
color: ${
|
|
431
|
+
background: ${e.colorInputBackground};
|
|
432
|
+
color: ${e.colorTextSecondary};
|
|
413
433
|
}
|
|
414
434
|
|
|
415
|
-
.ss-badge-active { background: ${
|
|
416
|
-
.ss-badge-trialing { background: ${
|
|
417
|
-
.ss-badge-past-due { background: ${
|
|
418
|
-
.ss-badge-paused { background: ${
|
|
419
|
-
.ss-badge-canceled { background: ${
|
|
435
|
+
.ss-badge-active { background: ${e.colorSuccess}22; color: ${e.colorSuccess}; }
|
|
436
|
+
.ss-badge-trialing { background: ${e.colorPrimary}22; color: ${e.colorPrimary}; }
|
|
437
|
+
.ss-badge-past-due { background: ${e.colorError}22; color: ${e.colorError}; }
|
|
438
|
+
.ss-badge-paused { background: ${e.colorWarning}22; color: ${e.colorWarning}; }
|
|
439
|
+
.ss-badge-canceled { background: ${e.colorTextSecondary}22; color: ${e.colorTextSecondary}; }
|
|
420
440
|
|
|
421
441
|
/* Tabs */
|
|
422
442
|
|
|
423
443
|
.ss-tab-group {
|
|
424
444
|
display: flex;
|
|
425
|
-
border-bottom: 1px solid ${
|
|
445
|
+
border-bottom: 1px solid ${e.colorInputBorder};
|
|
426
446
|
margin-bottom: 24px;
|
|
427
447
|
}
|
|
428
448
|
|
|
@@ -433,7 +453,7 @@ function G(s) {
|
|
|
433
453
|
font-size: 14px;
|
|
434
454
|
font-weight: 500;
|
|
435
455
|
font-family: inherit;
|
|
436
|
-
color: ${
|
|
456
|
+
color: ${e.colorTextSecondary};
|
|
437
457
|
background: none;
|
|
438
458
|
border: none;
|
|
439
459
|
border-bottom: 2px solid transparent;
|
|
@@ -441,11 +461,11 @@ function G(s) {
|
|
|
441
461
|
transition: color 0.15s, border-color 0.15s;
|
|
442
462
|
}
|
|
443
463
|
|
|
444
|
-
.ss-tab:hover { color: ${
|
|
464
|
+
.ss-tab:hover { color: ${e.colorText}; }
|
|
445
465
|
|
|
446
466
|
.ss-tab-active {
|
|
447
|
-
color: ${
|
|
448
|
-
border-bottom-color: ${
|
|
467
|
+
color: ${e.colorPrimary};
|
|
468
|
+
border-bottom-color: ${e.colorPrimary};
|
|
449
469
|
}
|
|
450
470
|
|
|
451
471
|
.ss-tab-content .ss-card { box-shadow: none; border: none; padding: 0; }
|
|
@@ -464,30 +484,30 @@ function G(s) {
|
|
|
464
484
|
text-align: left;
|
|
465
485
|
padding: 10px 12px;
|
|
466
486
|
font-weight: 600;
|
|
467
|
-
color: ${
|
|
468
|
-
border-bottom: 2px solid ${
|
|
487
|
+
color: ${e.colorTextSecondary};
|
|
488
|
+
border-bottom: 2px solid ${e.colorInputBorder};
|
|
469
489
|
white-space: nowrap;
|
|
470
490
|
}
|
|
471
491
|
|
|
472
492
|
.ss-th-sortable { cursor: pointer; user-select: none; }
|
|
473
|
-
.ss-th-sortable:hover { color: ${
|
|
493
|
+
.ss-th-sortable:hover { color: ${e.colorText}; }
|
|
474
494
|
|
|
475
495
|
.ss-sort-indicator { font-size: 10px; }
|
|
476
|
-
.ss-sorted-asc, .ss-sorted-desc { color: ${
|
|
496
|
+
.ss-sorted-asc, .ss-sorted-desc { color: ${e.colorPrimary}; }
|
|
477
497
|
|
|
478
498
|
.ss-td {
|
|
479
499
|
padding: 10px 12px;
|
|
480
|
-
border-bottom: 1px solid ${
|
|
481
|
-
color: ${
|
|
500
|
+
border-bottom: 1px solid ${e.colorInputBorder};
|
|
501
|
+
color: ${e.colorText};
|
|
482
502
|
}
|
|
483
503
|
|
|
484
|
-
.ss-tr:hover .ss-td { background: ${
|
|
504
|
+
.ss-tr:hover .ss-td { background: ${e.colorInputBackground}; }
|
|
485
505
|
|
|
486
506
|
.ss-table-footer {
|
|
487
507
|
text-align: center;
|
|
488
508
|
padding: 8px;
|
|
489
509
|
font-size: 12px;
|
|
490
|
-
color: ${
|
|
510
|
+
color: ${e.colorTextSecondary};
|
|
491
511
|
}
|
|
492
512
|
|
|
493
513
|
/* Pricing */
|
|
@@ -499,15 +519,15 @@ function G(s) {
|
|
|
499
519
|
}
|
|
500
520
|
|
|
501
521
|
.ss-pricing-card {
|
|
502
|
-
background: ${
|
|
503
|
-
border: 1px solid ${
|
|
504
|
-
border-radius: ${
|
|
522
|
+
background: ${e.colorBackground};
|
|
523
|
+
border: 1px solid ${e.colorInputBorder};
|
|
524
|
+
border-radius: ${e.borderRadius};
|
|
505
525
|
padding: 24px;
|
|
506
526
|
display: flex;
|
|
507
527
|
flex-direction: column;
|
|
508
528
|
}
|
|
509
529
|
|
|
510
|
-
.ss-pricing-card-current { border-color: ${
|
|
530
|
+
.ss-pricing-card-current { border-color: ${e.colorPrimary}; }
|
|
511
531
|
|
|
512
532
|
.ss-pricing-header {
|
|
513
533
|
display: flex;
|
|
@@ -519,7 +539,7 @@ function G(s) {
|
|
|
519
539
|
.ss-pricing-name {
|
|
520
540
|
font-size: 18px;
|
|
521
541
|
font-weight: 600;
|
|
522
|
-
color: ${
|
|
542
|
+
color: ${e.colorText};
|
|
523
543
|
}
|
|
524
544
|
|
|
525
545
|
.ss-pricing-price { margin-bottom: 12px; }
|
|
@@ -527,17 +547,17 @@ function G(s) {
|
|
|
527
547
|
.ss-pricing-amount {
|
|
528
548
|
font-size: 32px;
|
|
529
549
|
font-weight: 700;
|
|
530
|
-
color: ${
|
|
550
|
+
color: ${e.colorText};
|
|
531
551
|
}
|
|
532
552
|
|
|
533
553
|
.ss-pricing-interval {
|
|
534
554
|
font-size: 14px;
|
|
535
|
-
color: ${
|
|
555
|
+
color: ${e.colorTextSecondary};
|
|
536
556
|
}
|
|
537
557
|
|
|
538
558
|
.ss-pricing-desc {
|
|
539
559
|
font-size: 14px;
|
|
540
|
-
color: ${
|
|
560
|
+
color: ${e.colorTextSecondary};
|
|
541
561
|
margin-bottom: 16px;
|
|
542
562
|
}
|
|
543
563
|
|
|
@@ -549,11 +569,11 @@ function G(s) {
|
|
|
549
569
|
|
|
550
570
|
.ss-pricing-feature {
|
|
551
571
|
font-size: 14px;
|
|
552
|
-
color: ${
|
|
572
|
+
color: ${e.colorText};
|
|
553
573
|
padding: 4px 0;
|
|
554
574
|
}
|
|
555
575
|
|
|
556
|
-
.ss-check { color: ${
|
|
576
|
+
.ss-check { color: ${e.colorSuccess}; margin-right: 6px; }
|
|
557
577
|
|
|
558
578
|
/* Usage / Progress */
|
|
559
579
|
|
|
@@ -568,30 +588,30 @@ function G(s) {
|
|
|
568
588
|
.ss-usage-metric {
|
|
569
589
|
font-size: 14px;
|
|
570
590
|
font-weight: 500;
|
|
571
|
-
color: ${
|
|
591
|
+
color: ${e.colorText};
|
|
572
592
|
}
|
|
573
593
|
|
|
574
594
|
.ss-usage-value {
|
|
575
595
|
font-size: 14px;
|
|
576
|
-
color: ${
|
|
596
|
+
color: ${e.colorTextSecondary};
|
|
577
597
|
}
|
|
578
598
|
|
|
579
599
|
.ss-progress-bar {
|
|
580
600
|
width: 100%;
|
|
581
601
|
height: 8px;
|
|
582
|
-
background: ${
|
|
602
|
+
background: ${e.colorInputBackground};
|
|
583
603
|
border-radius: 4px;
|
|
584
604
|
overflow: hidden;
|
|
585
605
|
}
|
|
586
606
|
|
|
587
607
|
.ss-progress-fill {
|
|
588
608
|
height: 100%;
|
|
589
|
-
background: ${
|
|
609
|
+
background: ${e.colorPrimary};
|
|
590
610
|
border-radius: 4px;
|
|
591
611
|
transition: width 0.3s;
|
|
592
612
|
}
|
|
593
613
|
|
|
594
|
-
.ss-progress-danger { background: ${
|
|
614
|
+
.ss-progress-danger { background: ${e.colorError}; }
|
|
595
615
|
|
|
596
616
|
/* Chart */
|
|
597
617
|
|
|
@@ -600,7 +620,7 @@ function G(s) {
|
|
|
600
620
|
.ss-chart-title {
|
|
601
621
|
font-size: 16px;
|
|
602
622
|
font-weight: 600;
|
|
603
|
-
color: ${
|
|
623
|
+
color: ${e.colorText};
|
|
604
624
|
margin-bottom: 12px;
|
|
605
625
|
}
|
|
606
626
|
|
|
@@ -613,16 +633,16 @@ function G(s) {
|
|
|
613
633
|
}
|
|
614
634
|
|
|
615
635
|
.ss-widget {
|
|
616
|
-
background: ${
|
|
617
|
-
border: 1px solid ${
|
|
618
|
-
border-radius: ${
|
|
636
|
+
background: ${e.colorBackground};
|
|
637
|
+
border: 1px solid ${e.colorInputBorder};
|
|
638
|
+
border-radius: ${e.borderRadius};
|
|
619
639
|
padding: 16px;
|
|
620
640
|
}
|
|
621
641
|
|
|
622
642
|
.ss-widget-header {
|
|
623
643
|
font-size: 14px;
|
|
624
644
|
font-weight: 600;
|
|
625
|
-
color: ${
|
|
645
|
+
color: ${e.colorText};
|
|
626
646
|
margin-bottom: 12px;
|
|
627
647
|
}
|
|
628
648
|
|
|
@@ -630,14 +650,14 @@ function G(s) {
|
|
|
630
650
|
|
|
631
651
|
.ss-saved-query-card {
|
|
632
652
|
padding: 12px 16px;
|
|
633
|
-
border: 1px solid ${
|
|
634
|
-
border-radius: calc(${
|
|
653
|
+
border: 1px solid ${e.colorInputBorder};
|
|
654
|
+
border-radius: calc(${e.borderRadius} - 2px);
|
|
635
655
|
margin-bottom: 8px;
|
|
636
656
|
cursor: pointer;
|
|
637
657
|
transition: border-color 0.15s;
|
|
638
658
|
}
|
|
639
659
|
|
|
640
|
-
.ss-saved-query-card:hover { border-color: ${
|
|
660
|
+
.ss-saved-query-card:hover { border-color: ${e.colorPrimary}; }
|
|
641
661
|
|
|
642
662
|
.ss-saved-query-header {
|
|
643
663
|
display: flex;
|
|
@@ -649,12 +669,12 @@ function G(s) {
|
|
|
649
669
|
.ss-saved-query-name {
|
|
650
670
|
font-size: 14px;
|
|
651
671
|
font-weight: 600;
|
|
652
|
-
color: ${
|
|
672
|
+
color: ${e.colorText};
|
|
653
673
|
}
|
|
654
674
|
|
|
655
675
|
.ss-saved-query-desc {
|
|
656
676
|
font-size: 13px;
|
|
657
|
-
color: ${
|
|
677
|
+
color: ${e.colorTextSecondary};
|
|
658
678
|
margin-bottom: 8px;
|
|
659
679
|
}
|
|
660
680
|
|
|
@@ -666,7 +686,7 @@ function G(s) {
|
|
|
666
686
|
|
|
667
687
|
.ss-saved-query-date {
|
|
668
688
|
font-size: 12px;
|
|
669
|
-
color: ${
|
|
689
|
+
color: ${e.colorTextSecondary};
|
|
670
690
|
}
|
|
671
691
|
|
|
672
692
|
/* Modal Overlay */
|
|
@@ -691,15 +711,15 @@ function G(s) {
|
|
|
691
711
|
}
|
|
692
712
|
|
|
693
713
|
.ss-modal {
|
|
694
|
-
background: ${
|
|
695
|
-
border-radius: ${
|
|
714
|
+
background: ${e.colorBackground};
|
|
715
|
+
border-radius: ${e.borderRadius};
|
|
696
716
|
padding: 32px;
|
|
697
717
|
width: 90%;
|
|
698
718
|
max-width: 480px;
|
|
699
719
|
max-height: 90vh;
|
|
700
720
|
overflow-y: auto;
|
|
701
721
|
box-shadow: 0 16px 64px rgba(0, 0, 0, 0.2);
|
|
702
|
-
border: 1px solid ${
|
|
722
|
+
border: 1px solid ${e.colorInputBorder};
|
|
703
723
|
animation: ss-scale-in 0.15s ease-out;
|
|
704
724
|
}
|
|
705
725
|
|
|
@@ -718,14 +738,14 @@ function G(s) {
|
|
|
718
738
|
.ss-modal-title {
|
|
719
739
|
font-size: 18px;
|
|
720
740
|
font-weight: 700;
|
|
721
|
-
color: ${
|
|
741
|
+
color: ${e.colorText};
|
|
722
742
|
}
|
|
723
743
|
|
|
724
744
|
.ss-modal-close {
|
|
725
745
|
background: none;
|
|
726
746
|
border: none;
|
|
727
747
|
font-size: 20px;
|
|
728
|
-
color: ${
|
|
748
|
+
color: ${e.colorTextSecondary};
|
|
729
749
|
cursor: pointer;
|
|
730
750
|
padding: 4px;
|
|
731
751
|
line-height: 1;
|
|
@@ -735,20 +755,20 @@ function G(s) {
|
|
|
735
755
|
}
|
|
736
756
|
|
|
737
757
|
.ss-modal-close:hover {
|
|
738
|
-
background: ${
|
|
739
|
-
color: ${
|
|
758
|
+
background: ${e.colorInputBackground};
|
|
759
|
+
color: ${e.colorText};
|
|
740
760
|
}
|
|
741
761
|
|
|
742
762
|
.ss-modal-section {
|
|
743
763
|
padding-top: 20px;
|
|
744
764
|
margin-top: 20px;
|
|
745
|
-
border-top: 1px solid ${
|
|
765
|
+
border-top: 1px solid ${e.colorInputBorder};
|
|
746
766
|
}
|
|
747
767
|
|
|
748
768
|
.ss-modal-section-title {
|
|
749
769
|
font-size: 15px;
|
|
750
770
|
font-weight: 600;
|
|
751
|
-
color: ${
|
|
771
|
+
color: ${e.colorText};
|
|
752
772
|
margin-bottom: 16px;
|
|
753
773
|
}
|
|
754
774
|
|
|
@@ -756,7 +776,7 @@ function G(s) {
|
|
|
756
776
|
width: 64px;
|
|
757
777
|
height: 64px;
|
|
758
778
|
border-radius: 50%;
|
|
759
|
-
background: ${
|
|
779
|
+
background: ${e.colorPrimary};
|
|
760
780
|
color: #fff;
|
|
761
781
|
display: flex;
|
|
762
782
|
align-items: center;
|
|
@@ -806,7 +826,7 @@ function G(s) {
|
|
|
806
826
|
}
|
|
807
827
|
|
|
808
828
|
.ss-avatar-canvas {
|
|
809
|
-
border-radius: ${
|
|
829
|
+
border-radius: ${e.borderRadius};
|
|
810
830
|
background: #111;
|
|
811
831
|
touch-action: none;
|
|
812
832
|
max-width: 100%;
|
|
@@ -821,7 +841,7 @@ function G(s) {
|
|
|
821
841
|
|
|
822
842
|
.ss-avatar-zoom-label {
|
|
823
843
|
font-size: 13px;
|
|
824
|
-
color: ${
|
|
844
|
+
color: ${e.colorTextSecondary};
|
|
825
845
|
flex-shrink: 0;
|
|
826
846
|
}
|
|
827
847
|
|
|
@@ -830,7 +850,7 @@ function G(s) {
|
|
|
830
850
|
height: 4px;
|
|
831
851
|
-webkit-appearance: none;
|
|
832
852
|
appearance: none;
|
|
833
|
-
background: ${
|
|
853
|
+
background: ${e.colorInputBorder};
|
|
834
854
|
border-radius: 2px;
|
|
835
855
|
outline: none;
|
|
836
856
|
}
|
|
@@ -840,7 +860,7 @@ function G(s) {
|
|
|
840
860
|
width: 16px;
|
|
841
861
|
height: 16px;
|
|
842
862
|
border-radius: 50%;
|
|
843
|
-
background: ${
|
|
863
|
+
background: ${e.colorPrimary};
|
|
844
864
|
cursor: pointer;
|
|
845
865
|
}
|
|
846
866
|
|
|
@@ -848,20 +868,20 @@ function G(s) {
|
|
|
848
868
|
width: 16px;
|
|
849
869
|
height: 16px;
|
|
850
870
|
border-radius: 50%;
|
|
851
|
-
background: ${
|
|
871
|
+
background: ${e.colorPrimary};
|
|
852
872
|
cursor: pointer;
|
|
853
873
|
border: none;
|
|
854
874
|
}
|
|
855
875
|
|
|
856
876
|
/* Dropzone */
|
|
857
877
|
.ss-avatar-dropzone {
|
|
858
|
-
border: 2px dashed ${
|
|
859
|
-
border-radius: ${
|
|
878
|
+
border: 2px dashed ${e.colorInputBorder};
|
|
879
|
+
border-radius: ${e.borderRadius};
|
|
860
880
|
padding: 40px 24px;
|
|
861
881
|
text-align: center;
|
|
862
882
|
cursor: pointer;
|
|
863
883
|
transition: border-color 0.15s, background 0.15s;
|
|
864
|
-
color: ${
|
|
884
|
+
color: ${e.colorTextSecondary};
|
|
865
885
|
display: flex;
|
|
866
886
|
flex-direction: column;
|
|
867
887
|
align-items: center;
|
|
@@ -870,8 +890,8 @@ function G(s) {
|
|
|
870
890
|
|
|
871
891
|
.ss-avatar-dropzone:hover,
|
|
872
892
|
.ss-avatar-dropzone-active {
|
|
873
|
-
border-color: ${
|
|
874
|
-
background: ${
|
|
893
|
+
border-color: ${e.colorPrimary};
|
|
894
|
+
background: ${e.colorPrimary}08;
|
|
875
895
|
}
|
|
876
896
|
|
|
877
897
|
.ss-avatar-dropzone svg {
|
|
@@ -887,7 +907,7 @@ function G(s) {
|
|
|
887
907
|
|
|
888
908
|
.ss-dropdown-divider {
|
|
889
909
|
height: 1px;
|
|
890
|
-
background: ${
|
|
910
|
+
background: ${e.colorInputBorder};
|
|
891
911
|
margin: 4px 0;
|
|
892
912
|
}
|
|
893
913
|
|
|
@@ -910,229 +930,335 @@ function G(s) {
|
|
|
910
930
|
}
|
|
911
931
|
`;
|
|
912
932
|
}
|
|
913
|
-
function
|
|
914
|
-
const r =
|
|
915
|
-
|
|
916
|
-
var
|
|
933
|
+
function q({ children: e, appearance: a }) {
|
|
934
|
+
const r = j(null), [o, t] = m(null);
|
|
935
|
+
U(() => {
|
|
936
|
+
var g;
|
|
917
937
|
if (!r.current || r.current.shadowRoot) {
|
|
918
|
-
t(((
|
|
938
|
+
t(((g = r.current) == null ? void 0 : g.shadowRoot) ?? null);
|
|
919
939
|
return;
|
|
920
940
|
}
|
|
921
|
-
const
|
|
922
|
-
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
}, []),
|
|
926
|
-
if (!
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
929
|
-
const
|
|
930
|
-
|
|
931
|
-
}
|
|
932
|
-
}, [a,
|
|
933
|
-
const
|
|
934
|
-
return /* @__PURE__ */
|
|
941
|
+
const i = r.current.attachShadow({ mode: "open" }), c = Z(a), d = document.createElement("style");
|
|
942
|
+
d.textContent = X(c), i.appendChild(d);
|
|
943
|
+
const l = document.createElement("div");
|
|
944
|
+
i.appendChild(l), t(i);
|
|
945
|
+
}, []), U(() => {
|
|
946
|
+
if (!o) return;
|
|
947
|
+
const i = o.querySelector("style");
|
|
948
|
+
if (i) {
|
|
949
|
+
const c = Z(a);
|
|
950
|
+
i.textContent = X(c);
|
|
951
|
+
}
|
|
952
|
+
}, [a, o]);
|
|
953
|
+
const u = (o == null ? void 0 : o.querySelector("div")) ?? null;
|
|
954
|
+
return /* @__PURE__ */ s("div", { ref: r, style: { display: "contents" }, children: u && ve(e, u) });
|
|
935
955
|
}
|
|
936
|
-
function
|
|
937
|
-
const { client:
|
|
956
|
+
function ee() {
|
|
957
|
+
const { client: e, user: a, isLoaded: r } = L();
|
|
938
958
|
return {
|
|
939
959
|
isLoaded: r,
|
|
940
960
|
isSignedIn: !!a,
|
|
941
961
|
user: a,
|
|
942
|
-
signOut:
|
|
943
|
-
getToken:
|
|
962
|
+
signOut: N(() => e.auth.signOut(), [e]),
|
|
963
|
+
getToken: N(() => e.auth.getToken(), [e])
|
|
944
964
|
};
|
|
945
965
|
}
|
|
946
|
-
function
|
|
947
|
-
const { user:
|
|
948
|
-
return { user:
|
|
966
|
+
function Xe() {
|
|
967
|
+
const { user: e, isLoaded: a } = L();
|
|
968
|
+
return { user: e, isLoaded: a };
|
|
949
969
|
}
|
|
950
|
-
function
|
|
951
|
-
const { client:
|
|
952
|
-
async (
|
|
970
|
+
function re() {
|
|
971
|
+
const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null), u = N(
|
|
972
|
+
async (d, l) => {
|
|
953
973
|
r(!0), t(null);
|
|
954
974
|
try {
|
|
955
|
-
return await
|
|
956
|
-
} catch (
|
|
957
|
-
return t(
|
|
975
|
+
return await e.auth.signIn(d, l);
|
|
976
|
+
} catch (g) {
|
|
977
|
+
return t(g instanceof Error ? g.message : "Sign in failed"), null;
|
|
958
978
|
} finally {
|
|
959
979
|
r(!1);
|
|
960
980
|
}
|
|
961
981
|
},
|
|
962
|
-
[
|
|
963
|
-
),
|
|
964
|
-
async (
|
|
982
|
+
[e]
|
|
983
|
+
), i = N(
|
|
984
|
+
async (d) => {
|
|
965
985
|
r(!0), t(null);
|
|
966
986
|
try {
|
|
967
|
-
return await
|
|
968
|
-
} catch (
|
|
969
|
-
return t(
|
|
987
|
+
return await e.auth.signInWithOAuth(d);
|
|
988
|
+
} catch (l) {
|
|
989
|
+
return t(l instanceof Error ? l.message : "OAuth sign in failed"), null;
|
|
970
990
|
} finally {
|
|
971
991
|
r(!1);
|
|
972
992
|
}
|
|
973
993
|
},
|
|
974
|
-
[
|
|
975
|
-
),
|
|
976
|
-
async (
|
|
994
|
+
[e]
|
|
995
|
+
), c = N(
|
|
996
|
+
async (d, l) => {
|
|
977
997
|
r(!0), t(null);
|
|
978
998
|
try {
|
|
979
|
-
return await
|
|
980
|
-
} catch (
|
|
981
|
-
return t(
|
|
999
|
+
return await e.auth.submitMfaCode(d, l);
|
|
1000
|
+
} catch (g) {
|
|
1001
|
+
return t(g instanceof Error ? g.message : "MFA verification failed"), null;
|
|
982
1002
|
} finally {
|
|
983
1003
|
r(!1);
|
|
984
1004
|
}
|
|
985
1005
|
},
|
|
986
|
-
[
|
|
1006
|
+
[e]
|
|
987
1007
|
);
|
|
988
|
-
return { signIn:
|
|
1008
|
+
return { signIn: u, signInWithOAuth: i, submitMfaCode: c, isLoading: a, error: o, setError: t };
|
|
989
1009
|
}
|
|
990
|
-
function
|
|
991
|
-
const { client:
|
|
992
|
-
return { signUp:
|
|
993
|
-
async (
|
|
1010
|
+
function Ce() {
|
|
1011
|
+
const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null);
|
|
1012
|
+
return { signUp: N(
|
|
1013
|
+
async (i, c) => {
|
|
994
1014
|
r(!0), t(null);
|
|
995
1015
|
try {
|
|
996
|
-
return await
|
|
997
|
-
} catch (
|
|
998
|
-
return t(
|
|
1016
|
+
return await e.auth.signUp(i, c);
|
|
1017
|
+
} catch (d) {
|
|
1018
|
+
return t(d instanceof Error ? d.message : "Sign up failed"), null;
|
|
999
1019
|
} finally {
|
|
1000
1020
|
r(!1);
|
|
1001
1021
|
}
|
|
1002
1022
|
},
|
|
1003
|
-
[
|
|
1004
|
-
), isLoading: a, error:
|
|
1023
|
+
[e]
|
|
1024
|
+
), isLoading: a, error: o, setError: t };
|
|
1005
1025
|
}
|
|
1006
|
-
function
|
|
1007
|
-
const { client:
|
|
1008
|
-
|
|
1026
|
+
function ae() {
|
|
1027
|
+
const { client: e } = L(), [a, r] = m([]), [o, t] = m(null), [u, i] = m([]), [c, d] = m([]), [l, g] = m(!1), [p, f] = m(null), b = N(async () => {
|
|
1028
|
+
g(!0), f(null);
|
|
1009
1029
|
try {
|
|
1010
|
-
const
|
|
1011
|
-
r(
|
|
1012
|
-
|
|
1013
|
-
|
|
1030
|
+
const w = await e.auth.listOrgs();
|
|
1031
|
+
r(w);
|
|
1032
|
+
const $ = typeof window < "u" ? localStorage.getItem("ss_selected_org") : null;
|
|
1033
|
+
if ($ && w.some((y) => y.id === $) && !o) {
|
|
1034
|
+
const y = w.find((E) => E.id === $);
|
|
1035
|
+
t(y);
|
|
1036
|
+
try {
|
|
1037
|
+
const E = await e.auth.listMembers(y.id);
|
|
1038
|
+
i(E);
|
|
1039
|
+
} catch {
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
} catch (w) {
|
|
1043
|
+
f(w instanceof Error ? w.message : "Failed to load organizations");
|
|
1014
1044
|
} finally {
|
|
1015
|
-
|
|
1045
|
+
g(!1);
|
|
1016
1046
|
}
|
|
1017
|
-
}, [
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
}, [
|
|
1021
|
-
const
|
|
1047
|
+
}, [e, o]);
|
|
1048
|
+
U(() => {
|
|
1049
|
+
b();
|
|
1050
|
+
}, [b]);
|
|
1051
|
+
const k = N(async (w) => {
|
|
1022
1052
|
try {
|
|
1023
|
-
const
|
|
1024
|
-
t(
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1053
|
+
const $ = await e.auth.getOrg(w);
|
|
1054
|
+
t($), typeof window < "u" && localStorage.setItem("ss_selected_org", w);
|
|
1055
|
+
const y = await e.auth.listMembers(w);
|
|
1056
|
+
i(y);
|
|
1057
|
+
} catch ($) {
|
|
1058
|
+
f($ instanceof Error ? $.message : "Failed to load organization");
|
|
1059
|
+
}
|
|
1060
|
+
}, [e]), v = N(async (w, $) => {
|
|
1061
|
+
try {
|
|
1062
|
+
const y = await e.auth.createOrg(w, $);
|
|
1063
|
+
return r((E) => [...E, y]), y;
|
|
1027
1064
|
} catch (y) {
|
|
1028
|
-
|
|
1065
|
+
return f(y instanceof Error ? y.message : "Failed to create organization"), null;
|
|
1029
1066
|
}
|
|
1030
|
-
}, [
|
|
1067
|
+
}, [e]), C = N(async (w, $) => {
|
|
1031
1068
|
try {
|
|
1032
|
-
const
|
|
1033
|
-
return r((
|
|
1034
|
-
} catch (
|
|
1035
|
-
return
|
|
1069
|
+
const y = await e.auth.updateOrg(w, $);
|
|
1070
|
+
return r((E) => E.map((M) => M.id === w ? y : M)), (o == null ? void 0 : o.id) === w && t(y), y;
|
|
1071
|
+
} catch (y) {
|
|
1072
|
+
return f(y instanceof Error ? y.message : "Failed to update organization"), null;
|
|
1073
|
+
}
|
|
1074
|
+
}, [e, o]), x = N(async (w) => {
|
|
1075
|
+
try {
|
|
1076
|
+
return await e.auth.deleteOrg(w), r(($) => $.filter((y) => y.id !== w)), (o == null ? void 0 : o.id) === w && (t(null), i([]), d([]), typeof window < "u" && localStorage.removeItem("ss_selected_org")), !0;
|
|
1077
|
+
} catch ($) {
|
|
1078
|
+
return f($ instanceof Error ? $.message : "Failed to delete organization"), !1;
|
|
1079
|
+
}
|
|
1080
|
+
}, [e, o]), h = N(async (w, $, y) => {
|
|
1081
|
+
try {
|
|
1082
|
+
return await e.auth.sendInvite(w, $, y);
|
|
1083
|
+
} catch (E) {
|
|
1084
|
+
return f(E instanceof Error ? E.message : "Failed to send invite"), null;
|
|
1085
|
+
}
|
|
1086
|
+
}, [e]), S = N(async (w) => {
|
|
1087
|
+
try {
|
|
1088
|
+
const $ = await e.auth.listInvites(w);
|
|
1089
|
+
d($);
|
|
1090
|
+
} catch ($) {
|
|
1091
|
+
f($ instanceof Error ? $.message : "Failed to load invites");
|
|
1092
|
+
}
|
|
1093
|
+
}, [e]), z = N(async (w, $) => {
|
|
1094
|
+
try {
|
|
1095
|
+
return await e.auth.revokeInvite(w, $), d((y) => y.filter((E) => E.id !== $)), !0;
|
|
1096
|
+
} catch (y) {
|
|
1097
|
+
return f(y instanceof Error ? y.message : "Failed to revoke invite"), !1;
|
|
1098
|
+
}
|
|
1099
|
+
}, [e]), P = N(async (w, $, y) => {
|
|
1100
|
+
try {
|
|
1101
|
+
return await e.auth.updateMemberRole(w, $, y), i((E) => E.map((M) => M.userId === $ ? { ...M, role: y } : M)), !0;
|
|
1102
|
+
} catch (E) {
|
|
1103
|
+
return f(E instanceof Error ? E.message : "Failed to update member role"), !1;
|
|
1104
|
+
}
|
|
1105
|
+
}, [e]), I = N(async (w, $) => {
|
|
1106
|
+
try {
|
|
1107
|
+
return await e.auth.removeMember(w, $), i((y) => y.filter((E) => E.userId !== $)), !0;
|
|
1108
|
+
} catch (y) {
|
|
1109
|
+
return f(y instanceof Error ? y.message : "Failed to remove member"), !1;
|
|
1110
|
+
}
|
|
1111
|
+
}, [e]), T = N(async (w) => {
|
|
1112
|
+
try {
|
|
1113
|
+
const $ = await e.auth.listMembers(w);
|
|
1114
|
+
i($);
|
|
1115
|
+
} catch ($) {
|
|
1116
|
+
f($ instanceof Error ? $.message : "Failed to load members");
|
|
1117
|
+
}
|
|
1118
|
+
}, [e]);
|
|
1119
|
+
return {
|
|
1120
|
+
orgs: a,
|
|
1121
|
+
selectedOrg: o,
|
|
1122
|
+
members: u,
|
|
1123
|
+
invites: c,
|
|
1124
|
+
isLoading: l,
|
|
1125
|
+
error: p,
|
|
1126
|
+
setError: f,
|
|
1127
|
+
refresh: b,
|
|
1128
|
+
selectOrg: k,
|
|
1129
|
+
createOrg: v,
|
|
1130
|
+
updateOrg: C,
|
|
1131
|
+
deleteOrg: x,
|
|
1132
|
+
sendInvite: h,
|
|
1133
|
+
refreshInvites: S,
|
|
1134
|
+
revokeInvite: z,
|
|
1135
|
+
updateMemberRole: P,
|
|
1136
|
+
removeMember: I,
|
|
1137
|
+
refreshMembers: T
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
function ke() {
|
|
1141
|
+
const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null);
|
|
1142
|
+
return { deleteAccount: N(async () => {
|
|
1143
|
+
r(!0), t(null);
|
|
1144
|
+
try {
|
|
1145
|
+
return await e.auth.deleteAccount(), !0;
|
|
1146
|
+
} catch (i) {
|
|
1147
|
+
return t(i instanceof Error ? i.message : "Failed to delete account"), !1;
|
|
1148
|
+
} finally {
|
|
1149
|
+
r(!1);
|
|
1036
1150
|
}
|
|
1037
|
-
}, [
|
|
1038
|
-
return { orgs: a, selectedOrg: c, members: i, isLoading: u, error: n, refresh: p, selectOrg: b, createOrg: f };
|
|
1151
|
+
}, [e]), isLoading: a, error: o, setError: t };
|
|
1039
1152
|
}
|
|
1040
|
-
function
|
|
1041
|
-
const { client:
|
|
1153
|
+
function te() {
|
|
1154
|
+
const { client: e, user: a } = L(), [r, o] = m(!1), [t, u] = m(null), [i, c] = m(null), d = N(
|
|
1042
1155
|
async (p) => {
|
|
1043
|
-
|
|
1156
|
+
o(!0), u(null), c(null);
|
|
1044
1157
|
try {
|
|
1045
|
-
const
|
|
1046
|
-
return
|
|
1047
|
-
} catch (
|
|
1048
|
-
return
|
|
1158
|
+
const f = await e.auth.updateProfile(p);
|
|
1159
|
+
return c("Profile updated"), f;
|
|
1160
|
+
} catch (f) {
|
|
1161
|
+
return u(f instanceof Error ? f.message : "Failed to update profile"), null;
|
|
1049
1162
|
} finally {
|
|
1050
|
-
|
|
1163
|
+
o(!1);
|
|
1051
1164
|
}
|
|
1052
1165
|
},
|
|
1053
|
-
[
|
|
1054
|
-
),
|
|
1055
|
-
async (p,
|
|
1056
|
-
|
|
1166
|
+
[e]
|
|
1167
|
+
), l = N(
|
|
1168
|
+
async (p, f) => {
|
|
1169
|
+
o(!0), u(null), c(null);
|
|
1057
1170
|
try {
|
|
1058
|
-
return await
|
|
1059
|
-
} catch (
|
|
1060
|
-
return
|
|
1171
|
+
return await e.auth.changePassword(p, f), c("Password changed successfully"), !0;
|
|
1172
|
+
} catch (b) {
|
|
1173
|
+
return u(b instanceof Error ? b.message : "Failed to change password"), !1;
|
|
1061
1174
|
} finally {
|
|
1062
|
-
|
|
1175
|
+
o(!1);
|
|
1063
1176
|
}
|
|
1064
1177
|
},
|
|
1065
|
-
[
|
|
1066
|
-
),
|
|
1178
|
+
[e]
|
|
1179
|
+
), g = N(
|
|
1067
1180
|
async (p) => {
|
|
1068
|
-
|
|
1181
|
+
o(!0), u(null), c(null);
|
|
1069
1182
|
try {
|
|
1070
|
-
const
|
|
1071
|
-
return
|
|
1072
|
-
} catch (
|
|
1073
|
-
return
|
|
1183
|
+
const f = await e.auth.uploadAvatar(p);
|
|
1184
|
+
return c("Avatar updated"), f;
|
|
1185
|
+
} catch (f) {
|
|
1186
|
+
return u(f instanceof Error ? f.message : "Failed to upload avatar"), null;
|
|
1074
1187
|
} finally {
|
|
1075
|
-
|
|
1188
|
+
o(!1);
|
|
1076
1189
|
}
|
|
1077
1190
|
},
|
|
1078
|
-
[
|
|
1191
|
+
[e]
|
|
1079
1192
|
);
|
|
1080
|
-
return { user: a, updateProfile:
|
|
1193
|
+
return { user: a, updateProfile: d, uploadAvatar: g, changePassword: l, isLoading: r, error: t, success: i, setError: u, setSuccess: c };
|
|
1081
1194
|
}
|
|
1082
|
-
const
|
|
1083
|
-
function
|
|
1084
|
-
const { appearance:
|
|
1085
|
-
async (
|
|
1086
|
-
if (
|
|
1087
|
-
await
|
|
1195
|
+
const ne = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4"/><path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853"/><path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05"/><path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335"/></svg>', oe = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" fill="currentColor"/></svg>', Se = '<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4-8 5-8-5V6l8 5 8-5v2z" fill="currentColor"/></svg>';
|
|
1196
|
+
function Ke({ appearance: e, signUpUrl: a, onSignUp: r }) {
|
|
1197
|
+
const { appearance: o, settings: t } = L(), { signIn: u, signInWithOAuth: i, submitMfaCode: c, isLoading: d, error: l, setError: g } = re(), p = e ?? o, [f, b] = m(""), [k, v] = m(""), [C, x] = m(!1), [h, S] = m(""), [z, P] = m(""), [I, T] = m(!1), w = N(
|
|
1198
|
+
async (E) => {
|
|
1199
|
+
if (E.preventDefault(), C) {
|
|
1200
|
+
await c(h, z);
|
|
1088
1201
|
return;
|
|
1089
1202
|
}
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1203
|
+
const M = await u(f, k);
|
|
1204
|
+
M && be(M) && (S(M.mfaToken), x(!0), g(null));
|
|
1092
1205
|
},
|
|
1093
|
-
[
|
|
1094
|
-
),
|
|
1095
|
-
async (
|
|
1096
|
-
await
|
|
1206
|
+
[f, k, C, h, z, u, c, g]
|
|
1207
|
+
), $ = N(
|
|
1208
|
+
async (E) => {
|
|
1209
|
+
await i(E);
|
|
1097
1210
|
},
|
|
1098
|
-
[
|
|
1099
|
-
),
|
|
1100
|
-
return /* @__PURE__ */
|
|
1101
|
-
/* @__PURE__ */
|
|
1102
|
-
!
|
|
1103
|
-
(t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */
|
|
1211
|
+
[i]
|
|
1212
|
+
), y = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled);
|
|
1213
|
+
return /* @__PURE__ */ s(q, { appearance: p, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
|
|
1214
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Sign in" }),
|
|
1215
|
+
!C && /* @__PURE__ */ n(G, { children: [
|
|
1216
|
+
(t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ n(
|
|
1104
1217
|
"button",
|
|
1105
1218
|
{
|
|
1106
1219
|
type: "button",
|
|
1107
1220
|
className: "ss-btn-social",
|
|
1108
|
-
onClick: () =>
|
|
1109
|
-
disabled:
|
|
1221
|
+
onClick: () => $("google"),
|
|
1222
|
+
disabled: d,
|
|
1110
1223
|
children: [
|
|
1111
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
1112
1225
|
"Continue with Google"
|
|
1113
1226
|
]
|
|
1114
1227
|
}
|
|
1115
1228
|
),
|
|
1116
|
-
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */
|
|
1229
|
+
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
|
|
1117
1230
|
"button",
|
|
1118
1231
|
{
|
|
1119
1232
|
type: "button",
|
|
1120
1233
|
className: "ss-btn-social",
|
|
1121
|
-
onClick: () =>
|
|
1122
|
-
disabled:
|
|
1234
|
+
onClick: () => $("github"),
|
|
1235
|
+
disabled: d,
|
|
1123
1236
|
children: [
|
|
1124
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
|
|
1125
1238
|
"Continue with GitHub"
|
|
1126
1239
|
]
|
|
1127
1240
|
}
|
|
1128
1241
|
),
|
|
1129
|
-
|
|
1242
|
+
y && !I && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" }),
|
|
1243
|
+
y && !I && /* @__PURE__ */ n(
|
|
1244
|
+
"button",
|
|
1245
|
+
{
|
|
1246
|
+
type: "button",
|
|
1247
|
+
className: "ss-btn-social",
|
|
1248
|
+
onClick: () => T(!0),
|
|
1249
|
+
children: [
|
|
1250
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: Se } }),
|
|
1251
|
+
"Login with email"
|
|
1252
|
+
]
|
|
1253
|
+
}
|
|
1254
|
+
),
|
|
1255
|
+
y && I && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" })
|
|
1130
1256
|
] }),
|
|
1131
|
-
|
|
1132
|
-
/* @__PURE__ */
|
|
1133
|
-
|
|
1134
|
-
/* @__PURE__ */
|
|
1135
|
-
/* @__PURE__ */
|
|
1257
|
+
l && /* @__PURE__ */ s("div", { className: "ss-global-error", children: l }),
|
|
1258
|
+
(I || C || !y) && /* @__PURE__ */ n("form", { onSubmit: w, children: [
|
|
1259
|
+
C ? /* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1260
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-mfa-code", children: "Authentication code" }),
|
|
1261
|
+
/* @__PURE__ */ s(
|
|
1136
1262
|
"input",
|
|
1137
1263
|
{
|
|
1138
1264
|
id: "ss-mfa-code",
|
|
@@ -1141,15 +1267,15 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1141
1267
|
inputMode: "numeric",
|
|
1142
1268
|
autoComplete: "one-time-code",
|
|
1143
1269
|
placeholder: "Enter 6-digit code",
|
|
1144
|
-
value:
|
|
1145
|
-
onChange: (
|
|
1270
|
+
value: z,
|
|
1271
|
+
onChange: (E) => P(E.target.value),
|
|
1146
1272
|
autoFocus: !0
|
|
1147
1273
|
}
|
|
1148
1274
|
)
|
|
1149
|
-
] }) : /* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1151
|
-
/* @__PURE__ */
|
|
1152
|
-
/* @__PURE__ */
|
|
1275
|
+
] }) : /* @__PURE__ */ n(G, { children: [
|
|
1276
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1277
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-email", children: "Email" }),
|
|
1278
|
+
/* @__PURE__ */ s(
|
|
1153
1279
|
"input",
|
|
1154
1280
|
{
|
|
1155
1281
|
id: "ss-email",
|
|
@@ -1157,15 +1283,15 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1157
1283
|
type: "email",
|
|
1158
1284
|
autoComplete: "email",
|
|
1159
1285
|
placeholder: "you@example.com",
|
|
1160
|
-
value:
|
|
1161
|
-
onChange: (
|
|
1286
|
+
value: f,
|
|
1287
|
+
onChange: (E) => b(E.target.value),
|
|
1162
1288
|
required: !0
|
|
1163
1289
|
}
|
|
1164
1290
|
)
|
|
1165
1291
|
] }),
|
|
1166
|
-
/* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1293
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-password", children: "Password" }),
|
|
1294
|
+
/* @__PURE__ */ s(
|
|
1169
1295
|
"input",
|
|
1170
1296
|
{
|
|
1171
1297
|
id: "ss-password",
|
|
@@ -1173,90 +1299,90 @@ function Ws({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1173
1299
|
type: "password",
|
|
1174
1300
|
autoComplete: "current-password",
|
|
1175
1301
|
placeholder: "Enter your password",
|
|
1176
|
-
value:
|
|
1177
|
-
onChange: (
|
|
1302
|
+
value: k,
|
|
1303
|
+
onChange: (E) => v(E.target.value),
|
|
1178
1304
|
required: !0
|
|
1179
1305
|
}
|
|
1180
1306
|
)
|
|
1181
1307
|
] })
|
|
1182
1308
|
] }),
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
|
|
1185
|
-
|
|
1309
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: d, children: [
|
|
1310
|
+
d && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1311
|
+
C ? "Verify" : "Continue"
|
|
1186
1312
|
] })
|
|
1187
1313
|
] }),
|
|
1188
|
-
|
|
1314
|
+
C && /* @__PURE__ */ s("div", { className: "ss-footer", children: /* @__PURE__ */ s(
|
|
1189
1315
|
"span",
|
|
1190
1316
|
{
|
|
1191
1317
|
className: "ss-link",
|
|
1192
1318
|
onClick: () => {
|
|
1193
|
-
|
|
1319
|
+
x(!1), P(""), g(null);
|
|
1194
1320
|
},
|
|
1195
1321
|
children: "Back to sign in"
|
|
1196
1322
|
}
|
|
1197
1323
|
) }),
|
|
1198
|
-
!
|
|
1324
|
+
!C && /* @__PURE__ */ n("div", { className: "ss-footer", children: [
|
|
1199
1325
|
"Don't have an account?",
|
|
1200
1326
|
" ",
|
|
1201
|
-
r ? /* @__PURE__ */
|
|
1327
|
+
r ? /* @__PURE__ */ s("span", { className: "ss-link", onClick: r, children: "Sign up" }) : a ? /* @__PURE__ */ s("a", { className: "ss-link", href: a, children: "Sign up" }) : /* @__PURE__ */ s("span", { className: "ss-link", children: "Sign up" })
|
|
1202
1328
|
] })
|
|
1203
1329
|
] }) });
|
|
1204
1330
|
}
|
|
1205
|
-
function
|
|
1206
|
-
const { appearance:
|
|
1207
|
-
async (
|
|
1208
|
-
if (
|
|
1209
|
-
|
|
1331
|
+
function es({ appearance: e, signInUrl: a, onSignIn: r }) {
|
|
1332
|
+
const { appearance: o, settings: t } = L(), { signUp: u, isLoading: i, error: c, setError: d } = Ce(), { signInWithOAuth: l } = re(), g = e ?? o, [p, f] = m(""), [b, k] = m(""), [v, C] = m(""), [x, h] = m(null), S = N(
|
|
1333
|
+
async (T) => {
|
|
1334
|
+
if (T.preventDefault(), h(null), b !== v) {
|
|
1335
|
+
h("Passwords do not match");
|
|
1210
1336
|
return;
|
|
1211
1337
|
}
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1214
|
-
|
|
1338
|
+
const w = (t == null ? void 0 : t.passwordMinLength) ?? 8;
|
|
1339
|
+
if (b.length < w) {
|
|
1340
|
+
h(`Password must be at least ${w} characters`);
|
|
1215
1341
|
return;
|
|
1216
1342
|
}
|
|
1217
|
-
await
|
|
1343
|
+
await u(p, b);
|
|
1218
1344
|
},
|
|
1219
|
-
[p,
|
|
1220
|
-
),
|
|
1221
|
-
async (
|
|
1222
|
-
await
|
|
1345
|
+
[p, b, v, t, u]
|
|
1346
|
+
), z = N(
|
|
1347
|
+
async (T) => {
|
|
1348
|
+
await l(T);
|
|
1223
1349
|
},
|
|
1224
|
-
[
|
|
1225
|
-
),
|
|
1226
|
-
return /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1228
|
-
(t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */
|
|
1350
|
+
[l]
|
|
1351
|
+
), P = (t == null ? void 0 : t.googleEnabled) || (t == null ? void 0 : t.githubEnabled), I = x || c;
|
|
1352
|
+
return /* @__PURE__ */ s(q, { appearance: g, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
|
|
1353
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Create account" }),
|
|
1354
|
+
(t == null ? void 0 : t.googleEnabled) && /* @__PURE__ */ n(
|
|
1229
1355
|
"button",
|
|
1230
1356
|
{
|
|
1231
1357
|
type: "button",
|
|
1232
1358
|
className: "ss-btn-social",
|
|
1233
|
-
onClick: () =>
|
|
1234
|
-
disabled:
|
|
1359
|
+
onClick: () => z("google"),
|
|
1360
|
+
disabled: i,
|
|
1235
1361
|
children: [
|
|
1236
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
1237
1363
|
"Continue with Google"
|
|
1238
1364
|
]
|
|
1239
1365
|
}
|
|
1240
1366
|
),
|
|
1241
|
-
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */
|
|
1367
|
+
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
|
|
1242
1368
|
"button",
|
|
1243
1369
|
{
|
|
1244
1370
|
type: "button",
|
|
1245
1371
|
className: "ss-btn-social",
|
|
1246
|
-
onClick: () =>
|
|
1247
|
-
disabled:
|
|
1372
|
+
onClick: () => z("github"),
|
|
1373
|
+
disabled: i,
|
|
1248
1374
|
children: [
|
|
1249
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
|
|
1250
1376
|
"Continue with GitHub"
|
|
1251
1377
|
]
|
|
1252
1378
|
}
|
|
1253
1379
|
),
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
/* @__PURE__ */
|
|
1257
|
-
/* @__PURE__ */
|
|
1258
|
-
/* @__PURE__ */
|
|
1259
|
-
/* @__PURE__ */
|
|
1380
|
+
P && /* @__PURE__ */ s("div", { className: "ss-divider", children: "or" }),
|
|
1381
|
+
I && /* @__PURE__ */ s("div", { className: "ss-global-error", children: I }),
|
|
1382
|
+
/* @__PURE__ */ n("form", { onSubmit: S, children: [
|
|
1383
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1384
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-email", children: "Email" }),
|
|
1385
|
+
/* @__PURE__ */ s(
|
|
1260
1386
|
"input",
|
|
1261
1387
|
{
|
|
1262
1388
|
id: "ss-signup-email",
|
|
@@ -1265,14 +1391,14 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1265
1391
|
autoComplete: "email",
|
|
1266
1392
|
placeholder: "you@example.com",
|
|
1267
1393
|
value: p,
|
|
1268
|
-
onChange: (
|
|
1394
|
+
onChange: (T) => f(T.target.value),
|
|
1269
1395
|
required: !0
|
|
1270
1396
|
}
|
|
1271
1397
|
)
|
|
1272
1398
|
] }),
|
|
1273
|
-
/* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */
|
|
1275
|
-
/* @__PURE__ */
|
|
1399
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1400
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-password", children: "Password" }),
|
|
1401
|
+
/* @__PURE__ */ s(
|
|
1276
1402
|
"input",
|
|
1277
1403
|
{
|
|
1278
1404
|
id: "ss-signup-password",
|
|
@@ -1280,17 +1406,17 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1280
1406
|
type: "password",
|
|
1281
1407
|
autoComplete: "new-password",
|
|
1282
1408
|
placeholder: "Create a password",
|
|
1283
|
-
value:
|
|
1284
|
-
onChange: (
|
|
1285
|
-
|
|
1409
|
+
value: b,
|
|
1410
|
+
onChange: (T) => {
|
|
1411
|
+
k(T.target.value), h(null);
|
|
1286
1412
|
},
|
|
1287
1413
|
required: !0
|
|
1288
1414
|
}
|
|
1289
1415
|
)
|
|
1290
1416
|
] }),
|
|
1291
|
-
/* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1293
|
-
/* @__PURE__ */
|
|
1417
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1418
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-signup-confirm", children: "Confirm password" }),
|
|
1419
|
+
/* @__PURE__ */ s(
|
|
1294
1420
|
"input",
|
|
1295
1421
|
{
|
|
1296
1422
|
id: "ss-signup-confirm",
|
|
@@ -1298,585 +1424,765 @@ function Hs({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1298
1424
|
type: "password",
|
|
1299
1425
|
autoComplete: "new-password",
|
|
1300
1426
|
placeholder: "Confirm your password",
|
|
1301
|
-
value:
|
|
1302
|
-
onChange: (
|
|
1303
|
-
|
|
1427
|
+
value: v,
|
|
1428
|
+
onChange: (T) => {
|
|
1429
|
+
C(T.target.value), h(null);
|
|
1304
1430
|
},
|
|
1305
1431
|
required: !0
|
|
1306
1432
|
}
|
|
1307
1433
|
)
|
|
1308
1434
|
] }),
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
|
|
1435
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1436
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1311
1437
|
"Create account"
|
|
1312
1438
|
] })
|
|
1313
1439
|
] }),
|
|
1314
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ n("div", { className: "ss-footer", children: [
|
|
1315
1441
|
"Already have an account?",
|
|
1316
1442
|
" ",
|
|
1317
|
-
r ? /* @__PURE__ */
|
|
1443
|
+
r ? /* @__PURE__ */ s("span", { className: "ss-link", onClick: r, children: "Sign in" }) : a ? /* @__PURE__ */ s("a", { className: "ss-link", href: a, children: "Sign in" }) : /* @__PURE__ */ s("span", { className: "ss-link", children: "Sign in" })
|
|
1318
1444
|
] })
|
|
1319
1445
|
] }) });
|
|
1320
1446
|
}
|
|
1321
|
-
const
|
|
1322
|
-
function
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1325
|
-
const
|
|
1326
|
-
return
|
|
1327
|
-
t.current =
|
|
1328
|
-
},
|
|
1329
|
-
}, [
|
|
1330
|
-
if (!
|
|
1331
|
-
const
|
|
1332
|
-
if (!
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1337
|
-
}, [
|
|
1338
|
-
const
|
|
1339
|
-
(
|
|
1340
|
-
|
|
1447
|
+
const B = 256, R = 112;
|
|
1448
|
+
function $e({ file: e, onCrop: a, onCancel: r }) {
|
|
1449
|
+
const o = j(null), t = j(null), [u, i] = m(1), [c, d] = m({ x: 0, y: 0 }), [l, g] = m(!1), p = j({ x: 0, y: 0, ox: 0, oy: 0 }), [f, b] = m(!1);
|
|
1450
|
+
U(() => {
|
|
1451
|
+
const h = new Image(), S = URL.createObjectURL(e);
|
|
1452
|
+
return h.onload = () => {
|
|
1453
|
+
t.current = h, b(!0), d({ x: 0, y: 0 }), i(1);
|
|
1454
|
+
}, h.src = S, () => URL.revokeObjectURL(S);
|
|
1455
|
+
}, [e]), U(() => {
|
|
1456
|
+
if (!f || !t.current || !o.current) return;
|
|
1457
|
+
const h = o.current.getContext("2d");
|
|
1458
|
+
if (!h) return;
|
|
1459
|
+
const S = t.current;
|
|
1460
|
+
h.clearRect(0, 0, B, B), h.fillStyle = "#111", h.fillRect(0, 0, B, B);
|
|
1461
|
+
const z = Math.max(B / S.width, B / S.height) * u, P = S.width * z, I = S.height * z, T = (B - P) / 2 + c.x, w = (B - I) / 2 + c.y;
|
|
1462
|
+
h.save(), h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.clip(), h.drawImage(S, T, w, P, I), h.restore(), h.save(), h.fillStyle = "rgba(0, 0, 0, 0.6)", h.fillRect(0, 0, B, B), h.globalCompositeOperation = "destination-out", h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.fill(), h.restore(), h.save(), h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.clip(), h.drawImage(S, T, w, P, I), h.restore(), h.strokeStyle = "rgba(255, 255, 255, 0.6)", h.lineWidth = 2, h.beginPath(), h.arc(B / 2, B / 2, R, 0, Math.PI * 2), h.stroke();
|
|
1463
|
+
}, [u, c, f]);
|
|
1464
|
+
const k = N(
|
|
1465
|
+
(h) => {
|
|
1466
|
+
g(!0), p.current = { x: h.clientX, y: h.clientY, ox: c.x, oy: c.y }, h.target.setPointerCapture(h.pointerId);
|
|
1341
1467
|
},
|
|
1342
|
-
[
|
|
1343
|
-
),
|
|
1344
|
-
(
|
|
1345
|
-
|
|
1346
|
-
x: p.current.ox + (
|
|
1347
|
-
y: p.current.oy + (
|
|
1468
|
+
[c]
|
|
1469
|
+
), v = N(
|
|
1470
|
+
(h) => {
|
|
1471
|
+
l && d({
|
|
1472
|
+
x: p.current.ox + (h.clientX - p.current.x),
|
|
1473
|
+
y: p.current.oy + (h.clientY - p.current.y)
|
|
1348
1474
|
});
|
|
1349
1475
|
},
|
|
1350
|
-
[
|
|
1351
|
-
),
|
|
1476
|
+
[l]
|
|
1477
|
+
), C = N(() => g(!1), []), x = N(() => {
|
|
1352
1478
|
if (!t.current) return;
|
|
1353
|
-
const
|
|
1354
|
-
|
|
1355
|
-
const
|
|
1356
|
-
if (!
|
|
1357
|
-
const
|
|
1358
|
-
|
|
1359
|
-
|
|
1479
|
+
const h = document.createElement("canvas"), S = R * 2;
|
|
1480
|
+
h.width = S, h.height = S;
|
|
1481
|
+
const z = h.getContext("2d");
|
|
1482
|
+
if (!z) return;
|
|
1483
|
+
const P = t.current, I = Math.max(B / P.width, B / P.height) * u, T = P.width * I, w = P.height * I, $ = (B - T) / 2 + c.x - (B / 2 - R), y = (B - w) / 2 + c.y - (B / 2 - R);
|
|
1484
|
+
z.beginPath(), z.arc(R, R, R, 0, Math.PI * 2), z.clip(), z.drawImage(P, $, y, T, w), h.toBlob((E) => {
|
|
1485
|
+
E && a(E);
|
|
1360
1486
|
}, "image/png");
|
|
1361
|
-
}, [
|
|
1362
|
-
return /* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1487
|
+
}, [u, c, a]);
|
|
1488
|
+
return /* @__PURE__ */ n("div", { className: "ss-avatar-cropper", children: [
|
|
1489
|
+
/* @__PURE__ */ s(
|
|
1364
1490
|
"canvas",
|
|
1365
1491
|
{
|
|
1366
|
-
ref:
|
|
1367
|
-
width:
|
|
1368
|
-
height:
|
|
1492
|
+
ref: o,
|
|
1493
|
+
width: B,
|
|
1494
|
+
height: B,
|
|
1369
1495
|
className: "ss-avatar-canvas",
|
|
1370
|
-
onPointerDown:
|
|
1371
|
-
onPointerMove:
|
|
1372
|
-
onPointerUp:
|
|
1373
|
-
style: { cursor:
|
|
1496
|
+
onPointerDown: k,
|
|
1497
|
+
onPointerMove: v,
|
|
1498
|
+
onPointerUp: C,
|
|
1499
|
+
style: { cursor: l ? "grabbing" : "grab" }
|
|
1374
1500
|
}
|
|
1375
1501
|
),
|
|
1376
|
-
/* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__PURE__ */
|
|
1502
|
+
/* @__PURE__ */ n("div", { className: "ss-avatar-zoom", children: [
|
|
1503
|
+
/* @__PURE__ */ s("span", { className: "ss-avatar-zoom-label", children: "Zoom" }),
|
|
1504
|
+
/* @__PURE__ */ s(
|
|
1379
1505
|
"input",
|
|
1380
1506
|
{
|
|
1381
1507
|
type: "range",
|
|
1382
1508
|
min: "1",
|
|
1383
1509
|
max: "3",
|
|
1384
1510
|
step: "0.01",
|
|
1385
|
-
value:
|
|
1386
|
-
onChange: (
|
|
1511
|
+
value: u,
|
|
1512
|
+
onChange: (h) => i(parseFloat(h.target.value)),
|
|
1387
1513
|
className: "ss-avatar-zoom-slider"
|
|
1388
1514
|
}
|
|
1389
1515
|
)
|
|
1390
1516
|
] }),
|
|
1391
|
-
/* @__PURE__ */
|
|
1392
|
-
/* @__PURE__ */
|
|
1393
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", children: [
|
|
1518
|
+
/* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger ss-btn-sm", onClick: r, children: "Cancel" }),
|
|
1519
|
+
/* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-primary ss-btn-sm", onClick: x, children: "Save" })
|
|
1394
1520
|
] })
|
|
1395
1521
|
] });
|
|
1396
1522
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const [
|
|
1399
|
-
if (!
|
|
1400
|
-
|
|
1523
|
+
function le({ onUpload: e, onClose: a, isLoading: r }) {
|
|
1524
|
+
const [o, t] = m(null), [u, i] = m(!1), [c, d] = m(null), l = j(null), g = N((b) => {
|
|
1525
|
+
if (!b.type.startsWith("image/")) {
|
|
1526
|
+
d("Please select an image file");
|
|
1401
1527
|
return;
|
|
1402
1528
|
}
|
|
1403
|
-
if (
|
|
1404
|
-
|
|
1529
|
+
if (b.size > 5 * 1024 * 1024) {
|
|
1530
|
+
d("Image must be smaller than 5 MB");
|
|
1405
1531
|
return;
|
|
1406
1532
|
}
|
|
1407
|
-
|
|
1408
|
-
}, []), p =
|
|
1409
|
-
(
|
|
1410
|
-
|
|
1411
|
-
const
|
|
1412
|
-
|
|
1533
|
+
d(null), t(b);
|
|
1534
|
+
}, []), p = N(
|
|
1535
|
+
(b) => {
|
|
1536
|
+
b.preventDefault(), i(!1);
|
|
1537
|
+
const k = b.dataTransfer.files[0];
|
|
1538
|
+
k && g(k);
|
|
1413
1539
|
},
|
|
1414
|
-
[
|
|
1415
|
-
),
|
|
1416
|
-
async (
|
|
1417
|
-
await
|
|
1540
|
+
[g]
|
|
1541
|
+
), f = N(
|
|
1542
|
+
async (b) => {
|
|
1543
|
+
await e(b);
|
|
1418
1544
|
},
|
|
1419
|
-
[
|
|
1545
|
+
[e]
|
|
1420
1546
|
);
|
|
1421
|
-
return /* @__PURE__ */
|
|
1422
|
-
|
|
1423
|
-
}, children: /* @__PURE__ */
|
|
1424
|
-
/* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1547
|
+
return /* @__PURE__ */ s("div", { className: "ss-modal-overlay", onClick: (b) => {
|
|
1548
|
+
b.target === b.currentTarget && a();
|
|
1549
|
+
}, children: /* @__PURE__ */ n("div", { className: "ss-modal", children: [
|
|
1550
|
+
/* @__PURE__ */ n("div", { className: "ss-modal-header", children: [
|
|
1551
|
+
/* @__PURE__ */ s("span", { className: "ss-modal-title", children: "Upload Avatar" }),
|
|
1552
|
+
/* @__PURE__ */ s("button", { type: "button", className: "ss-modal-close", onClick: a, children: "✕" })
|
|
1427
1553
|
] }),
|
|
1428
|
-
|
|
1429
|
-
|
|
1554
|
+
c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
|
|
1555
|
+
o ? /* @__PURE__ */ s($e, { file: o, onCrop: f, onCancel: () => t(null) }) : /* @__PURE__ */ n(
|
|
1430
1556
|
"div",
|
|
1431
1557
|
{
|
|
1432
|
-
className: `ss-avatar-dropzone${
|
|
1433
|
-
onDragOver: (
|
|
1434
|
-
|
|
1558
|
+
className: `ss-avatar-dropzone${u ? " ss-avatar-dropzone-active" : ""}`,
|
|
1559
|
+
onDragOver: (b) => {
|
|
1560
|
+
b.preventDefault(), i(!0);
|
|
1435
1561
|
},
|
|
1436
|
-
onDragLeave: () =>
|
|
1562
|
+
onDragLeave: () => i(!1),
|
|
1437
1563
|
onDrop: p,
|
|
1438
1564
|
onClick: () => {
|
|
1439
|
-
var
|
|
1440
|
-
return (
|
|
1565
|
+
var b;
|
|
1566
|
+
return (b = l.current) == null ? void 0 : b.click();
|
|
1441
1567
|
},
|
|
1442
1568
|
children: [
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1569
|
+
/* @__PURE__ */ n("svg", { width: "40", height: "40", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
1570
|
+
/* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
|
|
1571
|
+
/* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
|
|
1446
1572
|
] }),
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
/* @__PURE__ */
|
|
1573
|
+
/* @__PURE__ */ s("span", { children: "Drop image here or click to browse" }),
|
|
1574
|
+
/* @__PURE__ */ s(
|
|
1449
1575
|
"input",
|
|
1450
1576
|
{
|
|
1451
|
-
ref:
|
|
1577
|
+
ref: l,
|
|
1452
1578
|
type: "file",
|
|
1453
1579
|
accept: "image/*",
|
|
1454
1580
|
style: { display: "none" },
|
|
1455
|
-
onChange: (
|
|
1456
|
-
var
|
|
1457
|
-
(
|
|
1581
|
+
onChange: (b) => {
|
|
1582
|
+
var k;
|
|
1583
|
+
(k = b.target.files) != null && k[0] && g(b.target.files[0]);
|
|
1458
1584
|
}
|
|
1459
1585
|
}
|
|
1460
1586
|
)
|
|
1461
1587
|
]
|
|
1462
1588
|
}
|
|
1463
1589
|
),
|
|
1464
|
-
r && /* @__PURE__ */
|
|
1590
|
+
r && /* @__PURE__ */ s("div", { className: "ss-loading", children: "Uploading..." })
|
|
1465
1591
|
] }) });
|
|
1466
1592
|
}
|
|
1467
|
-
function
|
|
1468
|
-
|
|
1469
|
-
|
|
1593
|
+
function ss({
|
|
1594
|
+
appearance: e,
|
|
1595
|
+
afterSignOutUrl: a,
|
|
1596
|
+
afterDeleteAccountUrl: r,
|
|
1597
|
+
showOrgSwitcher: o = !0,
|
|
1598
|
+
onOrgChange: t,
|
|
1599
|
+
onOrgSettingsClick: u
|
|
1600
|
+
}) {
|
|
1601
|
+
const { appearance: i } = L(), { user: c, signOut: d } = ee(), l = e ?? i, [g, p] = m(!1), [f, b] = m(!1), [k, v] = m(!1), [C, x] = m(""), [h, S] = m(""), [z, P] = m(null), [I, T] = m(!1), w = j(null), { orgs: $, selectedOrg: y, selectOrg: E, createOrg: M } = ae(), O = N((D) => {
|
|
1602
|
+
w.current && !D.composedPath().includes(w.current) && (p(!1), v(!1));
|
|
1470
1603
|
}, []);
|
|
1471
|
-
|
|
1472
|
-
if (
|
|
1473
|
-
const
|
|
1474
|
-
document.addEventListener("click",
|
|
1604
|
+
U(() => {
|
|
1605
|
+
if (g) {
|
|
1606
|
+
const D = setTimeout(() => {
|
|
1607
|
+
document.addEventListener("click", O);
|
|
1475
1608
|
}, 0);
|
|
1476
1609
|
return () => {
|
|
1477
|
-
clearTimeout(
|
|
1610
|
+
clearTimeout(D), document.removeEventListener("click", O);
|
|
1478
1611
|
};
|
|
1479
1612
|
}
|
|
1480
|
-
}, [
|
|
1481
|
-
const
|
|
1482
|
-
|
|
1483
|
-
|
|
1613
|
+
}, [g, O]);
|
|
1614
|
+
const V = N((D) => {
|
|
1615
|
+
x(D), S(D.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
1616
|
+
}, []), F = N(
|
|
1617
|
+
async (D) => {
|
|
1618
|
+
D.preventDefault(), P(null), T(!0);
|
|
1619
|
+
try {
|
|
1620
|
+
const H = await M(C, h);
|
|
1621
|
+
H && (await E(H.id), t == null || t(H), v(!1), x(""), S(""), p(!1));
|
|
1622
|
+
} catch (H) {
|
|
1623
|
+
P(H instanceof Error ? H.message : "Failed to create organization");
|
|
1624
|
+
} finally {
|
|
1625
|
+
T(!1);
|
|
1626
|
+
}
|
|
1627
|
+
},
|
|
1628
|
+
[C, h, M, E, t]
|
|
1629
|
+
);
|
|
1630
|
+
if (!c) return null;
|
|
1631
|
+
const W = (c.name || c.email).charAt(0).toUpperCase();
|
|
1632
|
+
return /* @__PURE__ */ s(q, { appearance: l, children: /* @__PURE__ */ n("div", { className: "ss-user-btn", ref: w, children: [
|
|
1633
|
+
/* @__PURE__ */ s(
|
|
1484
1634
|
"button",
|
|
1485
1635
|
{
|
|
1486
1636
|
type: "button",
|
|
1487
1637
|
className: "ss-avatar",
|
|
1488
|
-
onClick: () =>
|
|
1638
|
+
onClick: () => p(!g),
|
|
1489
1639
|
"aria-label": "User menu",
|
|
1490
|
-
children:
|
|
1640
|
+
children: c.avatarUrl ? /* @__PURE__ */ s("img", { src: c.avatarUrl, alt: "", style: { width: "100%", height: "100%", borderRadius: "50%", objectFit: "cover" } }) : W
|
|
1491
1641
|
}
|
|
1492
1642
|
),
|
|
1493
|
-
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
|
|
1496
|
-
/* @__PURE__ */
|
|
1643
|
+
g && /* @__PURE__ */ n("div", { className: "ss-dropdown", children: [
|
|
1644
|
+
/* @__PURE__ */ n("div", { className: "ss-dropdown-header", children: [
|
|
1645
|
+
c.name && /* @__PURE__ */ s("div", { style: { fontWeight: 600, fontSize: "14px", color: "inherit" }, children: c.name }),
|
|
1646
|
+
/* @__PURE__ */ s("div", { className: "ss-dropdown-email", children: c.email })
|
|
1497
1647
|
] }),
|
|
1498
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ s(
|
|
1499
1649
|
"button",
|
|
1500
1650
|
{
|
|
1501
1651
|
type: "button",
|
|
1502
1652
|
className: "ss-dropdown-item",
|
|
1503
1653
|
onClick: () => {
|
|
1504
|
-
|
|
1654
|
+
p(!1), b(!0);
|
|
1505
1655
|
},
|
|
1506
1656
|
children: "Profile"
|
|
1507
1657
|
}
|
|
1508
1658
|
),
|
|
1509
|
-
/* @__PURE__ */
|
|
1659
|
+
o && /* @__PURE__ */ n(G, { children: [
|
|
1660
|
+
/* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
|
|
1661
|
+
/* @__PURE__ */ s("div", { className: "ss-dropdown-section-title", children: "Organizations" }),
|
|
1662
|
+
$.map((D) => /* @__PURE__ */ n(
|
|
1663
|
+
"button",
|
|
1664
|
+
{
|
|
1665
|
+
type: "button",
|
|
1666
|
+
className: `ss-dropdown-item${(y == null ? void 0 : y.id) === D.id ? " ss-dropdown-item-active" : ""}`,
|
|
1667
|
+
onClick: async () => {
|
|
1668
|
+
p(!1), v(!1), await E(D.id), t == null || t(D);
|
|
1669
|
+
},
|
|
1670
|
+
children: [
|
|
1671
|
+
(y == null ? void 0 : y.id) === D.id && /* @__PURE__ */ s("span", { className: "ss-org-check", children: "✓" }),
|
|
1672
|
+
D.name
|
|
1673
|
+
]
|
|
1674
|
+
},
|
|
1675
|
+
D.id
|
|
1676
|
+
)),
|
|
1677
|
+
k ? /* @__PURE__ */ n("div", { className: "ss-inline-form", children: [
|
|
1678
|
+
z && /* @__PURE__ */ s("div", { className: "ss-global-error", style: { marginBottom: "8px", fontSize: "12px" }, children: z }),
|
|
1679
|
+
/* @__PURE__ */ n("form", { onSubmit: F, children: [
|
|
1680
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
1681
|
+
"input",
|
|
1682
|
+
{
|
|
1683
|
+
className: "ss-input",
|
|
1684
|
+
type: "text",
|
|
1685
|
+
placeholder: "Organization name",
|
|
1686
|
+
value: C,
|
|
1687
|
+
onChange: (D) => V(D.target.value),
|
|
1688
|
+
required: !0,
|
|
1689
|
+
autoFocus: !0
|
|
1690
|
+
}
|
|
1691
|
+
) }),
|
|
1692
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
1693
|
+
"input",
|
|
1694
|
+
{
|
|
1695
|
+
className: "ss-input",
|
|
1696
|
+
type: "text",
|
|
1697
|
+
placeholder: "org-slug",
|
|
1698
|
+
value: h,
|
|
1699
|
+
onChange: (D) => S(D.target.value),
|
|
1700
|
+
required: !0
|
|
1701
|
+
}
|
|
1702
|
+
) }),
|
|
1703
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
|
|
1704
|
+
/* @__PURE__ */ s(
|
|
1705
|
+
"button",
|
|
1706
|
+
{
|
|
1707
|
+
type: "button",
|
|
1708
|
+
className: "ss-btn ss-btn-sm ss-btn-current",
|
|
1709
|
+
onClick: () => {
|
|
1710
|
+
v(!1), P(null);
|
|
1711
|
+
},
|
|
1712
|
+
children: "Cancel"
|
|
1713
|
+
}
|
|
1714
|
+
),
|
|
1715
|
+
/* @__PURE__ */ n(
|
|
1716
|
+
"button",
|
|
1717
|
+
{
|
|
1718
|
+
type: "submit",
|
|
1719
|
+
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
1720
|
+
disabled: I,
|
|
1721
|
+
children: [
|
|
1722
|
+
I && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1723
|
+
"Create"
|
|
1724
|
+
]
|
|
1725
|
+
}
|
|
1726
|
+
)
|
|
1727
|
+
] })
|
|
1728
|
+
] })
|
|
1729
|
+
] }) : /* @__PURE__ */ s(
|
|
1730
|
+
"button",
|
|
1731
|
+
{
|
|
1732
|
+
type: "button",
|
|
1733
|
+
className: "ss-dropdown-item",
|
|
1734
|
+
onClick: () => v(!0),
|
|
1735
|
+
style: { fontWeight: 500 },
|
|
1736
|
+
children: "+ Create organization"
|
|
1737
|
+
}
|
|
1738
|
+
),
|
|
1739
|
+
y && u && /* @__PURE__ */ s(
|
|
1740
|
+
"button",
|
|
1741
|
+
{
|
|
1742
|
+
type: "button",
|
|
1743
|
+
className: "ss-dropdown-item",
|
|
1744
|
+
onClick: () => {
|
|
1745
|
+
p(!1), u(y);
|
|
1746
|
+
},
|
|
1747
|
+
children: "Org settings"
|
|
1748
|
+
}
|
|
1749
|
+
)
|
|
1750
|
+
] }),
|
|
1751
|
+
/* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
|
|
1752
|
+
/* @__PURE__ */ s(
|
|
1510
1753
|
"button",
|
|
1511
1754
|
{
|
|
1512
1755
|
type: "button",
|
|
1513
1756
|
className: "ss-dropdown-item ss-dropdown-item-danger",
|
|
1514
1757
|
onClick: async () => {
|
|
1515
|
-
|
|
1758
|
+
p(!1), await d(), a && (window.location.href = a);
|
|
1516
1759
|
},
|
|
1517
1760
|
children: "Sign out"
|
|
1518
1761
|
}
|
|
1519
1762
|
)
|
|
1520
1763
|
] }),
|
|
1521
|
-
|
|
1764
|
+
f && /* @__PURE__ */ s(
|
|
1765
|
+
Ee,
|
|
1766
|
+
{
|
|
1767
|
+
onClose: () => b(!1),
|
|
1768
|
+
afterDeleteAccountUrl: r
|
|
1769
|
+
}
|
|
1770
|
+
)
|
|
1522
1771
|
] }) });
|
|
1523
1772
|
}
|
|
1524
|
-
function
|
|
1525
|
-
const { user:
|
|
1526
|
-
async (
|
|
1527
|
-
|
|
1773
|
+
function Ee({ onClose: e, afterDeleteAccountUrl: a }) {
|
|
1774
|
+
const { user: r, updateProfile: o, uploadAvatar: t, changePassword: u, isLoading: i, error: c, success: d, setError: l, setSuccess: g } = te(), { signOut: p } = ee(), { deleteAccount: f, isLoading: b, error: k, setError: v } = ke(), [C, x] = m((r == null ? void 0 : r.name) ?? ""), [h, S] = m((r == null ? void 0 : r.avatarUrl) ?? ""), [z, P] = m(!1), [I, T] = m(""), [w, $] = m(""), [y, E] = m(""), [M, O] = m(null), [V, F] = m(!1), [W, D] = m(""), H = N(
|
|
1775
|
+
async (A) => {
|
|
1776
|
+
A.preventDefault(), l(null), g(null), await o({ name: C, avatarUrl: h || void 0 });
|
|
1528
1777
|
},
|
|
1529
|
-
[
|
|
1530
|
-
),
|
|
1531
|
-
async (
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1778
|
+
[C, h, o, l, g]
|
|
1779
|
+
), ce = N(
|
|
1780
|
+
async (A) => {
|
|
1781
|
+
const Y = await t(A);
|
|
1782
|
+
Y && (S(Y.avatarUrl), P(!1));
|
|
1534
1783
|
},
|
|
1535
|
-
[
|
|
1536
|
-
),
|
|
1537
|
-
async (
|
|
1538
|
-
if (
|
|
1539
|
-
|
|
1784
|
+
[t]
|
|
1785
|
+
), de = N(
|
|
1786
|
+
async (A) => {
|
|
1787
|
+
if (A.preventDefault(), O(null), l(null), g(null), w !== y) {
|
|
1788
|
+
O("Passwords do not match");
|
|
1540
1789
|
return;
|
|
1541
1790
|
}
|
|
1542
|
-
if (
|
|
1543
|
-
|
|
1791
|
+
if (w.length < 8) {
|
|
1792
|
+
O("Password must be at least 8 characters");
|
|
1544
1793
|
return;
|
|
1545
1794
|
}
|
|
1546
|
-
await
|
|
1795
|
+
await u(I, w) && (T(""), $(""), E(""));
|
|
1547
1796
|
},
|
|
1548
|
-
[
|
|
1549
|
-
),
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1797
|
+
[I, w, y, u, l, g]
|
|
1798
|
+
), ue = N(async () => {
|
|
1799
|
+
await f() && (await p(), a && (window.location.href = a));
|
|
1800
|
+
}, [f, p, a]), pe = (r == null ? void 0 : r.provider) === "email", me = W === (r == null ? void 0 : r.email);
|
|
1801
|
+
return /* @__PURE__ */ s("div", { className: "ss-modal-overlay", onClick: (A) => {
|
|
1802
|
+
A.target === A.currentTarget && e();
|
|
1803
|
+
}, children: /* @__PURE__ */ n("div", { className: "ss-modal", children: [
|
|
1804
|
+
/* @__PURE__ */ n("div", { className: "ss-modal-header", children: [
|
|
1805
|
+
/* @__PURE__ */ s("span", { className: "ss-modal-title", children: "Profile" }),
|
|
1806
|
+
/* @__PURE__ */ s("button", { type: "button", className: "ss-modal-close", onClick: e, children: "✕" })
|
|
1556
1807
|
] }),
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
/* @__PURE__ */
|
|
1808
|
+
c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
|
|
1809
|
+
d && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: d }),
|
|
1810
|
+
/* @__PURE__ */ n(
|
|
1560
1811
|
"div",
|
|
1561
1812
|
{
|
|
1562
1813
|
className: "ss-avatar-preview ss-avatar-hoverable",
|
|
1563
|
-
onClick: () =>
|
|
1814
|
+
onClick: () => P(!0),
|
|
1564
1815
|
title: "Click to change avatar",
|
|
1565
1816
|
children: [
|
|
1566
|
-
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1569
|
-
/* @__PURE__ */
|
|
1817
|
+
h ? /* @__PURE__ */ s("img", { src: h, alt: "" }) : (C || (r == null ? void 0 : r.email) || "?").charAt(0).toUpperCase(),
|
|
1818
|
+
/* @__PURE__ */ s("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
1819
|
+
/* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
|
|
1820
|
+
/* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
|
|
1570
1821
|
] }) })
|
|
1571
1822
|
]
|
|
1572
1823
|
}
|
|
1573
1824
|
),
|
|
1574
|
-
/* @__PURE__ */
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1825
|
+
/* @__PURE__ */ n("form", { onSubmit: H, children: [
|
|
1826
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1827
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Name" }),
|
|
1828
|
+
/* @__PURE__ */ s(
|
|
1578
1829
|
"input",
|
|
1579
1830
|
{
|
|
1580
1831
|
className: "ss-input",
|
|
1581
1832
|
type: "text",
|
|
1582
1833
|
placeholder: "Your name",
|
|
1583
|
-
value:
|
|
1584
|
-
onChange: (
|
|
1834
|
+
value: C,
|
|
1835
|
+
onChange: (A) => x(A.target.value)
|
|
1585
1836
|
}
|
|
1586
1837
|
)
|
|
1587
1838
|
] }),
|
|
1588
|
-
/* @__PURE__ */
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */
|
|
1839
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1840
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Email" }),
|
|
1841
|
+
/* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "email", value: (r == null ? void 0 : r.email) ?? "", disabled: !0, readOnly: !0 })
|
|
1591
1842
|
] }),
|
|
1592
|
-
/* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1843
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1844
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Provider" }),
|
|
1845
|
+
/* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: (r == null ? void 0 : r.provider) ?? "", disabled: !0, readOnly: !0 })
|
|
1595
1846
|
] }),
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
i && /* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1848
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1598
1849
|
"Save changes"
|
|
1599
1850
|
] })
|
|
1600
1851
|
] }),
|
|
1601
|
-
|
|
1602
|
-
/* @__PURE__ */
|
|
1603
|
-
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1606
|
-
/* @__PURE__ */
|
|
1607
|
-
/* @__PURE__ */
|
|
1852
|
+
pe && /* @__PURE__ */ n("div", { className: "ss-modal-section", children: [
|
|
1853
|
+
/* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Change password" }),
|
|
1854
|
+
M && /* @__PURE__ */ s("div", { className: "ss-global-error", children: M }),
|
|
1855
|
+
/* @__PURE__ */ n("form", { onSubmit: de, children: [
|
|
1856
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1857
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Current password" }),
|
|
1858
|
+
/* @__PURE__ */ s(
|
|
1608
1859
|
"input",
|
|
1609
1860
|
{
|
|
1610
1861
|
className: "ss-input",
|
|
1611
1862
|
type: "password",
|
|
1612
|
-
value:
|
|
1613
|
-
onChange: (
|
|
1863
|
+
value: I,
|
|
1864
|
+
onChange: (A) => T(A.target.value),
|
|
1614
1865
|
required: !0
|
|
1615
1866
|
}
|
|
1616
1867
|
)
|
|
1617
1868
|
] }),
|
|
1618
|
-
/* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1870
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "New password" }),
|
|
1871
|
+
/* @__PURE__ */ s(
|
|
1621
1872
|
"input",
|
|
1622
1873
|
{
|
|
1623
1874
|
className: "ss-input",
|
|
1624
1875
|
type: "password",
|
|
1625
|
-
value:
|
|
1626
|
-
onChange: (
|
|
1876
|
+
value: w,
|
|
1877
|
+
onChange: (A) => $(A.target.value),
|
|
1627
1878
|
required: !0
|
|
1628
1879
|
}
|
|
1629
1880
|
)
|
|
1630
1881
|
] }),
|
|
1631
|
-
/* @__PURE__ */
|
|
1632
|
-
/* @__PURE__ */
|
|
1633
|
-
/* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1883
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Confirm new password" }),
|
|
1884
|
+
/* @__PURE__ */ s(
|
|
1634
1885
|
"input",
|
|
1635
1886
|
{
|
|
1636
1887
|
className: "ss-input",
|
|
1637
1888
|
type: "password",
|
|
1638
|
-
value:
|
|
1639
|
-
onChange: (
|
|
1889
|
+
value: y,
|
|
1890
|
+
onChange: (A) => E(A.target.value),
|
|
1640
1891
|
required: !0
|
|
1641
1892
|
}
|
|
1642
1893
|
)
|
|
1643
1894
|
] }),
|
|
1644
|
-
/* @__PURE__ */
|
|
1645
|
-
i && /* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1896
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1646
1897
|
"Update password"
|
|
1647
1898
|
] })
|
|
1648
1899
|
] })
|
|
1649
1900
|
] }),
|
|
1650
|
-
|
|
1651
|
-
|
|
1901
|
+
/* @__PURE__ */ n("div", { className: "ss-danger-zone", children: [
|
|
1902
|
+
/* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Danger zone" }),
|
|
1903
|
+
/* @__PURE__ */ s("p", { style: { fontSize: "13px", margin: "0 0 12px 0", opacity: 0.8 }, children: "Deleting your account is permanent. All organizations you own will also be deleted." }),
|
|
1904
|
+
k && /* @__PURE__ */ s("div", { className: "ss-global-error", children: k }),
|
|
1905
|
+
V ? /* @__PURE__ */ n("div", { children: [
|
|
1906
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1907
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Type your email to confirm" }),
|
|
1908
|
+
/* @__PURE__ */ s(
|
|
1909
|
+
"input",
|
|
1910
|
+
{
|
|
1911
|
+
className: "ss-input",
|
|
1912
|
+
type: "email",
|
|
1913
|
+
placeholder: r == null ? void 0 : r.email,
|
|
1914
|
+
value: W,
|
|
1915
|
+
onChange: (A) => D(A.target.value),
|
|
1916
|
+
autoFocus: !0
|
|
1917
|
+
}
|
|
1918
|
+
)
|
|
1919
|
+
] }),
|
|
1920
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
|
|
1921
|
+
/* @__PURE__ */ s(
|
|
1922
|
+
"button",
|
|
1923
|
+
{
|
|
1924
|
+
type: "button",
|
|
1925
|
+
className: "ss-btn ss-btn-sm ss-btn-current",
|
|
1926
|
+
onClick: () => {
|
|
1927
|
+
F(!1), D(""), v(null);
|
|
1928
|
+
},
|
|
1929
|
+
children: "Cancel"
|
|
1930
|
+
}
|
|
1931
|
+
),
|
|
1932
|
+
/* @__PURE__ */ n(
|
|
1933
|
+
"button",
|
|
1934
|
+
{
|
|
1935
|
+
type: "button",
|
|
1936
|
+
className: "ss-btn ss-btn-sm ss-btn-danger",
|
|
1937
|
+
disabled: !me || b,
|
|
1938
|
+
onClick: ue,
|
|
1939
|
+
children: [
|
|
1940
|
+
b && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1941
|
+
"Delete account"
|
|
1942
|
+
]
|
|
1943
|
+
}
|
|
1944
|
+
)
|
|
1945
|
+
] })
|
|
1946
|
+
] }) : /* @__PURE__ */ s(
|
|
1947
|
+
"button",
|
|
1948
|
+
{
|
|
1949
|
+
type: "button",
|
|
1950
|
+
className: "ss-btn ss-btn-danger",
|
|
1951
|
+
onClick: () => F(!0),
|
|
1952
|
+
children: "Delete my account"
|
|
1953
|
+
}
|
|
1954
|
+
)
|
|
1955
|
+
] }),
|
|
1956
|
+
z && /* @__PURE__ */ s(
|
|
1957
|
+
le,
|
|
1652
1958
|
{
|
|
1653
|
-
onUpload:
|
|
1654
|
-
onClose: () =>
|
|
1959
|
+
onUpload: ce,
|
|
1960
|
+
onClose: () => P(!1),
|
|
1655
1961
|
isLoading: i
|
|
1656
1962
|
}
|
|
1657
1963
|
)
|
|
1658
1964
|
] }) });
|
|
1659
1965
|
}
|
|
1660
|
-
function
|
|
1661
|
-
const { appearance: a } =
|
|
1662
|
-
async (
|
|
1663
|
-
|
|
1966
|
+
function rs({ appearance: e }) {
|
|
1967
|
+
const { appearance: a } = L(), { user: r, signOut: o } = ee(), { updateProfile: t, uploadAvatar: u, changePassword: i, isLoading: c, error: d, success: l, setError: g, setSuccess: p } = te(), f = e ?? a, [b, k] = m((r == null ? void 0 : r.name) ?? ""), [v, C] = m((r == null ? void 0 : r.avatarUrl) ?? ""), [x, h] = m(!1), [S, z] = m(""), [P, I] = m(""), [T, w] = m(""), [$, y] = m(null), E = N(
|
|
1968
|
+
async (F) => {
|
|
1969
|
+
F.preventDefault(), g(null), p(null), await t({ name: b, avatarUrl: v || void 0 });
|
|
1664
1970
|
},
|
|
1665
|
-
[
|
|
1666
|
-
),
|
|
1667
|
-
async (
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1971
|
+
[b, v, t, g, p]
|
|
1972
|
+
), M = N(
|
|
1973
|
+
async (F) => {
|
|
1974
|
+
const W = await u(F);
|
|
1975
|
+
W && (C(W.avatarUrl), h(!1));
|
|
1670
1976
|
},
|
|
1671
|
-
[
|
|
1672
|
-
), O =
|
|
1673
|
-
async (
|
|
1674
|
-
if (
|
|
1675
|
-
|
|
1977
|
+
[u]
|
|
1978
|
+
), O = N(
|
|
1979
|
+
async (F) => {
|
|
1980
|
+
if (F.preventDefault(), y(null), g(null), p(null), P !== T) {
|
|
1981
|
+
y("Passwords do not match");
|
|
1676
1982
|
return;
|
|
1677
1983
|
}
|
|
1678
|
-
if (
|
|
1679
|
-
|
|
1984
|
+
if (P.length < 8) {
|
|
1985
|
+
y("Password must be at least 8 characters");
|
|
1680
1986
|
return;
|
|
1681
1987
|
}
|
|
1682
|
-
await
|
|
1988
|
+
await i(S, P) && (z(""), I(""), w(""));
|
|
1683
1989
|
},
|
|
1684
|
-
[
|
|
1990
|
+
[S, P, T, i, g, p]
|
|
1685
1991
|
);
|
|
1686
1992
|
if (!r) return null;
|
|
1687
|
-
const
|
|
1688
|
-
return /* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
/* @__PURE__ */
|
|
1993
|
+
const V = r.provider === "email";
|
|
1994
|
+
return /* @__PURE__ */ s(q, { appearance: f, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
|
|
1995
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Profile" }),
|
|
1996
|
+
d && /* @__PURE__ */ s("div", { className: "ss-global-error", children: d }),
|
|
1997
|
+
l && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: l }),
|
|
1998
|
+
/* @__PURE__ */ n(
|
|
1693
1999
|
"div",
|
|
1694
2000
|
{
|
|
1695
2001
|
className: "ss-avatar-preview ss-avatar-hoverable",
|
|
1696
2002
|
style: { margin: "0 auto 16px" },
|
|
1697
|
-
onClick: () =>
|
|
2003
|
+
onClick: () => h(!0),
|
|
1698
2004
|
title: "Click to change avatar",
|
|
1699
2005
|
children: [
|
|
1700
|
-
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */
|
|
1703
|
-
/* @__PURE__ */
|
|
2006
|
+
v ? /* @__PURE__ */ s("img", { src: v, alt: "" }) : (b || r.email).charAt(0).toUpperCase(),
|
|
2007
|
+
/* @__PURE__ */ s("div", { className: "ss-avatar-overlay", children: /* @__PURE__ */ n("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
|
|
2008
|
+
/* @__PURE__ */ s("path", { d: "M12 16a4 4 0 100-8 4 4 0 000 8z" }),
|
|
2009
|
+
/* @__PURE__ */ s("path", { d: "M3 16.8V9.2c0-1.12 0-1.68.218-2.108a2 2 0 01.874-.874C4.52 6 5.08 6 6.2 6h.382c.246 0 .37 0 .482-.022a1 1 0 00.513-.29c.08-.082.148-.186.284-.392l.079-.118C8.08 4.968 8.15 4.863 8.234 4.77a2 2 0 01.965-.61C9.346 4.1 9.508 4.1 9.834 4.1h4.332c.326 0 .488 0 .636.06a2 2 0 01.965.61c.083.094.153.198.293.408l.079.118c.136.206.204.31.284.392a1 1 0 00.513.29c.112.022.236.022.482.022h.382c1.12 0 1.68 0 2.108.218a2 2 0 01.874.874C21 7.52 21 8.08 21 9.2v7.6c0 1.12 0 1.68-.218 2.108a2 2 0 01-.874.874C19.48 20 18.92 20 17.8 20H6.2c-1.12 0-1.68 0-2.108-.218a2 2 0 01-.874-.874C3 18.48 3 17.92 3 16.8z" })
|
|
1704
2010
|
] }) })
|
|
1705
2011
|
]
|
|
1706
2012
|
}
|
|
1707
2013
|
),
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
1711
|
-
/* @__PURE__ */
|
|
2014
|
+
/* @__PURE__ */ n("form", { onSubmit: E, children: [
|
|
2015
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2016
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Name" }),
|
|
2017
|
+
/* @__PURE__ */ s("input", { className: "ss-input", type: "text", placeholder: "Your name", value: b, onChange: (F) => k(F.target.value) })
|
|
1712
2018
|
] }),
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
2019
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2020
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Email" }),
|
|
2021
|
+
/* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "email", value: r.email, disabled: !0, readOnly: !0 })
|
|
1716
2022
|
] }),
|
|
1717
|
-
/* @__PURE__ */
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2024
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Provider" }),
|
|
2025
|
+
/* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: r.provider, disabled: !0, readOnly: !0 })
|
|
1720
2026
|
] }),
|
|
1721
|
-
/* @__PURE__ */
|
|
1722
|
-
/* @__PURE__ */
|
|
1723
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2028
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Email verified" }),
|
|
2029
|
+
/* @__PURE__ */ s("input", { className: "ss-input ss-input-readonly", type: "text", value: r.emailVerified ? "Yes" : "No", disabled: !0, readOnly: !0 })
|
|
1724
2030
|
] }),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
|
|
2031
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
|
|
2032
|
+
c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1727
2033
|
"Save changes"
|
|
1728
2034
|
] })
|
|
1729
2035
|
] }),
|
|
1730
|
-
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
|
|
1733
|
-
/* @__PURE__ */
|
|
1734
|
-
/* @__PURE__ */
|
|
1735
|
-
/* @__PURE__ */
|
|
1736
|
-
/* @__PURE__ */
|
|
2036
|
+
V && /* @__PURE__ */ n("div", { className: "ss-modal-section", children: [
|
|
2037
|
+
/* @__PURE__ */ s("div", { className: "ss-modal-section-title", children: "Change password" }),
|
|
2038
|
+
$ && /* @__PURE__ */ s("div", { className: "ss-global-error", children: $ }),
|
|
2039
|
+
/* @__PURE__ */ n("form", { onSubmit: O, children: [
|
|
2040
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2041
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Current password" }),
|
|
2042
|
+
/* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: S, onChange: (F) => z(F.target.value), required: !0 })
|
|
1737
2043
|
] }),
|
|
1738
|
-
/* @__PURE__ */
|
|
1739
|
-
/* @__PURE__ */
|
|
1740
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2045
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "New password" }),
|
|
2046
|
+
/* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: P, onChange: (F) => I(F.target.value), required: !0 })
|
|
1741
2047
|
] }),
|
|
1742
|
-
/* @__PURE__ */
|
|
1743
|
-
/* @__PURE__ */
|
|
1744
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2049
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Confirm new password" }),
|
|
2050
|
+
/* @__PURE__ */ s("input", { className: "ss-input", type: "password", value: T, onChange: (F) => w(F.target.value), required: !0 })
|
|
1745
2051
|
] }),
|
|
1746
|
-
/* @__PURE__ */
|
|
1747
|
-
|
|
2052
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
|
|
2053
|
+
c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1748
2054
|
"Update password"
|
|
1749
2055
|
] })
|
|
1750
2056
|
] })
|
|
1751
2057
|
] }),
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
|
|
1754
|
-
|
|
2058
|
+
/* @__PURE__ */ s("div", { style: { marginTop: "24px" }, children: /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: () => o(), children: "Sign out" }) }),
|
|
2059
|
+
x && /* @__PURE__ */ s(
|
|
2060
|
+
le,
|
|
1755
2061
|
{
|
|
1756
|
-
onUpload:
|
|
1757
|
-
onClose: () =>
|
|
1758
|
-
isLoading:
|
|
2062
|
+
onUpload: M,
|
|
2063
|
+
onClose: () => h(!1),
|
|
2064
|
+
isLoading: c
|
|
1759
2065
|
}
|
|
1760
2066
|
)
|
|
1761
2067
|
] }) });
|
|
1762
2068
|
}
|
|
1763
|
-
function
|
|
1764
|
-
const { appearance: r } =
|
|
1765
|
-
|
|
2069
|
+
function as({ appearance: e, onOrgChange: a }) {
|
|
2070
|
+
const { appearance: r } = L(), { orgs: o, selectedOrg: t, selectOrg: u, createOrg: i, isLoading: c } = ae(), d = e ?? r, [l, g] = m(!1), [p, f] = m(!1), [b, k] = m(""), [v, C] = m(""), [x, h] = m(null), [S, z] = m(!1), P = j(null), I = N((y) => {
|
|
2071
|
+
P.current && !y.composedPath().includes(P.current) && (g(!1), f(!1));
|
|
1766
2072
|
}, []);
|
|
1767
|
-
|
|
1768
|
-
if (
|
|
1769
|
-
const
|
|
1770
|
-
document.addEventListener("click",
|
|
2073
|
+
U(() => {
|
|
2074
|
+
if (l) {
|
|
2075
|
+
const y = setTimeout(() => {
|
|
2076
|
+
document.addEventListener("click", I);
|
|
1771
2077
|
}, 0);
|
|
1772
2078
|
return () => {
|
|
1773
|
-
clearTimeout(
|
|
2079
|
+
clearTimeout(y), document.removeEventListener("click", I);
|
|
1774
2080
|
};
|
|
1775
2081
|
}
|
|
1776
|
-
}, [
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
}, []),
|
|
1780
|
-
async (
|
|
1781
|
-
|
|
2082
|
+
}, [l, I]);
|
|
2083
|
+
const T = N((y) => {
|
|
2084
|
+
k(y), C(y.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, ""));
|
|
2085
|
+
}, []), w = N(
|
|
2086
|
+
async (y) => {
|
|
2087
|
+
y.preventDefault(), h(null), z(!0);
|
|
1782
2088
|
try {
|
|
1783
|
-
const
|
|
1784
|
-
|
|
1785
|
-
} catch (
|
|
1786
|
-
|
|
2089
|
+
const E = await i(b, v);
|
|
2090
|
+
E && (await u(E.id), a == null || a(E), f(!1), k(""), C(""), g(!1));
|
|
2091
|
+
} catch (E) {
|
|
2092
|
+
h(E instanceof Error ? E.message : "Failed to create organization");
|
|
1787
2093
|
} finally {
|
|
1788
|
-
|
|
2094
|
+
z(!1);
|
|
1789
2095
|
}
|
|
1790
2096
|
},
|
|
1791
|
-
[
|
|
2097
|
+
[b, v, i, u, a]
|
|
1792
2098
|
);
|
|
1793
|
-
if (
|
|
1794
|
-
const
|
|
1795
|
-
return /* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
2099
|
+
if (c) return null;
|
|
2100
|
+
const $ = (t == null ? void 0 : t.name) ?? (o.length === 0 ? "No organization" : "Select organization");
|
|
2101
|
+
return /* @__PURE__ */ s(q, { appearance: d, children: /* @__PURE__ */ n("div", { className: "ss-user-btn", ref: P, children: [
|
|
2102
|
+
/* @__PURE__ */ n(
|
|
1797
2103
|
"button",
|
|
1798
2104
|
{
|
|
1799
2105
|
type: "button",
|
|
1800
2106
|
className: "ss-btn ss-btn-org-switcher",
|
|
1801
|
-
onClick: () =>
|
|
2107
|
+
onClick: () => g(!l),
|
|
1802
2108
|
children: [
|
|
1803
|
-
|
|
1804
|
-
/* @__PURE__ */
|
|
2109
|
+
$,
|
|
2110
|
+
/* @__PURE__ */ s("span", { className: "ss-chevron", children: l ? "▲" : "▼" })
|
|
1805
2111
|
]
|
|
1806
2112
|
}
|
|
1807
2113
|
),
|
|
1808
|
-
|
|
1809
|
-
|
|
2114
|
+
l && /* @__PURE__ */ n("div", { className: "ss-dropdown ss-dropdown-org", children: [
|
|
2115
|
+
o.map((y) => /* @__PURE__ */ s(
|
|
1810
2116
|
"button",
|
|
1811
2117
|
{
|
|
1812
2118
|
type: "button",
|
|
1813
|
-
className: `ss-dropdown-item ${(t == null ? void 0 : t.id) ===
|
|
2119
|
+
className: `ss-dropdown-item ${(t == null ? void 0 : t.id) === y.id ? "ss-dropdown-item-active" : ""}`,
|
|
1814
2120
|
onClick: async () => {
|
|
1815
|
-
|
|
2121
|
+
g(!1), f(!1), await u(y.id), a == null || a(y);
|
|
1816
2122
|
},
|
|
1817
|
-
children:
|
|
2123
|
+
children: y.name
|
|
1818
2124
|
},
|
|
1819
|
-
|
|
2125
|
+
y.id
|
|
1820
2126
|
)),
|
|
1821
|
-
/* @__PURE__ */
|
|
1822
|
-
p ? /* @__PURE__ */
|
|
1823
|
-
|
|
1824
|
-
/* @__PURE__ */
|
|
1825
|
-
/* @__PURE__ */
|
|
2127
|
+
/* @__PURE__ */ s("div", { className: "ss-dropdown-divider" }),
|
|
2128
|
+
p ? /* @__PURE__ */ n("div", { className: "ss-inline-form", children: [
|
|
2129
|
+
x && /* @__PURE__ */ s("div", { className: "ss-global-error", style: { marginBottom: "8px", fontSize: "12px" }, children: x }),
|
|
2130
|
+
/* @__PURE__ */ n("form", { onSubmit: w, children: [
|
|
2131
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
1826
2132
|
"input",
|
|
1827
2133
|
{
|
|
1828
2134
|
className: "ss-input",
|
|
1829
2135
|
type: "text",
|
|
1830
2136
|
placeholder: "Organization name",
|
|
1831
|
-
value:
|
|
1832
|
-
onChange: (
|
|
2137
|
+
value: b,
|
|
2138
|
+
onChange: (y) => T(y.target.value),
|
|
1833
2139
|
required: !0,
|
|
1834
2140
|
autoFocus: !0
|
|
1835
2141
|
}
|
|
1836
2142
|
) }),
|
|
1837
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
1838
2144
|
"input",
|
|
1839
2145
|
{
|
|
1840
2146
|
className: "ss-input",
|
|
1841
2147
|
type: "text",
|
|
1842
2148
|
placeholder: "org-slug",
|
|
1843
|
-
value:
|
|
1844
|
-
onChange: (
|
|
2149
|
+
value: v,
|
|
2150
|
+
onChange: (y) => C(y.target.value),
|
|
1845
2151
|
required: !0
|
|
1846
2152
|
}
|
|
1847
2153
|
) }),
|
|
1848
|
-
/* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
|
|
2155
|
+
/* @__PURE__ */ s(
|
|
1850
2156
|
"button",
|
|
1851
2157
|
{
|
|
1852
2158
|
type: "button",
|
|
1853
2159
|
className: "ss-btn ss-btn-sm ss-btn-current",
|
|
1854
2160
|
onClick: () => {
|
|
1855
|
-
|
|
2161
|
+
f(!1), h(null);
|
|
1856
2162
|
},
|
|
1857
2163
|
children: "Cancel"
|
|
1858
2164
|
}
|
|
1859
2165
|
),
|
|
1860
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ n(
|
|
1861
2167
|
"button",
|
|
1862
2168
|
{
|
|
1863
2169
|
type: "submit",
|
|
1864
2170
|
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
1865
|
-
disabled:
|
|
2171
|
+
disabled: S,
|
|
1866
2172
|
children: [
|
|
1867
|
-
|
|
2173
|
+
S && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1868
2174
|
"Create"
|
|
1869
2175
|
]
|
|
1870
2176
|
}
|
|
1871
2177
|
)
|
|
1872
2178
|
] })
|
|
1873
2179
|
] })
|
|
1874
|
-
] }) : /* @__PURE__ */
|
|
2180
|
+
] }) : /* @__PURE__ */ s(
|
|
1875
2181
|
"button",
|
|
1876
2182
|
{
|
|
1877
2183
|
type: "button",
|
|
1878
2184
|
className: "ss-dropdown-item",
|
|
1879
|
-
onClick: () =>
|
|
2185
|
+
onClick: () => f(!0),
|
|
1880
2186
|
style: { fontWeight: 500 },
|
|
1881
2187
|
children: "+ Create organization"
|
|
1882
2188
|
}
|
|
@@ -1884,636 +2190,636 @@ function Vs({ appearance: s, onOrgChange: a }) {
|
|
|
1884
2190
|
] })
|
|
1885
2191
|
] }) });
|
|
1886
2192
|
}
|
|
1887
|
-
function
|
|
2193
|
+
function Pe(e, a = "USD") {
|
|
1888
2194
|
return new Intl.NumberFormat("en-US", {
|
|
1889
2195
|
style: "currency",
|
|
1890
2196
|
currency: a,
|
|
1891
|
-
minimumFractionDigits:
|
|
1892
|
-
}).format(
|
|
2197
|
+
minimumFractionDigits: e % 100 === 0 ? 0 : 2
|
|
2198
|
+
}).format(e / 100);
|
|
1893
2199
|
}
|
|
1894
|
-
function
|
|
1895
|
-
const { appearance:
|
|
1896
|
-
return /* @__PURE__ */
|
|
1897
|
-
const
|
|
1898
|
-
return /* @__PURE__ */
|
|
1899
|
-
/* @__PURE__ */
|
|
1900
|
-
/* @__PURE__ */
|
|
1901
|
-
|
|
1902
|
-
|
|
2200
|
+
function ts({ plans: e, currentPlanId: a, onSelectPlan: r, interval: o, appearance: t }) {
|
|
2201
|
+
const { appearance: u } = L(), i = t ?? u, c = o ? e.filter((d) => d.interval === o || d.isFree) : e;
|
|
2202
|
+
return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ s("div", { className: "ss-pricing-grid", children: c.map((d) => {
|
|
2203
|
+
const l = d.id === a;
|
|
2204
|
+
return /* @__PURE__ */ n("div", { className: `ss-pricing-card ${l ? "ss-pricing-card-current" : ""}`, children: [
|
|
2205
|
+
/* @__PURE__ */ n("div", { className: "ss-pricing-header", children: [
|
|
2206
|
+
/* @__PURE__ */ s("h3", { className: "ss-pricing-name", children: d.name }),
|
|
2207
|
+
d.trialDays > 0 && /* @__PURE__ */ n("span", { className: "ss-badge ss-badge-trialing", children: [
|
|
2208
|
+
d.trialDays,
|
|
1903
2209
|
"-day trial"
|
|
1904
2210
|
] }),
|
|
1905
|
-
|
|
2211
|
+
d.isFree && /* @__PURE__ */ s("span", { className: "ss-badge ss-badge-active", children: "Free" })
|
|
1906
2212
|
] }),
|
|
1907
|
-
/* @__PURE__ */
|
|
1908
|
-
/* @__PURE__ */
|
|
1909
|
-
/* @__PURE__ */
|
|
2213
|
+
/* @__PURE__ */ s("div", { className: "ss-pricing-price", children: d.isFree ? /* @__PURE__ */ s("span", { className: "ss-pricing-amount", children: "Free" }) : /* @__PURE__ */ n(G, { children: [
|
|
2214
|
+
/* @__PURE__ */ s("span", { className: "ss-pricing-amount", children: Pe(d.amountCents, d.currency) }),
|
|
2215
|
+
/* @__PURE__ */ n("span", { className: "ss-pricing-interval", children: [
|
|
1910
2216
|
"/",
|
|
1911
|
-
|
|
2217
|
+
d.interval
|
|
1912
2218
|
] })
|
|
1913
2219
|
] }) }),
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
/* @__PURE__ */
|
|
2220
|
+
d.description && /* @__PURE__ */ s("p", { className: "ss-pricing-desc", children: d.description }),
|
|
2221
|
+
d.features.length > 0 && /* @__PURE__ */ s("ul", { className: "ss-pricing-features", children: d.features.map((g, p) => /* @__PURE__ */ n("li", { className: "ss-pricing-feature", children: [
|
|
2222
|
+
/* @__PURE__ */ s("span", { className: "ss-check", children: "✓" }),
|
|
1917
2223
|
" ",
|
|
1918
|
-
|
|
2224
|
+
g
|
|
1919
2225
|
] }, p)) }),
|
|
1920
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ s(
|
|
1921
2227
|
"button",
|
|
1922
2228
|
{
|
|
1923
2229
|
type: "button",
|
|
1924
|
-
className: `ss-btn ${
|
|
1925
|
-
disabled:
|
|
1926
|
-
onClick: () => r(
|
|
1927
|
-
children:
|
|
2230
|
+
className: `ss-btn ${l ? "ss-btn-current" : "ss-btn-primary"}`,
|
|
2231
|
+
disabled: l,
|
|
2232
|
+
onClick: () => r(d.id),
|
|
2233
|
+
children: l ? "Current plan" : "Select plan"
|
|
1928
2234
|
}
|
|
1929
2235
|
)
|
|
1930
|
-
] },
|
|
2236
|
+
] }, d.id);
|
|
1931
2237
|
}) }) });
|
|
1932
2238
|
}
|
|
1933
|
-
function
|
|
1934
|
-
const { client:
|
|
1935
|
-
return { billing:
|
|
2239
|
+
function ns() {
|
|
2240
|
+
const { client: e } = L();
|
|
2241
|
+
return { billing: e.billing };
|
|
1936
2242
|
}
|
|
1937
|
-
function
|
|
1938
|
-
const { client: a } =
|
|
1939
|
-
return
|
|
1940
|
-
if (
|
|
1941
|
-
const r = new
|
|
1942
|
-
return new
|
|
2243
|
+
function Q(e) {
|
|
2244
|
+
const { client: a } = L();
|
|
2245
|
+
return _(() => {
|
|
2246
|
+
if (e) {
|
|
2247
|
+
const r = new J("https://api.saas-support.com/v1", { type: "portalToken", token: e });
|
|
2248
|
+
return new ye(r);
|
|
1943
2249
|
}
|
|
1944
2250
|
return a.billing;
|
|
1945
|
-
}, [a,
|
|
2251
|
+
}, [a, e]);
|
|
1946
2252
|
}
|
|
1947
|
-
function
|
|
1948
|
-
const r =
|
|
1949
|
-
|
|
2253
|
+
function ze(e, a) {
|
|
2254
|
+
const r = Q(a), [o, t] = m(null), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
|
|
2255
|
+
i(!0), d(null);
|
|
1950
2256
|
try {
|
|
1951
|
-
const
|
|
1952
|
-
t(
|
|
1953
|
-
} catch (
|
|
1954
|
-
|
|
2257
|
+
const g = await r.getCustomer(e);
|
|
2258
|
+
t(g);
|
|
2259
|
+
} catch (g) {
|
|
2260
|
+
d(g instanceof Error ? g.message : "Failed to load subscription");
|
|
1955
2261
|
} finally {
|
|
1956
|
-
|
|
2262
|
+
i(!1);
|
|
1957
2263
|
}
|
|
1958
|
-
}, [r,
|
|
1959
|
-
return
|
|
1960
|
-
|
|
1961
|
-
}, [
|
|
2264
|
+
}, [r, e]);
|
|
2265
|
+
return U(() => {
|
|
2266
|
+
l();
|
|
2267
|
+
}, [l]), { customer: o, isLoading: u, error: c, refresh: l };
|
|
1962
2268
|
}
|
|
1963
|
-
function
|
|
1964
|
-
const r =
|
|
1965
|
-
|
|
2269
|
+
function Ie(e, a) {
|
|
2270
|
+
const r = Q(a), [o, t] = m([]), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
|
|
2271
|
+
i(!0), d(null);
|
|
1966
2272
|
try {
|
|
1967
|
-
const
|
|
1968
|
-
t(
|
|
1969
|
-
} catch (
|
|
1970
|
-
|
|
2273
|
+
const g = await r.getInvoices(e);
|
|
2274
|
+
t(g);
|
|
2275
|
+
} catch (g) {
|
|
2276
|
+
d(g instanceof Error ? g.message : "Failed to load invoices");
|
|
1971
2277
|
} finally {
|
|
1972
|
-
|
|
2278
|
+
i(!1);
|
|
1973
2279
|
}
|
|
1974
|
-
}, [r,
|
|
1975
|
-
return
|
|
1976
|
-
|
|
1977
|
-
}, [
|
|
2280
|
+
}, [r, e]);
|
|
2281
|
+
return U(() => {
|
|
2282
|
+
l();
|
|
2283
|
+
}, [l]), { invoices: o, isLoading: u, error: c, refresh: l };
|
|
1978
2284
|
}
|
|
1979
|
-
function
|
|
1980
|
-
const r =
|
|
1981
|
-
|
|
2285
|
+
function Te(e, a) {
|
|
2286
|
+
const r = Q(a), [o, t] = m([]), [u, i] = m(!0), [c, d] = m(null), l = N(async () => {
|
|
2287
|
+
i(!0), d(null);
|
|
1982
2288
|
try {
|
|
1983
|
-
const
|
|
1984
|
-
t(
|
|
1985
|
-
} catch (
|
|
1986
|
-
|
|
2289
|
+
const g = await r.getCurrentUsage(e);
|
|
2290
|
+
t(g);
|
|
2291
|
+
} catch (g) {
|
|
2292
|
+
d(g instanceof Error ? g.message : "Failed to load usage");
|
|
1987
2293
|
} finally {
|
|
1988
|
-
|
|
2294
|
+
i(!1);
|
|
1989
2295
|
}
|
|
1990
|
-
}, [r,
|
|
1991
|
-
return
|
|
1992
|
-
|
|
1993
|
-
}, [
|
|
2296
|
+
}, [r, e]);
|
|
2297
|
+
return U(() => {
|
|
2298
|
+
l();
|
|
2299
|
+
}, [l]), { usage: o, isLoading: u, error: c, refresh: l };
|
|
1994
2300
|
}
|
|
1995
|
-
const
|
|
2301
|
+
const Le = {
|
|
1996
2302
|
active: "ss-badge-active"
|
|
1997
2303
|
};
|
|
1998
|
-
function
|
|
1999
|
-
customerId:
|
|
2304
|
+
function Be({
|
|
2305
|
+
customerId: e,
|
|
2000
2306
|
portalToken: a,
|
|
2001
2307
|
onChangePlan: r,
|
|
2002
|
-
onCancel:
|
|
2308
|
+
onCancel: o,
|
|
2003
2309
|
appearance: t
|
|
2004
2310
|
}) {
|
|
2005
|
-
const { appearance:
|
|
2006
|
-
return /* @__PURE__ */
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
|
|
2009
|
-
/* @__PURE__ */
|
|
2311
|
+
const { appearance: u } = L(), { customer: i, isLoading: c, error: d } = ze(e, a);
|
|
2312
|
+
return /* @__PURE__ */ s(q, { appearance: t ?? u, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
|
|
2313
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Subscription" }),
|
|
2314
|
+
c && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
|
|
2315
|
+
/* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2010
2316
|
" Loading..."
|
|
2011
2317
|
] }),
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
/* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2016
|
-
/* @__PURE__ */
|
|
2318
|
+
d && /* @__PURE__ */ s("div", { className: "ss-global-error", children: d }),
|
|
2319
|
+
i && !c && /* @__PURE__ */ n(G, { children: [
|
|
2320
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2321
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Customer" }),
|
|
2322
|
+
/* @__PURE__ */ s("input", { className: "ss-input", value: i.name || i.email, disabled: !0, readOnly: !0 })
|
|
2017
2323
|
] }),
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2020
|
-
/* @__PURE__ */
|
|
2324
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2325
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Status" }),
|
|
2326
|
+
/* @__PURE__ */ s("div", { children: /* @__PURE__ */ s("span", { className: `ss-badge ${Le.active}`, children: "Active" }) })
|
|
2021
2327
|
] }),
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
r && /* @__PURE__ */
|
|
2024
|
-
|
|
2328
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", children: [
|
|
2329
|
+
r && /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-primary", onClick: r, children: "Change plan" }),
|
|
2330
|
+
o && /* @__PURE__ */ s("button", { type: "button", className: "ss-btn ss-btn-danger", onClick: o, children: "Cancel subscription" })
|
|
2025
2331
|
] })
|
|
2026
2332
|
] })
|
|
2027
2333
|
] }) });
|
|
2028
2334
|
}
|
|
2029
|
-
const
|
|
2335
|
+
const De = {
|
|
2030
2336
|
paid: "ss-badge-active",
|
|
2031
2337
|
open: "ss-badge-trialing",
|
|
2032
2338
|
draft: "ss-badge-paused",
|
|
2033
2339
|
void: "ss-badge-canceled",
|
|
2034
2340
|
uncollectible: "ss-badge-past-due"
|
|
2035
2341
|
};
|
|
2036
|
-
function
|
|
2037
|
-
return new Date(
|
|
2342
|
+
function Ae(e) {
|
|
2343
|
+
return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
2038
2344
|
}
|
|
2039
|
-
function
|
|
2040
|
-
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(
|
|
2345
|
+
function Me(e) {
|
|
2346
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", minimumFractionDigits: 2 }).format(e / 100);
|
|
2041
2347
|
}
|
|
2042
|
-
function
|
|
2043
|
-
const { appearance:
|
|
2044
|
-
return /* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2046
|
-
|
|
2047
|
-
/* @__PURE__ */
|
|
2348
|
+
function Fe({ customerId: e, portalToken: a, appearance: r }) {
|
|
2349
|
+
const { appearance: o } = L(), { invoices: t, isLoading: u, error: i } = Ie(e, a), c = r ?? o, d = [...t].sort((l, g) => new Date(g.createdAt).getTime() - new Date(l.createdAt).getTime());
|
|
2350
|
+
return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
|
|
2351
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Invoices" }),
|
|
2352
|
+
u && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
|
|
2353
|
+
/* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2048
2354
|
" Loading..."
|
|
2049
2355
|
] }),
|
|
2050
|
-
|
|
2051
|
-
!
|
|
2052
|
-
!
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2356
|
+
i && /* @__PURE__ */ s("div", { className: "ss-global-error", children: i }),
|
|
2357
|
+
!u && d.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No invoices yet." }),
|
|
2358
|
+
!u && d.length > 0 && /* @__PURE__ */ n("table", { className: "ss-table", children: [
|
|
2359
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
2360
|
+
/* @__PURE__ */ s("th", { className: "ss-th", children: "Date" }),
|
|
2361
|
+
/* @__PURE__ */ s("th", { className: "ss-th", children: "Amount" }),
|
|
2362
|
+
/* @__PURE__ */ s("th", { className: "ss-th", children: "Status" }),
|
|
2363
|
+
/* @__PURE__ */ s("th", { className: "ss-th", children: "PDF" })
|
|
2058
2364
|
] }) }),
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
] },
|
|
2365
|
+
/* @__PURE__ */ s("tbody", { children: d.map((l) => /* @__PURE__ */ n("tr", { className: "ss-tr", children: [
|
|
2366
|
+
/* @__PURE__ */ s("td", { className: "ss-td", children: Ae(l.createdAt) }),
|
|
2367
|
+
/* @__PURE__ */ s("td", { className: "ss-td", children: Me(l.amountCents) }),
|
|
2368
|
+
/* @__PURE__ */ s("td", { className: "ss-td", children: /* @__PURE__ */ s("span", { className: `ss-badge ${De[l.status] || ""}`, children: l.status }) }),
|
|
2369
|
+
/* @__PURE__ */ s("td", { className: "ss-td", children: l.pdfUrl ? /* @__PURE__ */ s("a", { className: "ss-link", href: l.pdfUrl, target: "_blank", rel: "noopener noreferrer", children: "Download" }) : "—" })
|
|
2370
|
+
] }, l.id)) })
|
|
2065
2371
|
] })
|
|
2066
2372
|
] }) });
|
|
2067
2373
|
}
|
|
2068
|
-
function
|
|
2069
|
-
const { appearance: t } =
|
|
2070
|
-
return /* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
|
|
2073
|
-
/* @__PURE__ */
|
|
2374
|
+
function Ue({ customerId: e, limits: a, portalToken: r, appearance: o }) {
|
|
2375
|
+
const { appearance: t } = L(), { usage: u, isLoading: i, error: c } = Te(e, r);
|
|
2376
|
+
return /* @__PURE__ */ s(q, { appearance: o ?? t, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
|
|
2377
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Usage" }),
|
|
2378
|
+
i && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
|
|
2379
|
+
/* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2074
2380
|
" Loading..."
|
|
2075
2381
|
] }),
|
|
2076
|
-
|
|
2077
|
-
!
|
|
2078
|
-
!
|
|
2079
|
-
const
|
|
2080
|
-
return /* @__PURE__ */
|
|
2081
|
-
/* @__PURE__ */
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
|
|
2085
|
-
|
|
2382
|
+
c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
|
|
2383
|
+
!i && u.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No usage data." }),
|
|
2384
|
+
!i && u.map((l) => {
|
|
2385
|
+
const g = a == null ? void 0 : a[l.metric], p = g ? Math.min(100, l.total / g * 100) : null;
|
|
2386
|
+
return /* @__PURE__ */ n("div", { className: "ss-usage-item", children: [
|
|
2387
|
+
/* @__PURE__ */ n("div", { className: "ss-usage-header", children: [
|
|
2388
|
+
/* @__PURE__ */ s("span", { className: "ss-usage-metric", children: l.metric }),
|
|
2389
|
+
/* @__PURE__ */ n("span", { className: "ss-usage-value", children: [
|
|
2390
|
+
l.total.toLocaleString(),
|
|
2391
|
+
g ? ` / ${g.toLocaleString()}` : ""
|
|
2086
2392
|
] })
|
|
2087
2393
|
] }),
|
|
2088
|
-
p !== null && /* @__PURE__ */
|
|
2394
|
+
p !== null && /* @__PURE__ */ s("div", { className: "ss-progress-bar", children: /* @__PURE__ */ s(
|
|
2089
2395
|
"div",
|
|
2090
2396
|
{
|
|
2091
2397
|
className: `ss-progress-fill ${p > 90 ? "ss-progress-danger" : ""}`,
|
|
2092
2398
|
style: { width: `${p}%` }
|
|
2093
2399
|
}
|
|
2094
2400
|
) })
|
|
2095
|
-
] },
|
|
2401
|
+
] }, l.metric);
|
|
2096
2402
|
})
|
|
2097
2403
|
] }) });
|
|
2098
2404
|
}
|
|
2099
|
-
function
|
|
2100
|
-
customerId:
|
|
2405
|
+
function os({
|
|
2406
|
+
customerId: e,
|
|
2101
2407
|
portalToken: a,
|
|
2102
2408
|
limits: r,
|
|
2103
|
-
onChangePlan:
|
|
2409
|
+
onChangePlan: o,
|
|
2104
2410
|
onCancel: t,
|
|
2105
|
-
appearance:
|
|
2411
|
+
appearance: u
|
|
2106
2412
|
}) {
|
|
2107
|
-
const { appearance:
|
|
2108
|
-
return /* @__PURE__ */
|
|
2109
|
-
/* @__PURE__ */
|
|
2110
|
-
/* @__PURE__ */
|
|
2413
|
+
const { appearance: i } = L(), c = u ?? i, [d, l] = m("subscription");
|
|
2414
|
+
return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
|
|
2415
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Billing" }),
|
|
2416
|
+
/* @__PURE__ */ s("div", { className: "ss-tab-group", children: [
|
|
2111
2417
|
{ id: "subscription", label: "Subscription" },
|
|
2112
2418
|
{ id: "invoices", label: "Invoices" },
|
|
2113
2419
|
{ id: "usage", label: "Usage" }
|
|
2114
|
-
].map((p) => /* @__PURE__ */
|
|
2420
|
+
].map((p) => /* @__PURE__ */ s(
|
|
2115
2421
|
"button",
|
|
2116
2422
|
{
|
|
2117
2423
|
type: "button",
|
|
2118
|
-
className: `ss-tab ${
|
|
2119
|
-
onClick: () =>
|
|
2424
|
+
className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
|
|
2425
|
+
onClick: () => l(p.id),
|
|
2120
2426
|
children: p.label
|
|
2121
2427
|
},
|
|
2122
2428
|
p.id
|
|
2123
2429
|
)) }),
|
|
2124
|
-
/* @__PURE__ */
|
|
2125
|
-
|
|
2126
|
-
|
|
2430
|
+
/* @__PURE__ */ n("div", { className: "ss-tab-content", children: [
|
|
2431
|
+
d === "subscription" && /* @__PURE__ */ s(
|
|
2432
|
+
Be,
|
|
2127
2433
|
{
|
|
2128
|
-
customerId:
|
|
2434
|
+
customerId: e,
|
|
2129
2435
|
portalToken: a,
|
|
2130
|
-
onChangePlan:
|
|
2436
|
+
onChangePlan: o,
|
|
2131
2437
|
onCancel: t
|
|
2132
2438
|
}
|
|
2133
2439
|
),
|
|
2134
|
-
|
|
2135
|
-
|
|
2440
|
+
d === "invoices" && /* @__PURE__ */ s(Fe, { customerId: e, portalToken: a }),
|
|
2441
|
+
d === "usage" && /* @__PURE__ */ s(Ue, { customerId: e, portalToken: a, limits: r })
|
|
2136
2442
|
] })
|
|
2137
2443
|
] }) });
|
|
2138
2444
|
}
|
|
2139
|
-
function
|
|
2140
|
-
const { appearance: t } =
|
|
2141
|
-
if (
|
|
2142
|
-
|
|
2445
|
+
function ls({ customerId: e, portalToken: a, onApplied: r, appearance: o }) {
|
|
2446
|
+
const { appearance: t } = L(), u = Q(a), i = o ?? t, [c, d] = m(""), [l, g] = m(!1), [p, f] = m(null), [b, k] = m(null), v = N(async (C) => {
|
|
2447
|
+
if (C.preventDefault(), !!c.trim()) {
|
|
2448
|
+
g(!0), f(null), k(null);
|
|
2143
2449
|
try {
|
|
2144
|
-
const
|
|
2145
|
-
|
|
2146
|
-
} catch (
|
|
2147
|
-
|
|
2450
|
+
const x = await u.applyCoupon(e, c.trim());
|
|
2451
|
+
k(`Coupon applied! ${x.discountType === "percent" ? `${x.amount}% off` : `$${(x.amount / 100).toFixed(2)} off`}`), d(""), r == null || r(x);
|
|
2452
|
+
} catch (x) {
|
|
2453
|
+
f(x instanceof Error ? x.message : "Invalid coupon code");
|
|
2148
2454
|
} finally {
|
|
2149
|
-
|
|
2455
|
+
g(!1);
|
|
2150
2456
|
}
|
|
2151
2457
|
}
|
|
2152
|
-
}, [
|
|
2153
|
-
return /* @__PURE__ */
|
|
2154
|
-
/* @__PURE__ */
|
|
2155
|
-
p && /* @__PURE__ */
|
|
2156
|
-
|
|
2157
|
-
/* @__PURE__ */
|
|
2158
|
-
/* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */
|
|
2458
|
+
}, [u, e, c, r]);
|
|
2459
|
+
return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-card", children: [
|
|
2460
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Apply coupon" }),
|
|
2461
|
+
p && /* @__PURE__ */ s("div", { className: "ss-global-error", children: p }),
|
|
2462
|
+
b && /* @__PURE__ */ s("div", { className: "ss-success-msg", children: b }),
|
|
2463
|
+
/* @__PURE__ */ n("form", { onSubmit: v, children: [
|
|
2464
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
2465
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-coupon-code", children: "Coupon code" }),
|
|
2466
|
+
/* @__PURE__ */ s(
|
|
2161
2467
|
"input",
|
|
2162
2468
|
{
|
|
2163
2469
|
id: "ss-coupon-code",
|
|
2164
2470
|
className: "ss-input",
|
|
2165
2471
|
type: "text",
|
|
2166
2472
|
placeholder: "Enter coupon code",
|
|
2167
|
-
value:
|
|
2168
|
-
onChange: (
|
|
2473
|
+
value: c,
|
|
2474
|
+
onChange: (C) => d(C.target.value),
|
|
2169
2475
|
required: !0
|
|
2170
2476
|
}
|
|
2171
2477
|
)
|
|
2172
2478
|
] }),
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
|
|
2479
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: l || !c.trim(), children: [
|
|
2480
|
+
l && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2175
2481
|
"Apply"
|
|
2176
2482
|
] })
|
|
2177
2483
|
] })
|
|
2178
2484
|
] }) });
|
|
2179
2485
|
}
|
|
2180
|
-
function
|
|
2181
|
-
const { client:
|
|
2182
|
-
return { report:
|
|
2486
|
+
function is() {
|
|
2487
|
+
const { client: e } = L();
|
|
2488
|
+
return { report: e.report };
|
|
2183
2489
|
}
|
|
2184
|
-
function
|
|
2185
|
-
const { client:
|
|
2186
|
-
t(!0),
|
|
2490
|
+
function ie() {
|
|
2491
|
+
const { client: e } = L(), [a, r] = m(null), [o, t] = m(!1), [u, i] = m(null), c = N(async (d) => {
|
|
2492
|
+
t(!0), i(null);
|
|
2187
2493
|
try {
|
|
2188
|
-
const
|
|
2189
|
-
return r(
|
|
2190
|
-
} catch (
|
|
2191
|
-
return
|
|
2494
|
+
const l = await e.report.executeQuery(d);
|
|
2495
|
+
return r(l), l;
|
|
2496
|
+
} catch (l) {
|
|
2497
|
+
return i(l instanceof Error ? l.message : "Query failed"), null;
|
|
2192
2498
|
} finally {
|
|
2193
2499
|
t(!1);
|
|
2194
2500
|
}
|
|
2195
|
-
}, [
|
|
2196
|
-
return { result: a, execute:
|
|
2501
|
+
}, [e]);
|
|
2502
|
+
return { result: a, execute: c, isLoading: o, error: u };
|
|
2197
2503
|
}
|
|
2198
|
-
function
|
|
2199
|
-
const { client: a } =
|
|
2200
|
-
|
|
2504
|
+
function qe(e) {
|
|
2505
|
+
const { client: a } = L(), [r, o] = m(null), [t, u] = m(!0), [i, c] = m(null), d = N(async () => {
|
|
2506
|
+
u(!0), c(null);
|
|
2201
2507
|
try {
|
|
2202
|
-
const
|
|
2203
|
-
|
|
2204
|
-
} catch (
|
|
2205
|
-
|
|
2508
|
+
const l = await a.report.listQueries(e);
|
|
2509
|
+
o(l);
|
|
2510
|
+
} catch (l) {
|
|
2511
|
+
c(l instanceof Error ? l.message : "Failed to load queries");
|
|
2206
2512
|
} finally {
|
|
2207
|
-
|
|
2513
|
+
u(!1);
|
|
2208
2514
|
}
|
|
2209
|
-
}, [a,
|
|
2210
|
-
return
|
|
2211
|
-
|
|
2212
|
-
}, [
|
|
2515
|
+
}, [a, e]);
|
|
2516
|
+
return U(() => {
|
|
2517
|
+
d();
|
|
2518
|
+
}, [d]), { queries: (r == null ? void 0 : r.data) ?? [], meta: r == null ? void 0 : r.meta, isLoading: t, error: i, refresh: d };
|
|
2213
2519
|
}
|
|
2214
|
-
function
|
|
2215
|
-
const { client: a } =
|
|
2216
|
-
|
|
2520
|
+
function cs(e) {
|
|
2521
|
+
const { client: a } = L(), [r, o] = m(null), [t, u] = m(!0), [i, c] = m(null), d = N(async () => {
|
|
2522
|
+
u(!0), c(null);
|
|
2217
2523
|
try {
|
|
2218
|
-
const
|
|
2219
|
-
|
|
2220
|
-
} catch (
|
|
2221
|
-
|
|
2524
|
+
const l = await a.report.getDashboard(e);
|
|
2525
|
+
o(l);
|
|
2526
|
+
} catch (l) {
|
|
2527
|
+
c(l instanceof Error ? l.message : "Failed to load dashboard");
|
|
2222
2528
|
} finally {
|
|
2223
|
-
|
|
2529
|
+
u(!1);
|
|
2224
2530
|
}
|
|
2225
|
-
}, [a,
|
|
2226
|
-
return
|
|
2227
|
-
|
|
2228
|
-
}, [
|
|
2531
|
+
}, [a, e]);
|
|
2532
|
+
return U(() => {
|
|
2533
|
+
d();
|
|
2534
|
+
}, [d]), { dashboard: r, isLoading: t, error: i, refresh: d };
|
|
2229
2535
|
}
|
|
2230
|
-
function
|
|
2231
|
-
const
|
|
2232
|
-
const p = new
|
|
2233
|
-
return new
|
|
2234
|
-
}, [
|
|
2235
|
-
|
|
2536
|
+
function ds(e, a, r = "https://api.saas-support.com/v1") {
|
|
2537
|
+
const o = _(() => {
|
|
2538
|
+
const p = new J(r, { type: "embedToken", token: e });
|
|
2539
|
+
return new K(p);
|
|
2540
|
+
}, [e, r]), [t, u] = m(null), [i, c] = m(!0), [d, l] = m(null), g = N(async () => {
|
|
2541
|
+
c(!0), l(null);
|
|
2236
2542
|
try {
|
|
2237
|
-
const p = await
|
|
2238
|
-
|
|
2543
|
+
const p = await o.getDashboard(a);
|
|
2544
|
+
u(p);
|
|
2239
2545
|
} catch (p) {
|
|
2240
|
-
|
|
2546
|
+
l(p instanceof Error ? p.message : "Failed to load dashboard");
|
|
2241
2547
|
} finally {
|
|
2242
|
-
|
|
2548
|
+
c(!1);
|
|
2243
2549
|
}
|
|
2244
|
-
}, [
|
|
2245
|
-
return
|
|
2246
|
-
|
|
2247
|
-
}, [
|
|
2550
|
+
}, [o, a]);
|
|
2551
|
+
return U(() => {
|
|
2552
|
+
g();
|
|
2553
|
+
}, [g]), { dashboard: t, reportClient: o, isLoading: i, error: d, refresh: g };
|
|
2248
2554
|
}
|
|
2249
|
-
function
|
|
2250
|
-
const { appearance: t } =
|
|
2251
|
-
if (
|
|
2252
|
-
const
|
|
2253
|
-
|
|
2254
|
-
}, [
|
|
2255
|
-
return /* @__PURE__ */
|
|
2256
|
-
a === "both" && /* @__PURE__ */
|
|
2257
|
-
/* @__PURE__ */
|
|
2555
|
+
function us({ onResult: e, mode: a = "both", placeholder: r, appearance: o }) {
|
|
2556
|
+
const { appearance: t } = L(), { execute: u, isLoading: i, error: c } = ie(), d = o ?? t, [l, g] = m(""), [p, f] = m(a === "sql" ? "sql" : "nl"), b = N(async (k) => {
|
|
2557
|
+
if (k.preventDefault(), !l.trim()) return;
|
|
2558
|
+
const C = await u(p === "sql" ? { sql: l } : { naturalLanguage: l });
|
|
2559
|
+
C && (e == null || e(C));
|
|
2560
|
+
}, [l, p, u, e]);
|
|
2561
|
+
return /* @__PURE__ */ s(q, { appearance: d, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
|
|
2562
|
+
a === "both" && /* @__PURE__ */ n("div", { className: "ss-tab-group ss-tab-group-sm", children: [
|
|
2563
|
+
/* @__PURE__ */ s(
|
|
2258
2564
|
"button",
|
|
2259
2565
|
{
|
|
2260
2566
|
type: "button",
|
|
2261
2567
|
className: `ss-tab ${p === "nl" ? "ss-tab-active" : ""}`,
|
|
2262
|
-
onClick: () =>
|
|
2568
|
+
onClick: () => f("nl"),
|
|
2263
2569
|
children: "Natural Language"
|
|
2264
2570
|
}
|
|
2265
2571
|
),
|
|
2266
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ s(
|
|
2267
2573
|
"button",
|
|
2268
2574
|
{
|
|
2269
2575
|
type: "button",
|
|
2270
2576
|
className: `ss-tab ${p === "sql" ? "ss-tab-active" : ""}`,
|
|
2271
|
-
onClick: () =>
|
|
2577
|
+
onClick: () => f("sql"),
|
|
2272
2578
|
children: "SQL"
|
|
2273
2579
|
}
|
|
2274
2580
|
)
|
|
2275
2581
|
] }),
|
|
2276
|
-
|
|
2277
|
-
/* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
2582
|
+
c && /* @__PURE__ */ s("div", { className: "ss-global-error", children: c }),
|
|
2583
|
+
/* @__PURE__ */ n("form", { onSubmit: b, children: [
|
|
2584
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
2279
2585
|
"textarea",
|
|
2280
2586
|
{
|
|
2281
2587
|
className: "ss-input ss-query-textarea",
|
|
2282
2588
|
placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
|
|
2283
|
-
value:
|
|
2284
|
-
onChange: (
|
|
2589
|
+
value: l,
|
|
2590
|
+
onChange: (k) => g(k.target.value),
|
|
2285
2591
|
rows: 3
|
|
2286
2592
|
}
|
|
2287
2593
|
) }),
|
|
2288
|
-
/* @__PURE__ */
|
|
2289
|
-
|
|
2594
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i || !l.trim(), children: [
|
|
2595
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2290
2596
|
"Run query"
|
|
2291
2597
|
] })
|
|
2292
2598
|
] })
|
|
2293
2599
|
] }) });
|
|
2294
2600
|
}
|
|
2295
|
-
function
|
|
2296
|
-
const { appearance:
|
|
2297
|
-
const
|
|
2298
|
-
if (
|
|
2299
|
-
if (
|
|
2300
|
-
if (
|
|
2301
|
-
if (typeof
|
|
2302
|
-
return
|
|
2303
|
-
const
|
|
2304
|
-
return
|
|
2305
|
-
}) : a, [a,
|
|
2306
|
-
r && (
|
|
2601
|
+
function Re({ columns: e, rows: a, sortable: r = !0, maxRows: o, appearance: t }) {
|
|
2602
|
+
const { appearance: u } = L(), i = t ?? u, [c, d] = m(null), [l, g] = m("asc"), p = _(() => c ? [...a].sort((v, C) => {
|
|
2603
|
+
const x = v[c], h = C[c];
|
|
2604
|
+
if (x == null && h == null) return 0;
|
|
2605
|
+
if (x == null) return 1;
|
|
2606
|
+
if (h == null) return -1;
|
|
2607
|
+
if (typeof x == "number" && typeof h == "number")
|
|
2608
|
+
return l === "asc" ? x - h : h - x;
|
|
2609
|
+
const S = String(x), z = String(h);
|
|
2610
|
+
return l === "asc" ? S.localeCompare(z) : z.localeCompare(S);
|
|
2611
|
+
}) : a, [a, c, l]), f = o ? p.slice(0, o) : p, b = (v) => {
|
|
2612
|
+
r && (c === v ? g((C) => C === "asc" ? "desc" : "asc") : (d(v), g("asc")));
|
|
2307
2613
|
};
|
|
2308
|
-
function
|
|
2309
|
-
return
|
|
2614
|
+
function k(v) {
|
|
2615
|
+
return v == null ? "" : typeof v == "object" ? JSON.stringify(v) : String(v);
|
|
2310
2616
|
}
|
|
2311
|
-
return /* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2617
|
+
return /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-table-container", children: [
|
|
2618
|
+
/* @__PURE__ */ n("table", { className: "ss-table", children: [
|
|
2619
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: e.map((v) => /* @__PURE__ */ n(
|
|
2314
2620
|
"th",
|
|
2315
2621
|
{
|
|
2316
|
-
className: `ss-th ${r ? "ss-th-sortable" : ""} ${
|
|
2317
|
-
onClick: () =>
|
|
2622
|
+
className: `ss-th ${r ? "ss-th-sortable" : ""} ${c === v ? l === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
|
|
2623
|
+
onClick: () => b(v),
|
|
2318
2624
|
children: [
|
|
2319
|
-
|
|
2320
|
-
|
|
2625
|
+
v,
|
|
2626
|
+
c === v && /* @__PURE__ */ s("span", { className: "ss-sort-indicator", children: l === "asc" ? " ▲" : " ▼" })
|
|
2321
2627
|
]
|
|
2322
2628
|
},
|
|
2323
|
-
|
|
2629
|
+
v
|
|
2324
2630
|
)) }) }),
|
|
2325
|
-
/* @__PURE__ */
|
|
2631
|
+
/* @__PURE__ */ s("tbody", { children: f.map((v, C) => /* @__PURE__ */ s("tr", { className: "ss-tr", children: e.map((x) => /* @__PURE__ */ s("td", { className: "ss-td", children: k(v[x]) }, x)) }, C)) })
|
|
2326
2632
|
] }),
|
|
2327
|
-
|
|
2633
|
+
o && a.length > o && /* @__PURE__ */ n("div", { className: "ss-table-footer", children: [
|
|
2328
2634
|
"Showing ",
|
|
2329
|
-
|
|
2635
|
+
o,
|
|
2330
2636
|
" of ",
|
|
2331
2637
|
a.length,
|
|
2332
2638
|
" rows"
|
|
2333
2639
|
] })
|
|
2334
2640
|
] }) });
|
|
2335
2641
|
}
|
|
2336
|
-
function
|
|
2337
|
-
const r = parseInt(a.replace("#", "").slice(0, 2), 16),
|
|
2338
|
-
for (let t = 0; t <
|
|
2339
|
-
const
|
|
2340
|
-
|
|
2642
|
+
function Oe(e, a = "#6366f1") {
|
|
2643
|
+
const r = parseInt(a.replace("#", "").slice(0, 2), 16), o = [];
|
|
2644
|
+
for (let t = 0; t < e; t++) {
|
|
2645
|
+
const u = (r + t * Math.floor(360 / Math.max(e, 1))) % 360;
|
|
2646
|
+
o.push(`hsl(${u}, 65%, 55%)`);
|
|
2341
2647
|
}
|
|
2342
|
-
return
|
|
2648
|
+
return o;
|
|
2343
2649
|
}
|
|
2344
|
-
function
|
|
2345
|
-
const
|
|
2346
|
-
return /* @__PURE__ */
|
|
2347
|
-
/* @__PURE__ */
|
|
2348
|
-
a.map((
|
|
2349
|
-
const
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2352
|
-
/* @__PURE__ */
|
|
2650
|
+
function We({ labels: e, values: a, w: r, h: o, colors: t }) {
|
|
2651
|
+
const u = Math.max(...a, 1), i = 40, c = r - i * 2, d = o - i * 2, l = Math.max(1, c / e.length - 4);
|
|
2652
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2653
|
+
/* @__PURE__ */ s("line", { x1: i, y1: o - i, x2: r - i, y2: o - i, stroke: "#ccc", strokeWidth: 1 }),
|
|
2654
|
+
a.map((g, p) => {
|
|
2655
|
+
const f = g / u * d, b = i + c / e.length * p + 2, k = o - i - f;
|
|
2656
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2657
|
+
/* @__PURE__ */ s("rect", { x: b, y: k, width: l, height: f, fill: t[p % t.length], rx: 2 }),
|
|
2658
|
+
/* @__PURE__ */ s("text", { x: b + l / 2, y: o - i + 14, textAnchor: "middle", fontSize: 10, fill: "#666", children: e[p].length > 8 ? e[p].slice(0, 8) + "..." : e[p] })
|
|
2353
2659
|
] }, p);
|
|
2354
2660
|
})
|
|
2355
2661
|
] });
|
|
2356
2662
|
}
|
|
2357
|
-
function
|
|
2358
|
-
const
|
|
2359
|
-
const
|
|
2360
|
-
return `${
|
|
2663
|
+
function He({ labels: e, values: a, w: r, h: o, colors: t }) {
|
|
2664
|
+
const u = Math.max(...a, 1), i = 40, c = r - i * 2, d = o - i * 2, l = e.length > 1 ? c / (e.length - 1) : 0, g = a.map((p, f) => {
|
|
2665
|
+
const b = i + l * f, k = o - i - p / u * d;
|
|
2666
|
+
return `${b},${k}`;
|
|
2361
2667
|
});
|
|
2362
|
-
return /* @__PURE__ */
|
|
2668
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2363
2669
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
2364
|
-
const
|
|
2365
|
-
return /* @__PURE__ */
|
|
2670
|
+
const f = o - i - p * d;
|
|
2671
|
+
return /* @__PURE__ */ s("line", { x1: i, y1: f, x2: r - i, y2: f, stroke: "#eee", strokeWidth: 1 }, p);
|
|
2366
2672
|
}),
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
a.map((p,
|
|
2369
|
-
const
|
|
2370
|
-
return /* @__PURE__ */
|
|
2673
|
+
/* @__PURE__ */ s("polyline", { points: g.join(" "), fill: "none", stroke: t[0], strokeWidth: 2 }),
|
|
2674
|
+
a.map((p, f) => {
|
|
2675
|
+
const b = i + l * f, k = o - i - p / u * d;
|
|
2676
|
+
return /* @__PURE__ */ s("circle", { cx: b, cy: k, r: 4, fill: t[0] }, f);
|
|
2371
2677
|
})
|
|
2372
2678
|
] });
|
|
2373
2679
|
}
|
|
2374
|
-
function
|
|
2375
|
-
const
|
|
2376
|
-
let
|
|
2377
|
-
const p = a.map((
|
|
2378
|
-
const
|
|
2379
|
-
return
|
|
2680
|
+
function _e({ labels: e, values: a, w: r, h: o, colors: t }) {
|
|
2681
|
+
const u = a.reduce((f, b) => f + b, 0) || 1, i = r / 2, c = o / 2 - 20, d = Math.min(r, o) / 2 - 40, l = 2 * Math.PI * d;
|
|
2682
|
+
let g = 0;
|
|
2683
|
+
const p = a.map((f, b) => {
|
|
2684
|
+
const k = f / u, v = k * l, C = { dash: v, offset: g, color: t[b % t.length], label: e[b], pct: k };
|
|
2685
|
+
return g += v, C;
|
|
2380
2686
|
});
|
|
2381
|
-
return /* @__PURE__ */
|
|
2382
|
-
p.map((
|
|
2687
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2688
|
+
p.map((f, b) => /* @__PURE__ */ s(
|
|
2383
2689
|
"circle",
|
|
2384
2690
|
{
|
|
2385
|
-
cx:
|
|
2386
|
-
cy:
|
|
2387
|
-
r:
|
|
2691
|
+
cx: i,
|
|
2692
|
+
cy: c,
|
|
2693
|
+
r: d,
|
|
2388
2694
|
fill: "none",
|
|
2389
|
-
stroke:
|
|
2390
|
-
strokeWidth:
|
|
2391
|
-
strokeDasharray: `${
|
|
2392
|
-
strokeDashoffset: -
|
|
2393
|
-
transform: `rotate(-90 ${
|
|
2695
|
+
stroke: f.color,
|
|
2696
|
+
strokeWidth: d * 0.6,
|
|
2697
|
+
strokeDasharray: `${f.dash} ${l - f.dash}`,
|
|
2698
|
+
strokeDashoffset: -f.offset,
|
|
2699
|
+
transform: `rotate(-90 ${i} ${c})`
|
|
2394
2700
|
},
|
|
2395
|
-
|
|
2701
|
+
b
|
|
2396
2702
|
)),
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
] },
|
|
2703
|
+
/* @__PURE__ */ s("g", { transform: `translate(${i - e.length * 30}, ${o - 20})`, children: p.slice(0, 6).map((f, b) => /* @__PURE__ */ n("g", { transform: `translate(${b * 60}, 0)`, children: [
|
|
2704
|
+
/* @__PURE__ */ s("rect", { width: 10, height: 10, fill: f.color, rx: 2 }),
|
|
2705
|
+
/* @__PURE__ */ s("text", { x: 14, y: 9, fontSize: 9, fill: "#666", children: f.label.length > 6 ? f.label.slice(0, 6) + ".." : f.label })
|
|
2706
|
+
] }, b)) })
|
|
2401
2707
|
] });
|
|
2402
2708
|
}
|
|
2403
|
-
function
|
|
2404
|
-
const { appearance:
|
|
2405
|
-
return /* @__PURE__ */
|
|
2406
|
-
r && /* @__PURE__ */
|
|
2407
|
-
/* @__PURE__ */
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2709
|
+
function je({ type: e, data: a, title: r, width: o = 400, height: t = 300, appearance: u }) {
|
|
2710
|
+
const { appearance: i } = L(), c = u ?? i, d = _(() => Oe(a.labels.length), [a.labels.length]);
|
|
2711
|
+
return /* @__PURE__ */ s(q, { appearance: c, children: /* @__PURE__ */ n("div", { className: "ss-chart-container", children: [
|
|
2712
|
+
r && /* @__PURE__ */ s("h3", { className: "ss-chart-title", children: r }),
|
|
2713
|
+
/* @__PURE__ */ n("svg", { viewBox: `0 0 ${o} ${t}`, width: "100%", style: { maxWidth: o }, children: [
|
|
2714
|
+
e === "bar" && /* @__PURE__ */ s(We, { labels: a.labels, values: a.values, w: o, h: t, colors: d }),
|
|
2715
|
+
e === "line" && /* @__PURE__ */ s(He, { labels: a.labels, values: a.values, w: o, h: t, colors: d }),
|
|
2716
|
+
e === "pie" && /* @__PURE__ */ s(_e, { labels: a.labels, values: a.values, w: o, h: t, colors: d })
|
|
2411
2717
|
] })
|
|
2412
2718
|
] }) });
|
|
2413
2719
|
}
|
|
2414
|
-
function
|
|
2415
|
-
const
|
|
2720
|
+
function ps({ dashboardId: e, embedToken: a, baseUrl: r, refreshInterval: o, appearance: t }) {
|
|
2721
|
+
const u = L(), i = t ?? (u == null ? void 0 : u.appearance), c = _(() => {
|
|
2416
2722
|
if (a) {
|
|
2417
|
-
const
|
|
2418
|
-
return new
|
|
2723
|
+
const x = r ?? "https://api.saas-support.com/v1", h = new J(x, { type: "embedToken", token: a });
|
|
2724
|
+
return new K(h);
|
|
2419
2725
|
}
|
|
2420
|
-
return
|
|
2421
|
-
}, [a, r,
|
|
2422
|
-
|
|
2726
|
+
return u.client.report;
|
|
2727
|
+
}, [a, r, u]), [d, l] = m([]), [g, p] = m({}), [f, b] = m(!0), [k, v] = m(null), C = N(async () => {
|
|
2728
|
+
b(!0), v(null);
|
|
2423
2729
|
try {
|
|
2424
|
-
const
|
|
2425
|
-
|
|
2426
|
-
const
|
|
2427
|
-
for (const
|
|
2730
|
+
const x = await c.getDashboard(e), h = JSON.parse(x.layoutJson || "[]");
|
|
2731
|
+
l(h);
|
|
2732
|
+
const S = {};
|
|
2733
|
+
for (const z of h)
|
|
2428
2734
|
try {
|
|
2429
|
-
const
|
|
2430
|
-
if (
|
|
2431
|
-
const
|
|
2432
|
-
|
|
2735
|
+
const P = await c.listQueries({ search: z.queryId, perPage: 1 });
|
|
2736
|
+
if (P.data.length > 0 && P.data[0].generatedSql) {
|
|
2737
|
+
const I = await c.executeQuery({ sql: P.data[0].generatedSql });
|
|
2738
|
+
S[z.queryId] = I;
|
|
2433
2739
|
}
|
|
2434
2740
|
} catch {
|
|
2435
2741
|
}
|
|
2436
|
-
p(
|
|
2437
|
-
} catch (
|
|
2438
|
-
|
|
2742
|
+
p(S);
|
|
2743
|
+
} catch (x) {
|
|
2744
|
+
v(x instanceof Error ? x.message : "Failed to load dashboard");
|
|
2439
2745
|
} finally {
|
|
2440
|
-
|
|
2441
|
-
}
|
|
2442
|
-
}, [
|
|
2443
|
-
return
|
|
2444
|
-
|
|
2445
|
-
}, [
|
|
2446
|
-
if (!
|
|
2447
|
-
const
|
|
2448
|
-
return () => clearInterval(
|
|
2449
|
-
}, [
|
|
2450
|
-
|
|
2451
|
-
/* @__PURE__ */
|
|
2746
|
+
b(!1);
|
|
2747
|
+
}
|
|
2748
|
+
}, [c, e]);
|
|
2749
|
+
return U(() => {
|
|
2750
|
+
C();
|
|
2751
|
+
}, [C]), U(() => {
|
|
2752
|
+
if (!o || o <= 0) return;
|
|
2753
|
+
const x = setInterval(C, o * 1e3);
|
|
2754
|
+
return () => clearInterval(x);
|
|
2755
|
+
}, [o, C]), /* @__PURE__ */ s(q, { appearance: i, children: /* @__PURE__ */ n("div", { className: "ss-dashboard-grid", children: [
|
|
2756
|
+
f && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
|
|
2757
|
+
/* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2452
2758
|
" Loading dashboard..."
|
|
2453
2759
|
] }),
|
|
2454
|
-
|
|
2455
|
-
!
|
|
2456
|
-
const
|
|
2457
|
-
if (!
|
|
2458
|
-
const
|
|
2459
|
-
labels:
|
|
2460
|
-
values:
|
|
2760
|
+
k && /* @__PURE__ */ s("div", { className: "ss-global-error", children: k }),
|
|
2761
|
+
!f && d.map((x, h) => {
|
|
2762
|
+
const S = g[x.queryId];
|
|
2763
|
+
if (!S) return null;
|
|
2764
|
+
const z = S.columns.length >= 2 ? {
|
|
2765
|
+
labels: S.rows.map((P) => String(P[S.columns[0]] ?? "")),
|
|
2766
|
+
values: S.rows.map((P) => Number(P[S.columns[1]] ?? 0))
|
|
2461
2767
|
} : { labels: [], values: [] };
|
|
2462
|
-
return /* @__PURE__ */
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2768
|
+
return /* @__PURE__ */ n("div", { className: "ss-widget", children: [
|
|
2769
|
+
x.title && /* @__PURE__ */ s("h4", { className: "ss-widget-header", children: x.title }),
|
|
2770
|
+
x.chartType === "table" ? /* @__PURE__ */ s(Re, { columns: S.columns, rows: S.rows, maxRows: 50 }) : /* @__PURE__ */ s(
|
|
2771
|
+
je,
|
|
2466
2772
|
{
|
|
2467
|
-
type:
|
|
2468
|
-
data:
|
|
2469
|
-
width:
|
|
2470
|
-
height:
|
|
2773
|
+
type: x.chartType || "bar",
|
|
2774
|
+
data: z,
|
|
2775
|
+
width: x.w,
|
|
2776
|
+
height: x.h
|
|
2471
2777
|
}
|
|
2472
2778
|
)
|
|
2473
|
-
] },
|
|
2779
|
+
] }, h);
|
|
2474
2780
|
})
|
|
2475
2781
|
] }) });
|
|
2476
2782
|
}
|
|
2477
|
-
function
|
|
2478
|
-
return new Date(
|
|
2783
|
+
function Ve(e) {
|
|
2784
|
+
return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
2479
2785
|
}
|
|
2480
|
-
function
|
|
2481
|
-
const { appearance:
|
|
2786
|
+
function ms({ onSelectQuery: e, onRunQuery: a, appearance: r }) {
|
|
2787
|
+
const { appearance: o } = L(), { queries: t, isLoading: u, error: i } = qe(), { execute: c, isLoading: d } = ie(), l = r ?? o, g = N(async (p) => {
|
|
2482
2788
|
if (!p.generatedSql) return;
|
|
2483
|
-
const
|
|
2484
|
-
|
|
2485
|
-
}, [
|
|
2486
|
-
return /* @__PURE__ */
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
|
|
2489
|
-
/* @__PURE__ */
|
|
2789
|
+
const f = await c({ sql: p.generatedSql });
|
|
2790
|
+
f && (a == null || a(f));
|
|
2791
|
+
}, [c, a]);
|
|
2792
|
+
return /* @__PURE__ */ s(q, { appearance: l, children: /* @__PURE__ */ n("div", { className: "ss-card ss-card-wide", children: [
|
|
2793
|
+
/* @__PURE__ */ s("h2", { className: "ss-title", children: "Saved Queries" }),
|
|
2794
|
+
u && /* @__PURE__ */ n("div", { className: "ss-loading", children: [
|
|
2795
|
+
/* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
2490
2796
|
" Loading..."
|
|
2491
2797
|
] }),
|
|
2492
|
-
|
|
2493
|
-
!
|
|
2494
|
-
!
|
|
2798
|
+
i && /* @__PURE__ */ s("div", { className: "ss-global-error", children: i }),
|
|
2799
|
+
!u && t.length === 0 && /* @__PURE__ */ s("p", { className: "ss-empty", children: "No saved queries." }),
|
|
2800
|
+
!u && t.map((p) => /* @__PURE__ */ n(
|
|
2495
2801
|
"div",
|
|
2496
2802
|
{
|
|
2497
2803
|
className: "ss-saved-query-card",
|
|
2498
|
-
onClick: () =>
|
|
2804
|
+
onClick: () => e == null ? void 0 : e(p),
|
|
2499
2805
|
children: [
|
|
2500
|
-
/* @__PURE__ */
|
|
2501
|
-
/* @__PURE__ */
|
|
2502
|
-
p.chartType && /* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ n("div", { className: "ss-saved-query-header", children: [
|
|
2807
|
+
/* @__PURE__ */ s("span", { className: "ss-saved-query-name", children: p.name }),
|
|
2808
|
+
p.chartType && /* @__PURE__ */ s("span", { className: "ss-badge", children: p.chartType })
|
|
2503
2809
|
] }),
|
|
2504
|
-
p.naturalLanguage && /* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2810
|
+
p.naturalLanguage && /* @__PURE__ */ s("p", { className: "ss-saved-query-desc", children: p.naturalLanguage }),
|
|
2811
|
+
/* @__PURE__ */ n("div", { className: "ss-saved-query-footer", children: [
|
|
2812
|
+
/* @__PURE__ */ s("span", { className: "ss-saved-query-date", children: Ve(p.createdAt) }),
|
|
2813
|
+
/* @__PURE__ */ s(
|
|
2508
2814
|
"button",
|
|
2509
2815
|
{
|
|
2510
2816
|
type: "button",
|
|
2511
2817
|
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
2512
|
-
disabled:
|
|
2513
|
-
onClick: (
|
|
2514
|
-
|
|
2818
|
+
disabled: d || !p.generatedSql,
|
|
2819
|
+
onClick: (f) => {
|
|
2820
|
+
f.stopPropagation(), g(p);
|
|
2515
2821
|
},
|
|
2516
|
-
children:
|
|
2822
|
+
children: d ? /* @__PURE__ */ s("span", { className: "ss-spinner" }) : "Run"
|
|
2517
2823
|
}
|
|
2518
2824
|
)
|
|
2519
2825
|
] })
|
|
@@ -2523,105 +2829,106 @@ function re({ onSelectQuery: s, onRunQuery: a, appearance: r }) {
|
|
|
2523
2829
|
))
|
|
2524
2830
|
] }) });
|
|
2525
2831
|
}
|
|
2526
|
-
function
|
|
2527
|
-
const
|
|
2528
|
-
const
|
|
2529
|
-
return new
|
|
2530
|
-
}, [
|
|
2531
|
-
|
|
2832
|
+
function gs({ embedToken: e, dashboardId: a, baseUrl: r = "https://api.saas-support.com/v1", refreshInterval: o, appearance: t }) {
|
|
2833
|
+
const u = _(() => {
|
|
2834
|
+
const v = new J(r, { type: "embedToken", token: e });
|
|
2835
|
+
return new K(v);
|
|
2836
|
+
}, [e, r]), [i, c] = m([]), [d, l] = m(!0), [g, p] = m(null), f = _(() => Z(t), [t]), b = _(() => X(f), [f]), k = N(async () => {
|
|
2837
|
+
l(!0), p(null);
|
|
2532
2838
|
try {
|
|
2533
|
-
const
|
|
2534
|
-
|
|
2839
|
+
const v = await u.getDashboard(a), C = JSON.parse(v.layoutJson || "[]"), x = await Promise.all(
|
|
2840
|
+
C.map(async (h) => {
|
|
2535
2841
|
try {
|
|
2536
|
-
const
|
|
2537
|
-
if (
|
|
2538
|
-
const
|
|
2539
|
-
return { ...
|
|
2842
|
+
const S = await u.listQueries({ search: h.queryId, perPage: 1 });
|
|
2843
|
+
if (S.data.length > 0 && S.data[0].generatedSql) {
|
|
2844
|
+
const z = await u.executeQuery({ sql: S.data[0].generatedSql });
|
|
2845
|
+
return { ...h, result: z };
|
|
2540
2846
|
}
|
|
2541
2847
|
} catch {
|
|
2542
2848
|
}
|
|
2543
|
-
return
|
|
2849
|
+
return h;
|
|
2544
2850
|
})
|
|
2545
2851
|
);
|
|
2546
|
-
|
|
2547
|
-
} catch (
|
|
2548
|
-
p(
|
|
2852
|
+
c(x);
|
|
2853
|
+
} catch (v) {
|
|
2854
|
+
p(v instanceof Error ? v.message : "Failed to load dashboard");
|
|
2549
2855
|
} finally {
|
|
2550
|
-
|
|
2551
|
-
}
|
|
2552
|
-
}, [
|
|
2553
|
-
return
|
|
2554
|
-
|
|
2555
|
-
}, [
|
|
2556
|
-
if (!
|
|
2557
|
-
const
|
|
2558
|
-
return () => clearInterval(
|
|
2559
|
-
}, [
|
|
2856
|
+
l(!1);
|
|
2857
|
+
}
|
|
2858
|
+
}, [u, a]);
|
|
2859
|
+
return U(() => {
|
|
2860
|
+
k();
|
|
2861
|
+
}, [k]), U(() => {
|
|
2862
|
+
if (!o || o <= 0) return;
|
|
2863
|
+
const v = setInterval(k, o * 1e3);
|
|
2864
|
+
return () => clearInterval(v);
|
|
2865
|
+
}, [o, k]), /* @__PURE__ */ s(
|
|
2560
2866
|
"div",
|
|
2561
2867
|
{
|
|
2562
|
-
ref: (
|
|
2563
|
-
if (!
|
|
2564
|
-
const
|
|
2565
|
-
|
|
2566
|
-
const
|
|
2567
|
-
|
|
2868
|
+
ref: (v) => {
|
|
2869
|
+
if (!v || v.shadowRoot) return;
|
|
2870
|
+
const C = v.attachShadow({ mode: "open" }), x = document.createElement("style");
|
|
2871
|
+
x.textContent = b, C.appendChild(x);
|
|
2872
|
+
const h = document.createElement("div");
|
|
2873
|
+
C.appendChild(h);
|
|
2568
2874
|
},
|
|
2569
2875
|
style: { display: "contents" },
|
|
2570
|
-
children: /* @__PURE__ */
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
!
|
|
2574
|
-
if (!
|
|
2575
|
-
const { columns:
|
|
2576
|
-
return /* @__PURE__ */
|
|
2577
|
-
|
|
2578
|
-
/* @__PURE__ */
|
|
2579
|
-
/* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2876
|
+
children: /* @__PURE__ */ n("div", { className: "ss-dashboard-grid", children: [
|
|
2877
|
+
d && /* @__PURE__ */ s("div", { className: "ss-loading", children: "Loading dashboard..." }),
|
|
2878
|
+
g && /* @__PURE__ */ s("div", { className: "ss-global-error", children: g }),
|
|
2879
|
+
!d && i.map((v, C) => {
|
|
2880
|
+
if (!v.result) return null;
|
|
2881
|
+
const { columns: x, rows: h } = v.result;
|
|
2882
|
+
return /* @__PURE__ */ n("div", { className: "ss-widget", children: [
|
|
2883
|
+
v.title && /* @__PURE__ */ s("h4", { className: "ss-widget-header", children: v.title }),
|
|
2884
|
+
/* @__PURE__ */ n("table", { className: "ss-table", children: [
|
|
2885
|
+
/* @__PURE__ */ s("thead", { children: /* @__PURE__ */ s("tr", { children: x.map((S) => /* @__PURE__ */ s("th", { className: "ss-th", children: S }, S)) }) }),
|
|
2886
|
+
/* @__PURE__ */ s("tbody", { children: h.slice(0, 50).map((S, z) => /* @__PURE__ */ s("tr", { className: "ss-tr", children: x.map((P) => /* @__PURE__ */ s("td", { className: "ss-td", children: String(S[P] ?? "") }, P)) }, z)) })
|
|
2581
2887
|
] })
|
|
2582
|
-
] },
|
|
2888
|
+
] }, C);
|
|
2583
2889
|
})
|
|
2584
2890
|
] })
|
|
2585
2891
|
}
|
|
2586
2892
|
);
|
|
2587
2893
|
}
|
|
2588
2894
|
export {
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2895
|
+
je as Chart,
|
|
2896
|
+
ls as CouponInput,
|
|
2897
|
+
ps as DashboardView,
|
|
2898
|
+
Re as DataTable,
|
|
2899
|
+
Fe as InvoiceHistory,
|
|
2900
|
+
as as OrgSwitcher,
|
|
2901
|
+
os as PaymentPortal,
|
|
2902
|
+
ts as PricingTable,
|
|
2903
|
+
us as QueryInput,
|
|
2904
|
+
gs as ReportEmbed,
|
|
2905
|
+
se as SaaSContext,
|
|
2906
|
+
bs as SaaSError,
|
|
2907
|
+
Ze as SaaSProvider,
|
|
2908
|
+
fe as SaaSSupport,
|
|
2909
|
+
ms as SavedQueryList,
|
|
2910
|
+
Ke as SignIn,
|
|
2911
|
+
es as SignUp,
|
|
2912
|
+
Be as SubscriptionStatus,
|
|
2913
|
+
Ue as UsageDisplay,
|
|
2914
|
+
ss as UserButton,
|
|
2915
|
+
rs as UserProfile,
|
|
2916
|
+
be as isMfaRequired,
|
|
2917
|
+
ee as useAuth,
|
|
2918
|
+
ns as useBilling,
|
|
2919
|
+
cs as useDashboard,
|
|
2920
|
+
ke as useDeleteAccount,
|
|
2921
|
+
ds as useEmbedDashboard,
|
|
2922
|
+
Ie as useInvoices,
|
|
2923
|
+
ae as useOrg,
|
|
2924
|
+
te as useProfile,
|
|
2925
|
+
ie as useQuery,
|
|
2926
|
+
is as useReport,
|
|
2927
|
+
L as useSaaSContext,
|
|
2928
|
+
qe as useSavedQueries,
|
|
2929
|
+
re as useSignIn,
|
|
2930
|
+
Ce as useSignUp,
|
|
2931
|
+
ze as useSubscription,
|
|
2932
|
+
Te as useUsage,
|
|
2933
|
+
Xe as useUser
|
|
2627
2934
|
};
|