@saas-support/react 0.3.2 → 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 +19 -0
- package/dist/index.js +280 -236
- package/dist/react.cjs +128 -3
- package/dist/react.d.ts +53 -4
- package/dist/react.js +1632 -1021
- 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 rs = {
|
|
|
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 rs = {
|
|
|
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 U(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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 O(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;
|
|
@@ -773,6 +793,111 @@ function O(s) {
|
|
|
773
793
|
object-fit: cover;
|
|
774
794
|
}
|
|
775
795
|
|
|
796
|
+
/* Avatar hover overlay */
|
|
797
|
+
.ss-avatar-hoverable {
|
|
798
|
+
position: relative;
|
|
799
|
+
cursor: pointer;
|
|
800
|
+
transition: filter 0.15s;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
.ss-avatar-overlay {
|
|
804
|
+
position: absolute;
|
|
805
|
+
inset: 0;
|
|
806
|
+
border-radius: 50%;
|
|
807
|
+
background: rgba(0, 0, 0, 0.5);
|
|
808
|
+
display: flex;
|
|
809
|
+
align-items: center;
|
|
810
|
+
justify-content: center;
|
|
811
|
+
opacity: 0;
|
|
812
|
+
transition: opacity 0.15s;
|
|
813
|
+
color: #fff;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
.ss-avatar-hoverable:hover .ss-avatar-overlay {
|
|
817
|
+
opacity: 1;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/* Avatar cropper */
|
|
821
|
+
.ss-avatar-cropper {
|
|
822
|
+
display: flex;
|
|
823
|
+
flex-direction: column;
|
|
824
|
+
align-items: center;
|
|
825
|
+
gap: 16px;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.ss-avatar-canvas {
|
|
829
|
+
border-radius: ${e.borderRadius};
|
|
830
|
+
background: #111;
|
|
831
|
+
touch-action: none;
|
|
832
|
+
max-width: 100%;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
.ss-avatar-zoom {
|
|
836
|
+
display: flex;
|
|
837
|
+
align-items: center;
|
|
838
|
+
gap: 12px;
|
|
839
|
+
width: 100%;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
.ss-avatar-zoom-label {
|
|
843
|
+
font-size: 13px;
|
|
844
|
+
color: ${e.colorTextSecondary};
|
|
845
|
+
flex-shrink: 0;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
.ss-avatar-zoom-slider {
|
|
849
|
+
flex: 1;
|
|
850
|
+
height: 4px;
|
|
851
|
+
-webkit-appearance: none;
|
|
852
|
+
appearance: none;
|
|
853
|
+
background: ${e.colorInputBorder};
|
|
854
|
+
border-radius: 2px;
|
|
855
|
+
outline: none;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.ss-avatar-zoom-slider::-webkit-slider-thumb {
|
|
859
|
+
-webkit-appearance: none;
|
|
860
|
+
width: 16px;
|
|
861
|
+
height: 16px;
|
|
862
|
+
border-radius: 50%;
|
|
863
|
+
background: ${e.colorPrimary};
|
|
864
|
+
cursor: pointer;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
.ss-avatar-zoom-slider::-moz-range-thumb {
|
|
868
|
+
width: 16px;
|
|
869
|
+
height: 16px;
|
|
870
|
+
border-radius: 50%;
|
|
871
|
+
background: ${e.colorPrimary};
|
|
872
|
+
cursor: pointer;
|
|
873
|
+
border: none;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/* Dropzone */
|
|
877
|
+
.ss-avatar-dropzone {
|
|
878
|
+
border: 2px dashed ${e.colorInputBorder};
|
|
879
|
+
border-radius: ${e.borderRadius};
|
|
880
|
+
padding: 40px 24px;
|
|
881
|
+
text-align: center;
|
|
882
|
+
cursor: pointer;
|
|
883
|
+
transition: border-color 0.15s, background 0.15s;
|
|
884
|
+
color: ${e.colorTextSecondary};
|
|
885
|
+
display: flex;
|
|
886
|
+
flex-direction: column;
|
|
887
|
+
align-items: center;
|
|
888
|
+
gap: 12px;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.ss-avatar-dropzone:hover,
|
|
892
|
+
.ss-avatar-dropzone-active {
|
|
893
|
+
border-color: ${e.colorPrimary};
|
|
894
|
+
background: ${e.colorPrimary}08;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
.ss-avatar-dropzone svg {
|
|
898
|
+
opacity: 0.5;
|
|
899
|
+
}
|
|
900
|
+
|
|
776
901
|
.ss-input-readonly {
|
|
777
902
|
opacity: 0.6;
|
|
778
903
|
cursor: not-allowed;
|
|
@@ -782,7 +907,7 @@ function O(s) {
|
|
|
782
907
|
|
|
783
908
|
.ss-dropdown-divider {
|
|
784
909
|
height: 1px;
|
|
785
|
-
background: ${
|
|
910
|
+
background: ${e.colorInputBorder};
|
|
786
911
|
margin: 4px 0;
|
|
787
912
|
}
|
|
788
913
|
|
|
@@ -805,216 +930,335 @@ function O(s) {
|
|
|
805
930
|
}
|
|
806
931
|
`;
|
|
807
932
|
}
|
|
808
|
-
function
|
|
809
|
-
const r =
|
|
810
|
-
|
|
811
|
-
var
|
|
933
|
+
function q({ children: e, appearance: a }) {
|
|
934
|
+
const r = j(null), [o, t] = m(null);
|
|
935
|
+
U(() => {
|
|
936
|
+
var g;
|
|
812
937
|
if (!r.current || r.current.shadowRoot) {
|
|
813
|
-
t(((
|
|
938
|
+
t(((g = r.current) == null ? void 0 : g.shadowRoot) ?? null);
|
|
814
939
|
return;
|
|
815
940
|
}
|
|
816
|
-
const
|
|
817
|
-
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
}, []),
|
|
821
|
-
if (!
|
|
822
|
-
const
|
|
823
|
-
if (
|
|
824
|
-
const
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
}, [a,
|
|
828
|
-
const
|
|
829
|
-
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) });
|
|
830
955
|
}
|
|
831
|
-
function
|
|
832
|
-
const { client:
|
|
956
|
+
function ee() {
|
|
957
|
+
const { client: e, user: a, isLoaded: r } = L();
|
|
833
958
|
return {
|
|
834
959
|
isLoaded: r,
|
|
835
960
|
isSignedIn: !!a,
|
|
836
961
|
user: a,
|
|
837
|
-
signOut:
|
|
838
|
-
getToken:
|
|
962
|
+
signOut: N(() => e.auth.signOut(), [e]),
|
|
963
|
+
getToken: N(() => e.auth.getToken(), [e])
|
|
839
964
|
};
|
|
840
965
|
}
|
|
841
|
-
function
|
|
842
|
-
const { user:
|
|
843
|
-
return { user:
|
|
966
|
+
function Xe() {
|
|
967
|
+
const { user: e, isLoaded: a } = L();
|
|
968
|
+
return { user: e, isLoaded: a };
|
|
844
969
|
}
|
|
845
|
-
function
|
|
846
|
-
const { client:
|
|
847
|
-
async (
|
|
970
|
+
function re() {
|
|
971
|
+
const { client: e } = L(), [a, r] = m(!1), [o, t] = m(null), u = N(
|
|
972
|
+
async (d, l) => {
|
|
848
973
|
r(!0), t(null);
|
|
849
974
|
try {
|
|
850
|
-
return await
|
|
851
|
-
} catch (
|
|
852
|
-
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;
|
|
853
978
|
} finally {
|
|
854
979
|
r(!1);
|
|
855
980
|
}
|
|
856
981
|
},
|
|
857
|
-
[
|
|
858
|
-
),
|
|
859
|
-
async (
|
|
982
|
+
[e]
|
|
983
|
+
), i = N(
|
|
984
|
+
async (d) => {
|
|
860
985
|
r(!0), t(null);
|
|
861
986
|
try {
|
|
862
|
-
return await
|
|
863
|
-
} catch (
|
|
864
|
-
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;
|
|
865
990
|
} finally {
|
|
866
991
|
r(!1);
|
|
867
992
|
}
|
|
868
993
|
},
|
|
869
|
-
[
|
|
870
|
-
),
|
|
871
|
-
async (
|
|
994
|
+
[e]
|
|
995
|
+
), c = N(
|
|
996
|
+
async (d, l) => {
|
|
872
997
|
r(!0), t(null);
|
|
873
998
|
try {
|
|
874
|
-
return await
|
|
875
|
-
} catch (
|
|
876
|
-
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;
|
|
877
1002
|
} finally {
|
|
878
1003
|
r(!1);
|
|
879
1004
|
}
|
|
880
1005
|
},
|
|
881
|
-
[
|
|
1006
|
+
[e]
|
|
882
1007
|
);
|
|
883
|
-
return { signIn:
|
|
1008
|
+
return { signIn: u, signInWithOAuth: i, submitMfaCode: c, isLoading: a, error: o, setError: t };
|
|
884
1009
|
}
|
|
885
|
-
function
|
|
886
|
-
const { client:
|
|
887
|
-
return { signUp:
|
|
888
|
-
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) => {
|
|
889
1014
|
r(!0), t(null);
|
|
890
1015
|
try {
|
|
891
|
-
return await
|
|
892
|
-
} catch (
|
|
893
|
-
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;
|
|
894
1019
|
} finally {
|
|
895
1020
|
r(!1);
|
|
896
1021
|
}
|
|
897
1022
|
},
|
|
898
|
-
[
|
|
899
|
-
), isLoading: a, error:
|
|
1023
|
+
[e]
|
|
1024
|
+
), isLoading: a, error: o, setError: t };
|
|
900
1025
|
}
|
|
901
|
-
function
|
|
902
|
-
const { client:
|
|
903
|
-
|
|
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);
|
|
904
1029
|
try {
|
|
905
|
-
const
|
|
906
|
-
r(
|
|
907
|
-
|
|
908
|
-
|
|
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");
|
|
909
1044
|
} finally {
|
|
910
|
-
|
|
1045
|
+
g(!1);
|
|
911
1046
|
}
|
|
912
|
-
}, [
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
}, [
|
|
916
|
-
const
|
|
1047
|
+
}, [e, o]);
|
|
1048
|
+
U(() => {
|
|
1049
|
+
b();
|
|
1050
|
+
}, [b]);
|
|
1051
|
+
const k = N(async (w) => {
|
|
917
1052
|
try {
|
|
918
|
-
const
|
|
919
|
-
t(
|
|
920
|
-
const
|
|
921
|
-
|
|
922
|
-
} catch (
|
|
923
|
-
|
|
924
|
-
}
|
|
925
|
-
}, [
|
|
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, $) => {
|
|
926
1061
|
try {
|
|
927
|
-
const
|
|
928
|
-
return r((
|
|
929
|
-
} catch (
|
|
930
|
-
return
|
|
1062
|
+
const y = await e.auth.createOrg(w, $);
|
|
1063
|
+
return r((E) => [...E, y]), y;
|
|
1064
|
+
} catch (y) {
|
|
1065
|
+
return f(y instanceof Error ? y.message : "Failed to create organization"), null;
|
|
1066
|
+
}
|
|
1067
|
+
}, [e]), C = N(async (w, $) => {
|
|
1068
|
+
try {
|
|
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;
|
|
931
1110
|
}
|
|
932
|
-
}, [
|
|
933
|
-
|
|
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);
|
|
1150
|
+
}
|
|
1151
|
+
}, [e]), isLoading: a, error: o, setError: t };
|
|
934
1152
|
}
|
|
935
|
-
function
|
|
936
|
-
const { client:
|
|
937
|
-
async (
|
|
938
|
-
|
|
1153
|
+
function te() {
|
|
1154
|
+
const { client: e, user: a } = L(), [r, o] = m(!1), [t, u] = m(null), [i, c] = m(null), d = N(
|
|
1155
|
+
async (p) => {
|
|
1156
|
+
o(!0), u(null), c(null);
|
|
939
1157
|
try {
|
|
940
|
-
const
|
|
941
|
-
return
|
|
942
|
-
} catch (
|
|
943
|
-
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;
|
|
1162
|
+
} finally {
|
|
1163
|
+
o(!1);
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
[e]
|
|
1167
|
+
), l = N(
|
|
1168
|
+
async (p, f) => {
|
|
1169
|
+
o(!0), u(null), c(null);
|
|
1170
|
+
try {
|
|
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;
|
|
944
1174
|
} finally {
|
|
945
|
-
|
|
1175
|
+
o(!1);
|
|
946
1176
|
}
|
|
947
1177
|
},
|
|
948
|
-
[
|
|
949
|
-
),
|
|
950
|
-
async (
|
|
951
|
-
|
|
1178
|
+
[e]
|
|
1179
|
+
), g = N(
|
|
1180
|
+
async (p) => {
|
|
1181
|
+
o(!0), u(null), c(null);
|
|
952
1182
|
try {
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
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;
|
|
956
1187
|
} finally {
|
|
957
|
-
|
|
1188
|
+
o(!1);
|
|
958
1189
|
}
|
|
959
1190
|
},
|
|
960
|
-
[
|
|
1191
|
+
[e]
|
|
961
1192
|
);
|
|
962
|
-
return { user: a, updateProfile:
|
|
1193
|
+
return { user: a, updateProfile: d, uploadAvatar: g, changePassword: l, isLoading: r, error: t, success: i, setError: u, setSuccess: c };
|
|
963
1194
|
}
|
|
964
|
-
const
|
|
965
|
-
function
|
|
966
|
-
const { appearance:
|
|
967
|
-
async (
|
|
968
|
-
if (
|
|
969
|
-
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);
|
|
970
1201
|
return;
|
|
971
1202
|
}
|
|
972
|
-
const
|
|
973
|
-
|
|
1203
|
+
const M = await u(f, k);
|
|
1204
|
+
M && be(M) && (S(M.mfaToken), x(!0), g(null));
|
|
974
1205
|
},
|
|
975
|
-
[
|
|
976
|
-
),
|
|
977
|
-
async (
|
|
978
|
-
await
|
|
1206
|
+
[f, k, C, h, z, u, c, g]
|
|
1207
|
+
), $ = N(
|
|
1208
|
+
async (E) => {
|
|
1209
|
+
await i(E);
|
|
979
1210
|
},
|
|
980
|
-
[
|
|
981
|
-
),
|
|
982
|
-
return /* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
!
|
|
985
|
-
(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(
|
|
986
1217
|
"button",
|
|
987
1218
|
{
|
|
988
1219
|
type: "button",
|
|
989
1220
|
className: "ss-btn-social",
|
|
990
|
-
onClick: () =>
|
|
991
|
-
disabled:
|
|
1221
|
+
onClick: () => $("google"),
|
|
1222
|
+
disabled: d,
|
|
992
1223
|
children: [
|
|
993
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
994
1225
|
"Continue with Google"
|
|
995
1226
|
]
|
|
996
1227
|
}
|
|
997
1228
|
),
|
|
998
|
-
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */
|
|
1229
|
+
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
|
|
999
1230
|
"button",
|
|
1000
1231
|
{
|
|
1001
1232
|
type: "button",
|
|
1002
1233
|
className: "ss-btn-social",
|
|
1003
|
-
onClick: () =>
|
|
1004
|
-
disabled:
|
|
1234
|
+
onClick: () => $("github"),
|
|
1235
|
+
disabled: d,
|
|
1005
1236
|
children: [
|
|
1006
|
-
/* @__PURE__ */
|
|
1237
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
|
|
1007
1238
|
"Continue with GitHub"
|
|
1008
1239
|
]
|
|
1009
1240
|
}
|
|
1010
1241
|
),
|
|
1011
|
-
|
|
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" })
|
|
1012
1256
|
] }),
|
|
1013
|
-
|
|
1014
|
-
/* @__PURE__ */
|
|
1015
|
-
|
|
1016
|
-
/* @__PURE__ */
|
|
1017
|
-
/* @__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(
|
|
1018
1262
|
"input",
|
|
1019
1263
|
{
|
|
1020
1264
|
id: "ss-mfa-code",
|
|
@@ -1023,15 +1267,15 @@ function qs({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1023
1267
|
inputMode: "numeric",
|
|
1024
1268
|
autoComplete: "one-time-code",
|
|
1025
1269
|
placeholder: "Enter 6-digit code",
|
|
1026
|
-
value:
|
|
1027
|
-
onChange: (
|
|
1270
|
+
value: z,
|
|
1271
|
+
onChange: (E) => P(E.target.value),
|
|
1028
1272
|
autoFocus: !0
|
|
1029
1273
|
}
|
|
1030
1274
|
)
|
|
1031
|
-
] }) : /* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__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(
|
|
1035
1279
|
"input",
|
|
1036
1280
|
{
|
|
1037
1281
|
id: "ss-email",
|
|
@@ -1039,15 +1283,15 @@ function qs({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1039
1283
|
type: "email",
|
|
1040
1284
|
autoComplete: "email",
|
|
1041
1285
|
placeholder: "you@example.com",
|
|
1042
|
-
value:
|
|
1043
|
-
onChange: (
|
|
1286
|
+
value: f,
|
|
1287
|
+
onChange: (E) => b(E.target.value),
|
|
1044
1288
|
required: !0
|
|
1045
1289
|
}
|
|
1046
1290
|
)
|
|
1047
1291
|
] }),
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
/* @__PURE__ */
|
|
1050
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1293
|
+
/* @__PURE__ */ s("label", { className: "ss-label", htmlFor: "ss-password", children: "Password" }),
|
|
1294
|
+
/* @__PURE__ */ s(
|
|
1051
1295
|
"input",
|
|
1052
1296
|
{
|
|
1053
1297
|
id: "ss-password",
|
|
@@ -1055,90 +1299,90 @@ function qs({ appearance: s, signUpUrl: a, onSignUp: r }) {
|
|
|
1055
1299
|
type: "password",
|
|
1056
1300
|
autoComplete: "current-password",
|
|
1057
1301
|
placeholder: "Enter your password",
|
|
1058
|
-
value:
|
|
1059
|
-
onChange: (
|
|
1302
|
+
value: k,
|
|
1303
|
+
onChange: (E) => v(E.target.value),
|
|
1060
1304
|
required: !0
|
|
1061
1305
|
}
|
|
1062
1306
|
)
|
|
1063
1307
|
] })
|
|
1064
1308
|
] }),
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
|
|
1067
|
-
|
|
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"
|
|
1068
1312
|
] })
|
|
1069
1313
|
] }),
|
|
1070
|
-
|
|
1314
|
+
C && /* @__PURE__ */ s("div", { className: "ss-footer", children: /* @__PURE__ */ s(
|
|
1071
1315
|
"span",
|
|
1072
1316
|
{
|
|
1073
1317
|
className: "ss-link",
|
|
1074
1318
|
onClick: () => {
|
|
1075
|
-
|
|
1319
|
+
x(!1), P(""), g(null);
|
|
1076
1320
|
},
|
|
1077
1321
|
children: "Back to sign in"
|
|
1078
1322
|
}
|
|
1079
1323
|
) }),
|
|
1080
|
-
!
|
|
1324
|
+
!C && /* @__PURE__ */ n("div", { className: "ss-footer", children: [
|
|
1081
1325
|
"Don't have an account?",
|
|
1082
1326
|
" ",
|
|
1083
|
-
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" })
|
|
1084
1328
|
] })
|
|
1085
1329
|
] }) });
|
|
1086
1330
|
}
|
|
1087
|
-
function
|
|
1088
|
-
const { appearance:
|
|
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(
|
|
1089
1333
|
async (T) => {
|
|
1090
|
-
if (T.preventDefault(),
|
|
1091
|
-
|
|
1334
|
+
if (T.preventDefault(), h(null), b !== v) {
|
|
1335
|
+
h("Passwords do not match");
|
|
1092
1336
|
return;
|
|
1093
1337
|
}
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1096
|
-
|
|
1338
|
+
const w = (t == null ? void 0 : t.passwordMinLength) ?? 8;
|
|
1339
|
+
if (b.length < w) {
|
|
1340
|
+
h(`Password must be at least ${w} characters`);
|
|
1097
1341
|
return;
|
|
1098
1342
|
}
|
|
1099
|
-
await
|
|
1343
|
+
await u(p, b);
|
|
1100
1344
|
},
|
|
1101
|
-
[p,
|
|
1102
|
-
),
|
|
1345
|
+
[p, b, v, t, u]
|
|
1346
|
+
), z = N(
|
|
1103
1347
|
async (T) => {
|
|
1104
|
-
await
|
|
1348
|
+
await l(T);
|
|
1105
1349
|
},
|
|
1106
|
-
[
|
|
1107
|
-
),
|
|
1108
|
-
return /* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
(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(
|
|
1111
1355
|
"button",
|
|
1112
1356
|
{
|
|
1113
1357
|
type: "button",
|
|
1114
1358
|
className: "ss-btn-social",
|
|
1115
|
-
onClick: () =>
|
|
1116
|
-
disabled:
|
|
1359
|
+
onClick: () => z("google"),
|
|
1360
|
+
disabled: i,
|
|
1117
1361
|
children: [
|
|
1118
|
-
/* @__PURE__ */
|
|
1362
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: ne } }),
|
|
1119
1363
|
"Continue with Google"
|
|
1120
1364
|
]
|
|
1121
1365
|
}
|
|
1122
1366
|
),
|
|
1123
|
-
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */
|
|
1367
|
+
(t == null ? void 0 : t.githubEnabled) && /* @__PURE__ */ n(
|
|
1124
1368
|
"button",
|
|
1125
1369
|
{
|
|
1126
1370
|
type: "button",
|
|
1127
1371
|
className: "ss-btn-social",
|
|
1128
|
-
onClick: () =>
|
|
1129
|
-
disabled:
|
|
1372
|
+
onClick: () => z("github"),
|
|
1373
|
+
disabled: i,
|
|
1130
1374
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1375
|
+
/* @__PURE__ */ s("span", { dangerouslySetInnerHTML: { __html: oe } }),
|
|
1132
1376
|
"Continue with GitHub"
|
|
1133
1377
|
]
|
|
1134
1378
|
}
|
|
1135
1379
|
),
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
/* @__PURE__ */
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
/* @__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(
|
|
1142
1386
|
"input",
|
|
1143
1387
|
{
|
|
1144
1388
|
id: "ss-signup-email",
|
|
@@ -1147,14 +1391,14 @@ function As({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1147
1391
|
autoComplete: "email",
|
|
1148
1392
|
placeholder: "you@example.com",
|
|
1149
1393
|
value: p,
|
|
1150
|
-
onChange: (T) =>
|
|
1394
|
+
onChange: (T) => f(T.target.value),
|
|
1151
1395
|
required: !0
|
|
1152
1396
|
}
|
|
1153
1397
|
)
|
|
1154
1398
|
] }),
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
/* @__PURE__ */
|
|
1157
|
-
/* @__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(
|
|
1158
1402
|
"input",
|
|
1159
1403
|
{
|
|
1160
1404
|
id: "ss-signup-password",
|
|
@@ -1162,17 +1406,17 @@ function As({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1162
1406
|
type: "password",
|
|
1163
1407
|
autoComplete: "new-password",
|
|
1164
1408
|
placeholder: "Create a password",
|
|
1165
|
-
value:
|
|
1409
|
+
value: b,
|
|
1166
1410
|
onChange: (T) => {
|
|
1167
|
-
|
|
1411
|
+
k(T.target.value), h(null);
|
|
1168
1412
|
},
|
|
1169
1413
|
required: !0
|
|
1170
1414
|
}
|
|
1171
1415
|
)
|
|
1172
1416
|
] }),
|
|
1173
|
-
/* @__PURE__ */
|
|
1174
|
-
/* @__PURE__ */
|
|
1175
|
-
/* @__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(
|
|
1176
1420
|
"input",
|
|
1177
1421
|
{
|
|
1178
1422
|
id: "ss-signup-confirm",
|
|
@@ -1180,399 +1424,765 @@ function As({ appearance: s, signInUrl: a, onSignIn: r }) {
|
|
|
1180
1424
|
type: "password",
|
|
1181
1425
|
autoComplete: "new-password",
|
|
1182
1426
|
placeholder: "Confirm your password",
|
|
1183
|
-
value:
|
|
1427
|
+
value: v,
|
|
1184
1428
|
onChange: (T) => {
|
|
1185
|
-
|
|
1429
|
+
C(T.target.value), h(null);
|
|
1186
1430
|
},
|
|
1187
1431
|
required: !0
|
|
1188
1432
|
}
|
|
1189
1433
|
)
|
|
1190
1434
|
] }),
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
|
|
1435
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1436
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1193
1437
|
"Create account"
|
|
1194
1438
|
] })
|
|
1195
1439
|
] }),
|
|
1196
|
-
/* @__PURE__ */
|
|
1440
|
+
/* @__PURE__ */ n("div", { className: "ss-footer", children: [
|
|
1197
1441
|
"Already have an account?",
|
|
1198
1442
|
" ",
|
|
1199
|
-
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" })
|
|
1444
|
+
] })
|
|
1445
|
+
] }) });
|
|
1446
|
+
}
|
|
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);
|
|
1467
|
+
},
|
|
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)
|
|
1474
|
+
});
|
|
1475
|
+
},
|
|
1476
|
+
[l]
|
|
1477
|
+
), C = N(() => g(!1), []), x = N(() => {
|
|
1478
|
+
if (!t.current) return;
|
|
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);
|
|
1486
|
+
}, "image/png");
|
|
1487
|
+
}, [u, c, a]);
|
|
1488
|
+
return /* @__PURE__ */ n("div", { className: "ss-avatar-cropper", children: [
|
|
1489
|
+
/* @__PURE__ */ s(
|
|
1490
|
+
"canvas",
|
|
1491
|
+
{
|
|
1492
|
+
ref: o,
|
|
1493
|
+
width: B,
|
|
1494
|
+
height: B,
|
|
1495
|
+
className: "ss-avatar-canvas",
|
|
1496
|
+
onPointerDown: k,
|
|
1497
|
+
onPointerMove: v,
|
|
1498
|
+
onPointerUp: C,
|
|
1499
|
+
style: { cursor: l ? "grabbing" : "grab" }
|
|
1500
|
+
}
|
|
1501
|
+
),
|
|
1502
|
+
/* @__PURE__ */ n("div", { className: "ss-avatar-zoom", children: [
|
|
1503
|
+
/* @__PURE__ */ s("span", { className: "ss-avatar-zoom-label", children: "Zoom" }),
|
|
1504
|
+
/* @__PURE__ */ s(
|
|
1505
|
+
"input",
|
|
1506
|
+
{
|
|
1507
|
+
type: "range",
|
|
1508
|
+
min: "1",
|
|
1509
|
+
max: "3",
|
|
1510
|
+
step: "0.01",
|
|
1511
|
+
value: u,
|
|
1512
|
+
onChange: (h) => i(parseFloat(h.target.value)),
|
|
1513
|
+
className: "ss-avatar-zoom-slider"
|
|
1514
|
+
}
|
|
1515
|
+
)
|
|
1516
|
+
] }),
|
|
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" })
|
|
1200
1520
|
] })
|
|
1521
|
+
] });
|
|
1522
|
+
}
|
|
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");
|
|
1527
|
+
return;
|
|
1528
|
+
}
|
|
1529
|
+
if (b.size > 5 * 1024 * 1024) {
|
|
1530
|
+
d("Image must be smaller than 5 MB");
|
|
1531
|
+
return;
|
|
1532
|
+
}
|
|
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);
|
|
1539
|
+
},
|
|
1540
|
+
[g]
|
|
1541
|
+
), f = N(
|
|
1542
|
+
async (b) => {
|
|
1543
|
+
await e(b);
|
|
1544
|
+
},
|
|
1545
|
+
[e]
|
|
1546
|
+
);
|
|
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: "✕" })
|
|
1553
|
+
] }),
|
|
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(
|
|
1556
|
+
"div",
|
|
1557
|
+
{
|
|
1558
|
+
className: `ss-avatar-dropzone${u ? " ss-avatar-dropzone-active" : ""}`,
|
|
1559
|
+
onDragOver: (b) => {
|
|
1560
|
+
b.preventDefault(), i(!0);
|
|
1561
|
+
},
|
|
1562
|
+
onDragLeave: () => i(!1),
|
|
1563
|
+
onDrop: p,
|
|
1564
|
+
onClick: () => {
|
|
1565
|
+
var b;
|
|
1566
|
+
return (b = l.current) == null ? void 0 : b.click();
|
|
1567
|
+
},
|
|
1568
|
+
children: [
|
|
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" })
|
|
1572
|
+
] }),
|
|
1573
|
+
/* @__PURE__ */ s("span", { children: "Drop image here or click to browse" }),
|
|
1574
|
+
/* @__PURE__ */ s(
|
|
1575
|
+
"input",
|
|
1576
|
+
{
|
|
1577
|
+
ref: l,
|
|
1578
|
+
type: "file",
|
|
1579
|
+
accept: "image/*",
|
|
1580
|
+
style: { display: "none" },
|
|
1581
|
+
onChange: (b) => {
|
|
1582
|
+
var k;
|
|
1583
|
+
(k = b.target.files) != null && k[0] && g(b.target.files[0]);
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
)
|
|
1587
|
+
]
|
|
1588
|
+
}
|
|
1589
|
+
),
|
|
1590
|
+
r && /* @__PURE__ */ s("div", { className: "ss-loading", children: "Uploading..." })
|
|
1201
1591
|
] }) });
|
|
1202
1592
|
}
|
|
1203
|
-
function
|
|
1204
|
-
|
|
1205
|
-
|
|
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));
|
|
1206
1603
|
}, []);
|
|
1207
|
-
|
|
1208
|
-
if (
|
|
1209
|
-
const
|
|
1210
|
-
document.addEventListener("click",
|
|
1604
|
+
U(() => {
|
|
1605
|
+
if (g) {
|
|
1606
|
+
const D = setTimeout(() => {
|
|
1607
|
+
document.addEventListener("click", O);
|
|
1211
1608
|
}, 0);
|
|
1212
1609
|
return () => {
|
|
1213
|
-
clearTimeout(
|
|
1610
|
+
clearTimeout(D), document.removeEventListener("click", O);
|
|
1214
1611
|
};
|
|
1215
1612
|
}
|
|
1216
|
-
}, [
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1219
|
-
|
|
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(
|
|
1220
1634
|
"button",
|
|
1221
1635
|
{
|
|
1222
1636
|
type: "button",
|
|
1223
1637
|
className: "ss-avatar",
|
|
1224
|
-
onClick: () =>
|
|
1638
|
+
onClick: () => p(!g),
|
|
1225
1639
|
"aria-label": "User menu",
|
|
1226
|
-
children:
|
|
1640
|
+
children: c.avatarUrl ? /* @__PURE__ */ s("img", { src: c.avatarUrl, alt: "", style: { width: "100%", height: "100%", borderRadius: "50%", objectFit: "cover" } }) : W
|
|
1227
1641
|
}
|
|
1228
1642
|
),
|
|
1229
|
-
|
|
1230
|
-
/* @__PURE__ */
|
|
1231
|
-
|
|
1232
|
-
/* @__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 })
|
|
1233
1647
|
] }),
|
|
1234
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ s(
|
|
1235
1649
|
"button",
|
|
1236
1650
|
{
|
|
1237
1651
|
type: "button",
|
|
1238
1652
|
className: "ss-dropdown-item",
|
|
1239
1653
|
onClick: () => {
|
|
1240
|
-
|
|
1654
|
+
p(!1), b(!0);
|
|
1241
1655
|
},
|
|
1242
1656
|
children: "Profile"
|
|
1243
1657
|
}
|
|
1244
1658
|
),
|
|
1245
|
-
/* @__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(
|
|
1246
1753
|
"button",
|
|
1247
1754
|
{
|
|
1248
1755
|
type: "button",
|
|
1249
1756
|
className: "ss-dropdown-item ss-dropdown-item-danger",
|
|
1250
1757
|
onClick: async () => {
|
|
1251
|
-
|
|
1758
|
+
p(!1), await d(), a && (window.location.href = a);
|
|
1252
1759
|
},
|
|
1253
1760
|
children: "Sign out"
|
|
1254
1761
|
}
|
|
1255
1762
|
)
|
|
1256
1763
|
] }),
|
|
1257
|
-
|
|
1764
|
+
f && /* @__PURE__ */ s(
|
|
1765
|
+
Ee,
|
|
1766
|
+
{
|
|
1767
|
+
onClose: () => b(!1),
|
|
1768
|
+
afterDeleteAccountUrl: r
|
|
1769
|
+
}
|
|
1770
|
+
)
|
|
1258
1771
|
] }) });
|
|
1259
1772
|
}
|
|
1260
|
-
function
|
|
1261
|
-
const { user:
|
|
1262
|
-
async (
|
|
1263
|
-
|
|
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 });
|
|
1264
1777
|
},
|
|
1265
|
-
[
|
|
1266
|
-
),
|
|
1267
|
-
async (
|
|
1268
|
-
|
|
1269
|
-
|
|
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));
|
|
1783
|
+
},
|
|
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");
|
|
1270
1789
|
return;
|
|
1271
1790
|
}
|
|
1272
|
-
if (
|
|
1273
|
-
|
|
1791
|
+
if (w.length < 8) {
|
|
1792
|
+
O("Password must be at least 8 characters");
|
|
1274
1793
|
return;
|
|
1275
1794
|
}
|
|
1276
|
-
await
|
|
1795
|
+
await u(I, w) && (T(""), $(""), E(""));
|
|
1277
1796
|
},
|
|
1278
|
-
[
|
|
1279
|
-
),
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
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: "✕" })
|
|
1286
1807
|
] }),
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
/* @__PURE__ */
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
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(
|
|
1811
|
+
"div",
|
|
1812
|
+
{
|
|
1813
|
+
className: "ss-avatar-preview ss-avatar-hoverable",
|
|
1814
|
+
onClick: () => P(!0),
|
|
1815
|
+
title: "Click to change avatar",
|
|
1816
|
+
children: [
|
|
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" })
|
|
1821
|
+
] }) })
|
|
1822
|
+
]
|
|
1823
|
+
}
|
|
1824
|
+
),
|
|
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(
|
|
1294
1829
|
"input",
|
|
1295
1830
|
{
|
|
1296
1831
|
className: "ss-input",
|
|
1297
1832
|
type: "text",
|
|
1298
1833
|
placeholder: "Your name",
|
|
1299
|
-
value:
|
|
1300
|
-
onChange: (
|
|
1834
|
+
value: C,
|
|
1835
|
+
onChange: (A) => x(A.target.value)
|
|
1301
1836
|
}
|
|
1302
1837
|
)
|
|
1303
1838
|
] }),
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
"input",
|
|
1308
|
-
{
|
|
1309
|
-
className: "ss-input",
|
|
1310
|
-
type: "url",
|
|
1311
|
-
placeholder: "https://example.com/avatar.jpg",
|
|
1312
|
-
value: p,
|
|
1313
|
-
onChange: (C) => h(C.target.value)
|
|
1314
|
-
}
|
|
1315
|
-
)
|
|
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 })
|
|
1316
1842
|
] }),
|
|
1317
|
-
/* @__PURE__ */
|
|
1318
|
-
/* @__PURE__ */
|
|
1319
|
-
/* @__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 })
|
|
1320
1846
|
] }),
|
|
1321
|
-
/* @__PURE__ */
|
|
1322
|
-
/* @__PURE__ */
|
|
1323
|
-
/* @__PURE__ */ e("input", { className: "ss-input ss-input-readonly", type: "text", value: (a == null ? void 0 : a.provider) ?? "", disabled: !0, readOnly: !0 })
|
|
1324
|
-
] }),
|
|
1325
|
-
/* @__PURE__ */ i("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: t, children: [
|
|
1326
|
-
t && /* @__PURE__ */ e("span", { className: "ss-spinner" }),
|
|
1847
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1848
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1327
1849
|
"Save changes"
|
|
1328
1850
|
] })
|
|
1329
1851
|
] }),
|
|
1330
|
-
|
|
1331
|
-
/* @__PURE__ */
|
|
1332
|
-
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */
|
|
1335
|
-
/* @__PURE__ */
|
|
1336
|
-
/* @__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(
|
|
1337
1859
|
"input",
|
|
1338
1860
|
{
|
|
1339
1861
|
className: "ss-input",
|
|
1340
1862
|
type: "password",
|
|
1341
|
-
value:
|
|
1342
|
-
onChange: (
|
|
1863
|
+
value: I,
|
|
1864
|
+
onChange: (A) => T(A.target.value),
|
|
1343
1865
|
required: !0
|
|
1344
1866
|
}
|
|
1345
1867
|
)
|
|
1346
1868
|
] }),
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1869
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1870
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "New password" }),
|
|
1871
|
+
/* @__PURE__ */ s(
|
|
1350
1872
|
"input",
|
|
1351
1873
|
{
|
|
1352
1874
|
className: "ss-input",
|
|
1353
1875
|
type: "password",
|
|
1354
|
-
value:
|
|
1355
|
-
onChange: (
|
|
1876
|
+
value: w,
|
|
1877
|
+
onChange: (A) => $(A.target.value),
|
|
1356
1878
|
required: !0
|
|
1357
1879
|
}
|
|
1358
1880
|
)
|
|
1359
1881
|
] }),
|
|
1360
|
-
/* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
1882
|
+
/* @__PURE__ */ n("div", { className: "ss-field", children: [
|
|
1883
|
+
/* @__PURE__ */ s("label", { className: "ss-label", children: "Confirm new password" }),
|
|
1884
|
+
/* @__PURE__ */ s(
|
|
1363
1885
|
"input",
|
|
1364
1886
|
{
|
|
1365
1887
|
className: "ss-input",
|
|
1366
1888
|
type: "password",
|
|
1367
|
-
value:
|
|
1368
|
-
onChange: (
|
|
1889
|
+
value: y,
|
|
1890
|
+
onChange: (A) => E(A.target.value),
|
|
1369
1891
|
required: !0
|
|
1370
1892
|
}
|
|
1371
1893
|
)
|
|
1372
1894
|
] }),
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
|
|
1895
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: i, children: [
|
|
1896
|
+
i && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1375
1897
|
"Update password"
|
|
1376
1898
|
] })
|
|
1377
1899
|
] })
|
|
1378
|
-
] })
|
|
1900
|
+
] }),
|
|
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,
|
|
1958
|
+
{
|
|
1959
|
+
onUpload: ce,
|
|
1960
|
+
onClose: () => P(!1),
|
|
1961
|
+
isLoading: i
|
|
1962
|
+
}
|
|
1963
|
+
)
|
|
1379
1964
|
] }) });
|
|
1380
1965
|
}
|
|
1381
|
-
function
|
|
1382
|
-
const { appearance: a } =
|
|
1383
|
-
async (
|
|
1384
|
-
|
|
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 });
|
|
1970
|
+
},
|
|
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));
|
|
1385
1976
|
},
|
|
1386
|
-
[
|
|
1387
|
-
),
|
|
1388
|
-
async (
|
|
1389
|
-
if (
|
|
1390
|
-
|
|
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");
|
|
1391
1982
|
return;
|
|
1392
1983
|
}
|
|
1393
|
-
if (
|
|
1394
|
-
|
|
1984
|
+
if (P.length < 8) {
|
|
1985
|
+
y("Password must be at least 8 characters");
|
|
1395
1986
|
return;
|
|
1396
1987
|
}
|
|
1397
|
-
await
|
|
1988
|
+
await i(S, P) && (z(""), I(""), w(""));
|
|
1398
1989
|
},
|
|
1399
|
-
[
|
|
1990
|
+
[S, P, T, i, g, p]
|
|
1400
1991
|
);
|
|
1401
1992
|
if (!r) return null;
|
|
1402
|
-
const
|
|
1403
|
-
return /* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
/* @__PURE__ */
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
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(
|
|
1999
|
+
"div",
|
|
2000
|
+
{
|
|
2001
|
+
className: "ss-avatar-preview ss-avatar-hoverable",
|
|
2002
|
+
style: { margin: "0 auto 16px" },
|
|
2003
|
+
onClick: () => h(!0),
|
|
2004
|
+
title: "Click to change avatar",
|
|
2005
|
+
children: [
|
|
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" })
|
|
2010
|
+
] }) })
|
|
2011
|
+
]
|
|
2012
|
+
}
|
|
2013
|
+
),
|
|
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) })
|
|
1416
2018
|
] }),
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1419
|
-
/* @__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 })
|
|
1420
2022
|
] }),
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
1423
|
-
/* @__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 })
|
|
1424
2026
|
] }),
|
|
1425
|
-
/* @__PURE__ */
|
|
1426
|
-
/* @__PURE__ */
|
|
1427
|
-
/* @__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 })
|
|
1428
2030
|
] }),
|
|
1429
|
-
/* @__PURE__ */
|
|
1430
|
-
|
|
2031
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
|
|
2032
|
+
c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1431
2033
|
"Save changes"
|
|
1432
2034
|
] })
|
|
1433
2035
|
] }),
|
|
1434
|
-
|
|
1435
|
-
/* @__PURE__ */
|
|
1436
|
-
|
|
1437
|
-
/* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
/* @__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 })
|
|
1441
2043
|
] }),
|
|
1442
|
-
/* @__PURE__ */
|
|
1443
|
-
/* @__PURE__ */
|
|
1444
|
-
/* @__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 })
|
|
1445
2047
|
] }),
|
|
1446
|
-
/* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
/* @__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 })
|
|
1449
2051
|
] }),
|
|
1450
|
-
/* @__PURE__ */
|
|
1451
|
-
|
|
2052
|
+
/* @__PURE__ */ n("button", { type: "submit", className: "ss-btn ss-btn-primary", disabled: c, children: [
|
|
2053
|
+
c && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1452
2054
|
"Update password"
|
|
1453
2055
|
] })
|
|
1454
2056
|
] })
|
|
1455
2057
|
] }),
|
|
1456
|
-
/* @__PURE__ */
|
|
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,
|
|
2061
|
+
{
|
|
2062
|
+
onUpload: M,
|
|
2063
|
+
onClose: () => h(!1),
|
|
2064
|
+
isLoading: c
|
|
2065
|
+
}
|
|
2066
|
+
)
|
|
1457
2067
|
] }) });
|
|
1458
2068
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const { appearance: r } =
|
|
1461
|
-
|
|
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));
|
|
1462
2072
|
}, []);
|
|
1463
|
-
|
|
1464
|
-
if (
|
|
1465
|
-
const
|
|
1466
|
-
document.addEventListener("click",
|
|
2073
|
+
U(() => {
|
|
2074
|
+
if (l) {
|
|
2075
|
+
const y = setTimeout(() => {
|
|
2076
|
+
document.addEventListener("click", I);
|
|
1467
2077
|
}, 0);
|
|
1468
2078
|
return () => {
|
|
1469
|
-
clearTimeout(
|
|
2079
|
+
clearTimeout(y), document.removeEventListener("click", I);
|
|
1470
2080
|
};
|
|
1471
2081
|
}
|
|
1472
|
-
}, [
|
|
1473
|
-
const T =
|
|
1474
|
-
y
|
|
1475
|
-
}, []),
|
|
1476
|
-
async (
|
|
1477
|
-
|
|
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);
|
|
1478
2088
|
try {
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
} catch (
|
|
1482
|
-
|
|
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");
|
|
1483
2093
|
} finally {
|
|
1484
|
-
|
|
2094
|
+
z(!1);
|
|
1485
2095
|
}
|
|
1486
2096
|
},
|
|
1487
|
-
[
|
|
2097
|
+
[b, v, i, u, a]
|
|
1488
2098
|
);
|
|
1489
|
-
if (
|
|
1490
|
-
const
|
|
1491
|
-
return /* @__PURE__ */
|
|
1492
|
-
/* @__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(
|
|
1493
2103
|
"button",
|
|
1494
2104
|
{
|
|
1495
2105
|
type: "button",
|
|
1496
2106
|
className: "ss-btn ss-btn-org-switcher",
|
|
1497
|
-
onClick: () =>
|
|
2107
|
+
onClick: () => g(!l),
|
|
1498
2108
|
children: [
|
|
1499
|
-
|
|
1500
|
-
/* @__PURE__ */
|
|
2109
|
+
$,
|
|
2110
|
+
/* @__PURE__ */ s("span", { className: "ss-chevron", children: l ? "▲" : "▼" })
|
|
1501
2111
|
]
|
|
1502
2112
|
}
|
|
1503
2113
|
),
|
|
1504
|
-
|
|
1505
|
-
|
|
2114
|
+
l && /* @__PURE__ */ n("div", { className: "ss-dropdown ss-dropdown-org", children: [
|
|
2115
|
+
o.map((y) => /* @__PURE__ */ s(
|
|
1506
2116
|
"button",
|
|
1507
2117
|
{
|
|
1508
2118
|
type: "button",
|
|
1509
|
-
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" : ""}`,
|
|
1510
2120
|
onClick: async () => {
|
|
1511
|
-
|
|
2121
|
+
g(!1), f(!1), await u(y.id), a == null || a(y);
|
|
1512
2122
|
},
|
|
1513
|
-
children:
|
|
2123
|
+
children: y.name
|
|
1514
2124
|
},
|
|
1515
|
-
|
|
2125
|
+
y.id
|
|
1516
2126
|
)),
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
p ? /* @__PURE__ */
|
|
1519
|
-
|
|
1520
|
-
/* @__PURE__ */
|
|
1521
|
-
/* @__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(
|
|
1522
2132
|
"input",
|
|
1523
2133
|
{
|
|
1524
2134
|
className: "ss-input",
|
|
1525
2135
|
type: "text",
|
|
1526
2136
|
placeholder: "Organization name",
|
|
1527
|
-
value:
|
|
1528
|
-
onChange: (
|
|
2137
|
+
value: b,
|
|
2138
|
+
onChange: (y) => T(y.target.value),
|
|
1529
2139
|
required: !0,
|
|
1530
2140
|
autoFocus: !0
|
|
1531
2141
|
}
|
|
1532
2142
|
) }),
|
|
1533
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ s("div", { className: "ss-field", children: /* @__PURE__ */ s(
|
|
1534
2144
|
"input",
|
|
1535
2145
|
{
|
|
1536
2146
|
className: "ss-input",
|
|
1537
2147
|
type: "text",
|
|
1538
2148
|
placeholder: "org-slug",
|
|
1539
|
-
value:
|
|
1540
|
-
onChange: (
|
|
2149
|
+
value: v,
|
|
2150
|
+
onChange: (y) => C(y.target.value),
|
|
1541
2151
|
required: !0
|
|
1542
2152
|
}
|
|
1543
2153
|
) }),
|
|
1544
|
-
/* @__PURE__ */
|
|
1545
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ n("div", { className: "ss-btn-group", style: { marginTop: "8px" }, children: [
|
|
2155
|
+
/* @__PURE__ */ s(
|
|
1546
2156
|
"button",
|
|
1547
2157
|
{
|
|
1548
2158
|
type: "button",
|
|
1549
2159
|
className: "ss-btn ss-btn-sm ss-btn-current",
|
|
1550
2160
|
onClick: () => {
|
|
1551
|
-
|
|
2161
|
+
f(!1), h(null);
|
|
1552
2162
|
},
|
|
1553
2163
|
children: "Cancel"
|
|
1554
2164
|
}
|
|
1555
2165
|
),
|
|
1556
|
-
/* @__PURE__ */
|
|
2166
|
+
/* @__PURE__ */ n(
|
|
1557
2167
|
"button",
|
|
1558
2168
|
{
|
|
1559
2169
|
type: "submit",
|
|
1560
2170
|
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
1561
|
-
disabled:
|
|
2171
|
+
disabled: S,
|
|
1562
2172
|
children: [
|
|
1563
|
-
|
|
2173
|
+
S && /* @__PURE__ */ s("span", { className: "ss-spinner" }),
|
|
1564
2174
|
"Create"
|
|
1565
2175
|
]
|
|
1566
2176
|
}
|
|
1567
2177
|
)
|
|
1568
2178
|
] })
|
|
1569
2179
|
] })
|
|
1570
|
-
] }) : /* @__PURE__ */
|
|
2180
|
+
] }) : /* @__PURE__ */ s(
|
|
1571
2181
|
"button",
|
|
1572
2182
|
{
|
|
1573
2183
|
type: "button",
|
|
1574
2184
|
className: "ss-dropdown-item",
|
|
1575
|
-
onClick: () =>
|
|
2185
|
+
onClick: () => f(!0),
|
|
1576
2186
|
style: { fontWeight: 500 },
|
|
1577
2187
|
children: "+ Create organization"
|
|
1578
2188
|
}
|
|
@@ -1580,636 +2190,636 @@ function Ms({ appearance: s, onOrgChange: a }) {
|
|
|
1580
2190
|
] })
|
|
1581
2191
|
] }) });
|
|
1582
2192
|
}
|
|
1583
|
-
function
|
|
2193
|
+
function Pe(e, a = "USD") {
|
|
1584
2194
|
return new Intl.NumberFormat("en-US", {
|
|
1585
2195
|
style: "currency",
|
|
1586
2196
|
currency: a,
|
|
1587
|
-
minimumFractionDigits:
|
|
1588
|
-
}).format(
|
|
2197
|
+
minimumFractionDigits: e % 100 === 0 ? 0 : 2
|
|
2198
|
+
}).format(e / 100);
|
|
1589
2199
|
}
|
|
1590
|
-
function
|
|
1591
|
-
const { appearance:
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
const
|
|
1594
|
-
return /* @__PURE__ */
|
|
1595
|
-
/* @__PURE__ */
|
|
1596
|
-
/* @__PURE__ */
|
|
1597
|
-
|
|
1598
|
-
|
|
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,
|
|
1599
2209
|
"-day trial"
|
|
1600
2210
|
] }),
|
|
1601
|
-
|
|
2211
|
+
d.isFree && /* @__PURE__ */ s("span", { className: "ss-badge ss-badge-active", children: "Free" })
|
|
1602
2212
|
] }),
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
/* @__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: [
|
|
1606
2216
|
"/",
|
|
1607
|
-
|
|
2217
|
+
d.interval
|
|
1608
2218
|
] })
|
|
1609
2219
|
] }) }),
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
/* @__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: "✓" }),
|
|
1613
2223
|
" ",
|
|
1614
|
-
|
|
2224
|
+
g
|
|
1615
2225
|
] }, p)) }),
|
|
1616
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ s(
|
|
1617
2227
|
"button",
|
|
1618
2228
|
{
|
|
1619
2229
|
type: "button",
|
|
1620
|
-
className: `ss-btn ${
|
|
1621
|
-
disabled:
|
|
1622
|
-
onClick: () => r(
|
|
1623
|
-
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"
|
|
1624
2234
|
}
|
|
1625
2235
|
)
|
|
1626
|
-
] },
|
|
2236
|
+
] }, d.id);
|
|
1627
2237
|
}) }) });
|
|
1628
2238
|
}
|
|
1629
|
-
function
|
|
1630
|
-
const { client:
|
|
1631
|
-
return { billing:
|
|
2239
|
+
function ns() {
|
|
2240
|
+
const { client: e } = L();
|
|
2241
|
+
return { billing: e.billing };
|
|
1632
2242
|
}
|
|
1633
|
-
function
|
|
1634
|
-
const { client: a } =
|
|
1635
|
-
return
|
|
1636
|
-
if (
|
|
1637
|
-
const r = new
|
|
1638
|
-
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);
|
|
1639
2249
|
}
|
|
1640
2250
|
return a.billing;
|
|
1641
|
-
}, [a,
|
|
2251
|
+
}, [a, e]);
|
|
1642
2252
|
}
|
|
1643
|
-
function
|
|
1644
|
-
const r =
|
|
1645
|
-
|
|
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);
|
|
1646
2256
|
try {
|
|
1647
|
-
const
|
|
1648
|
-
t(
|
|
1649
|
-
} catch (
|
|
1650
|
-
|
|
2257
|
+
const g = await r.getCustomer(e);
|
|
2258
|
+
t(g);
|
|
2259
|
+
} catch (g) {
|
|
2260
|
+
d(g instanceof Error ? g.message : "Failed to load subscription");
|
|
1651
2261
|
} finally {
|
|
1652
|
-
|
|
2262
|
+
i(!1);
|
|
1653
2263
|
}
|
|
1654
|
-
}, [r,
|
|
1655
|
-
return
|
|
1656
|
-
|
|
1657
|
-
}, [
|
|
2264
|
+
}, [r, e]);
|
|
2265
|
+
return U(() => {
|
|
2266
|
+
l();
|
|
2267
|
+
}, [l]), { customer: o, isLoading: u, error: c, refresh: l };
|
|
1658
2268
|
}
|
|
1659
|
-
function
|
|
1660
|
-
const r =
|
|
1661
|
-
|
|
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);
|
|
1662
2272
|
try {
|
|
1663
|
-
const
|
|
1664
|
-
t(
|
|
1665
|
-
} catch (
|
|
1666
|
-
|
|
2273
|
+
const g = await r.getInvoices(e);
|
|
2274
|
+
t(g);
|
|
2275
|
+
} catch (g) {
|
|
2276
|
+
d(g instanceof Error ? g.message : "Failed to load invoices");
|
|
1667
2277
|
} finally {
|
|
1668
|
-
|
|
2278
|
+
i(!1);
|
|
1669
2279
|
}
|
|
1670
|
-
}, [r,
|
|
1671
|
-
return
|
|
1672
|
-
|
|
1673
|
-
}, [
|
|
2280
|
+
}, [r, e]);
|
|
2281
|
+
return U(() => {
|
|
2282
|
+
l();
|
|
2283
|
+
}, [l]), { invoices: o, isLoading: u, error: c, refresh: l };
|
|
1674
2284
|
}
|
|
1675
|
-
function
|
|
1676
|
-
const r =
|
|
1677
|
-
|
|
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);
|
|
1678
2288
|
try {
|
|
1679
|
-
const
|
|
1680
|
-
t(
|
|
1681
|
-
} catch (
|
|
1682
|
-
|
|
2289
|
+
const g = await r.getCurrentUsage(e);
|
|
2290
|
+
t(g);
|
|
2291
|
+
} catch (g) {
|
|
2292
|
+
d(g instanceof Error ? g.message : "Failed to load usage");
|
|
1683
2293
|
} finally {
|
|
1684
|
-
|
|
2294
|
+
i(!1);
|
|
1685
2295
|
}
|
|
1686
|
-
}, [r,
|
|
1687
|
-
return
|
|
1688
|
-
|
|
1689
|
-
}, [
|
|
2296
|
+
}, [r, e]);
|
|
2297
|
+
return U(() => {
|
|
2298
|
+
l();
|
|
2299
|
+
}, [l]), { usage: o, isLoading: u, error: c, refresh: l };
|
|
1690
2300
|
}
|
|
1691
|
-
const
|
|
2301
|
+
const Le = {
|
|
1692
2302
|
active: "ss-badge-active"
|
|
1693
2303
|
};
|
|
1694
|
-
function
|
|
1695
|
-
customerId:
|
|
2304
|
+
function Be({
|
|
2305
|
+
customerId: e,
|
|
1696
2306
|
portalToken: a,
|
|
1697
2307
|
onChangePlan: r,
|
|
1698
|
-
onCancel:
|
|
2308
|
+
onCancel: o,
|
|
1699
2309
|
appearance: t
|
|
1700
2310
|
}) {
|
|
1701
|
-
const { appearance:
|
|
1702
|
-
return /* @__PURE__ */
|
|
1703
|
-
/* @__PURE__ */
|
|
1704
|
-
|
|
1705
|
-
/* @__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" }),
|
|
1706
2316
|
" Loading..."
|
|
1707
2317
|
] }),
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
/* @__PURE__ */
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__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 })
|
|
1713
2323
|
] }),
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__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" }) })
|
|
1717
2327
|
] }),
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
r && /* @__PURE__ */
|
|
1720
|
-
|
|
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" })
|
|
1721
2331
|
] })
|
|
1722
2332
|
] })
|
|
1723
2333
|
] }) });
|
|
1724
2334
|
}
|
|
1725
|
-
const
|
|
2335
|
+
const De = {
|
|
1726
2336
|
paid: "ss-badge-active",
|
|
1727
2337
|
open: "ss-badge-trialing",
|
|
1728
2338
|
draft: "ss-badge-paused",
|
|
1729
2339
|
void: "ss-badge-canceled",
|
|
1730
2340
|
uncollectible: "ss-badge-past-due"
|
|
1731
2341
|
};
|
|
1732
|
-
function
|
|
1733
|
-
return new Date(
|
|
2342
|
+
function Ae(e) {
|
|
2343
|
+
return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
1734
2344
|
}
|
|
1735
|
-
function
|
|
1736
|
-
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);
|
|
1737
2347
|
}
|
|
1738
|
-
function
|
|
1739
|
-
const { appearance:
|
|
1740
|
-
return /* @__PURE__ */
|
|
1741
|
-
/* @__PURE__ */
|
|
1742
|
-
|
|
1743
|
-
/* @__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" }),
|
|
1744
2354
|
" Loading..."
|
|
1745
2355
|
] }),
|
|
1746
|
-
|
|
1747
|
-
!
|
|
1748
|
-
!
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
/* @__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" })
|
|
1754
2364
|
] }) }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
/* @__PURE__ */
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
-
] },
|
|
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)) })
|
|
1761
2371
|
] })
|
|
1762
2372
|
] }) });
|
|
1763
2373
|
}
|
|
1764
|
-
function
|
|
1765
|
-
const { appearance: t } =
|
|
1766
|
-
return /* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1768
|
-
|
|
1769
|
-
/* @__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" }),
|
|
1770
2380
|
" Loading..."
|
|
1771
2381
|
] }),
|
|
1772
|
-
|
|
1773
|
-
!
|
|
1774
|
-
!
|
|
1775
|
-
const
|
|
1776
|
-
return /* @__PURE__ */
|
|
1777
|
-
/* @__PURE__ */
|
|
1778
|
-
/* @__PURE__ */
|
|
1779
|
-
/* @__PURE__ */
|
|
1780
|
-
|
|
1781
|
-
|
|
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()}` : ""
|
|
1782
2392
|
] })
|
|
1783
2393
|
] }),
|
|
1784
|
-
p !== null && /* @__PURE__ */
|
|
2394
|
+
p !== null && /* @__PURE__ */ s("div", { className: "ss-progress-bar", children: /* @__PURE__ */ s(
|
|
1785
2395
|
"div",
|
|
1786
2396
|
{
|
|
1787
2397
|
className: `ss-progress-fill ${p > 90 ? "ss-progress-danger" : ""}`,
|
|
1788
2398
|
style: { width: `${p}%` }
|
|
1789
2399
|
}
|
|
1790
2400
|
) })
|
|
1791
|
-
] },
|
|
2401
|
+
] }, l.metric);
|
|
1792
2402
|
})
|
|
1793
2403
|
] }) });
|
|
1794
2404
|
}
|
|
1795
|
-
function
|
|
1796
|
-
customerId:
|
|
2405
|
+
function os({
|
|
2406
|
+
customerId: e,
|
|
1797
2407
|
portalToken: a,
|
|
1798
2408
|
limits: r,
|
|
1799
|
-
onChangePlan:
|
|
2409
|
+
onChangePlan: o,
|
|
1800
2410
|
onCancel: t,
|
|
1801
|
-
appearance:
|
|
2411
|
+
appearance: u
|
|
1802
2412
|
}) {
|
|
1803
|
-
const { appearance:
|
|
1804
|
-
return /* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1806
|
-
/* @__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: [
|
|
1807
2417
|
{ id: "subscription", label: "Subscription" },
|
|
1808
2418
|
{ id: "invoices", label: "Invoices" },
|
|
1809
2419
|
{ id: "usage", label: "Usage" }
|
|
1810
|
-
].map((p) => /* @__PURE__ */
|
|
2420
|
+
].map((p) => /* @__PURE__ */ s(
|
|
1811
2421
|
"button",
|
|
1812
2422
|
{
|
|
1813
2423
|
type: "button",
|
|
1814
|
-
className: `ss-tab ${
|
|
1815
|
-
onClick: () =>
|
|
2424
|
+
className: `ss-tab ${d === p.id ? "ss-tab-active" : ""}`,
|
|
2425
|
+
onClick: () => l(p.id),
|
|
1816
2426
|
children: p.label
|
|
1817
2427
|
},
|
|
1818
2428
|
p.id
|
|
1819
2429
|
)) }),
|
|
1820
|
-
/* @__PURE__ */
|
|
1821
|
-
|
|
1822
|
-
|
|
2430
|
+
/* @__PURE__ */ n("div", { className: "ss-tab-content", children: [
|
|
2431
|
+
d === "subscription" && /* @__PURE__ */ s(
|
|
2432
|
+
Be,
|
|
1823
2433
|
{
|
|
1824
|
-
customerId:
|
|
2434
|
+
customerId: e,
|
|
1825
2435
|
portalToken: a,
|
|
1826
|
-
onChangePlan:
|
|
2436
|
+
onChangePlan: o,
|
|
1827
2437
|
onCancel: t
|
|
1828
2438
|
}
|
|
1829
2439
|
),
|
|
1830
|
-
|
|
1831
|
-
|
|
2440
|
+
d === "invoices" && /* @__PURE__ */ s(Fe, { customerId: e, portalToken: a }),
|
|
2441
|
+
d === "usage" && /* @__PURE__ */ s(Ue, { customerId: e, portalToken: a, limits: r })
|
|
1832
2442
|
] })
|
|
1833
2443
|
] }) });
|
|
1834
2444
|
}
|
|
1835
|
-
function
|
|
1836
|
-
const { appearance: t } =
|
|
1837
|
-
if (
|
|
1838
|
-
|
|
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);
|
|
1839
2449
|
try {
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
} catch (
|
|
1843
|
-
|
|
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");
|
|
1844
2454
|
} finally {
|
|
1845
|
-
|
|
2455
|
+
g(!1);
|
|
1846
2456
|
}
|
|
1847
2457
|
}
|
|
1848
|
-
}, [
|
|
1849
|
-
return /* @__PURE__ */
|
|
1850
|
-
/* @__PURE__ */
|
|
1851
|
-
p && /* @__PURE__ */
|
|
1852
|
-
|
|
1853
|
-
/* @__PURE__ */
|
|
1854
|
-
/* @__PURE__ */
|
|
1855
|
-
/* @__PURE__ */
|
|
1856
|
-
/* @__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(
|
|
1857
2467
|
"input",
|
|
1858
2468
|
{
|
|
1859
2469
|
id: "ss-coupon-code",
|
|
1860
2470
|
className: "ss-input",
|
|
1861
2471
|
type: "text",
|
|
1862
2472
|
placeholder: "Enter coupon code",
|
|
1863
|
-
value:
|
|
1864
|
-
onChange: (
|
|
2473
|
+
value: c,
|
|
2474
|
+
onChange: (C) => d(C.target.value),
|
|
1865
2475
|
required: !0
|
|
1866
2476
|
}
|
|
1867
2477
|
)
|
|
1868
2478
|
] }),
|
|
1869
|
-
/* @__PURE__ */
|
|
1870
|
-
|
|
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" }),
|
|
1871
2481
|
"Apply"
|
|
1872
2482
|
] })
|
|
1873
2483
|
] })
|
|
1874
2484
|
] }) });
|
|
1875
2485
|
}
|
|
1876
|
-
function
|
|
1877
|
-
const { client:
|
|
1878
|
-
return { report:
|
|
2486
|
+
function is() {
|
|
2487
|
+
const { client: e } = L();
|
|
2488
|
+
return { report: e.report };
|
|
1879
2489
|
}
|
|
1880
|
-
function
|
|
1881
|
-
const { client:
|
|
1882
|
-
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);
|
|
1883
2493
|
try {
|
|
1884
|
-
const
|
|
1885
|
-
return r(
|
|
1886
|
-
} catch (
|
|
1887
|
-
return l
|
|
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;
|
|
1888
2498
|
} finally {
|
|
1889
2499
|
t(!1);
|
|
1890
2500
|
}
|
|
1891
|
-
}, [
|
|
1892
|
-
return { result: a, execute:
|
|
2501
|
+
}, [e]);
|
|
2502
|
+
return { result: a, execute: c, isLoading: o, error: u };
|
|
1893
2503
|
}
|
|
1894
|
-
function
|
|
1895
|
-
const { client: a } =
|
|
1896
|
-
|
|
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);
|
|
1897
2507
|
try {
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1900
|
-
} catch (
|
|
1901
|
-
|
|
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");
|
|
1902
2512
|
} finally {
|
|
1903
|
-
|
|
2513
|
+
u(!1);
|
|
1904
2514
|
}
|
|
1905
|
-
}, [a,
|
|
1906
|
-
return
|
|
1907
|
-
|
|
1908
|
-
}, [
|
|
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 };
|
|
1909
2519
|
}
|
|
1910
|
-
function
|
|
1911
|
-
const { client: a } =
|
|
1912
|
-
|
|
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);
|
|
1913
2523
|
try {
|
|
1914
|
-
const
|
|
1915
|
-
|
|
1916
|
-
} catch (
|
|
1917
|
-
|
|
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");
|
|
1918
2528
|
} finally {
|
|
1919
|
-
|
|
2529
|
+
u(!1);
|
|
1920
2530
|
}
|
|
1921
|
-
}, [a,
|
|
1922
|
-
return
|
|
1923
|
-
|
|
1924
|
-
}, [
|
|
2531
|
+
}, [a, e]);
|
|
2532
|
+
return U(() => {
|
|
2533
|
+
d();
|
|
2534
|
+
}, [d]), { dashboard: r, isLoading: t, error: i, refresh: d };
|
|
1925
2535
|
}
|
|
1926
|
-
function
|
|
1927
|
-
const
|
|
1928
|
-
const p = new
|
|
1929
|
-
return new
|
|
1930
|
-
}, [
|
|
1931
|
-
|
|
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);
|
|
1932
2542
|
try {
|
|
1933
|
-
const p = await
|
|
1934
|
-
|
|
2543
|
+
const p = await o.getDashboard(a);
|
|
2544
|
+
u(p);
|
|
1935
2545
|
} catch (p) {
|
|
1936
|
-
|
|
2546
|
+
l(p instanceof Error ? p.message : "Failed to load dashboard");
|
|
1937
2547
|
} finally {
|
|
1938
|
-
|
|
2548
|
+
c(!1);
|
|
1939
2549
|
}
|
|
1940
|
-
}, [
|
|
1941
|
-
return
|
|
1942
|
-
|
|
1943
|
-
}, [
|
|
2550
|
+
}, [o, a]);
|
|
2551
|
+
return U(() => {
|
|
2552
|
+
g();
|
|
2553
|
+
}, [g]), { dashboard: t, reportClient: o, isLoading: i, error: d, refresh: g };
|
|
1944
2554
|
}
|
|
1945
|
-
function
|
|
1946
|
-
const { appearance: t } =
|
|
1947
|
-
if (
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1950
|
-
}, [
|
|
1951
|
-
return /* @__PURE__ */
|
|
1952
|
-
a === "both" && /* @__PURE__ */
|
|
1953
|
-
/* @__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(
|
|
1954
2564
|
"button",
|
|
1955
2565
|
{
|
|
1956
2566
|
type: "button",
|
|
1957
2567
|
className: `ss-tab ${p === "nl" ? "ss-tab-active" : ""}`,
|
|
1958
|
-
onClick: () =>
|
|
2568
|
+
onClick: () => f("nl"),
|
|
1959
2569
|
children: "Natural Language"
|
|
1960
2570
|
}
|
|
1961
2571
|
),
|
|
1962
|
-
/* @__PURE__ */
|
|
2572
|
+
/* @__PURE__ */ s(
|
|
1963
2573
|
"button",
|
|
1964
2574
|
{
|
|
1965
2575
|
type: "button",
|
|
1966
2576
|
className: `ss-tab ${p === "sql" ? "ss-tab-active" : ""}`,
|
|
1967
|
-
onClick: () =>
|
|
2577
|
+
onClick: () => f("sql"),
|
|
1968
2578
|
children: "SQL"
|
|
1969
2579
|
}
|
|
1970
2580
|
)
|
|
1971
2581
|
] }),
|
|
1972
|
-
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__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(
|
|
1975
2585
|
"textarea",
|
|
1976
2586
|
{
|
|
1977
2587
|
className: "ss-input ss-query-textarea",
|
|
1978
2588
|
placeholder: r ?? (p === "sql" ? "SELECT ..." : "Ask a question about your data..."),
|
|
1979
|
-
value:
|
|
1980
|
-
onChange: (
|
|
2589
|
+
value: l,
|
|
2590
|
+
onChange: (k) => g(k.target.value),
|
|
1981
2591
|
rows: 3
|
|
1982
2592
|
}
|
|
1983
2593
|
) }),
|
|
1984
|
-
/* @__PURE__ */
|
|
1985
|
-
|
|
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" }),
|
|
1986
2596
|
"Run query"
|
|
1987
2597
|
] })
|
|
1988
2598
|
] })
|
|
1989
2599
|
] }) });
|
|
1990
2600
|
}
|
|
1991
|
-
function
|
|
1992
|
-
const { appearance:
|
|
1993
|
-
const
|
|
1994
|
-
if (
|
|
1995
|
-
if (
|
|
1996
|
-
if (
|
|
1997
|
-
if (typeof
|
|
1998
|
-
return
|
|
1999
|
-
const
|
|
2000
|
-
return
|
|
2001
|
-
}) : a, [a,
|
|
2002
|
-
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")));
|
|
2003
2613
|
};
|
|
2004
|
-
function
|
|
2005
|
-
return
|
|
2614
|
+
function k(v) {
|
|
2615
|
+
return v == null ? "" : typeof v == "object" ? JSON.stringify(v) : String(v);
|
|
2006
2616
|
}
|
|
2007
|
-
return /* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__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(
|
|
2010
2620
|
"th",
|
|
2011
2621
|
{
|
|
2012
|
-
className: `ss-th ${r ? "ss-th-sortable" : ""} ${
|
|
2013
|
-
onClick: () => v
|
|
2622
|
+
className: `ss-th ${r ? "ss-th-sortable" : ""} ${c === v ? l === "asc" ? "ss-sorted-asc" : "ss-sorted-desc" : ""}`,
|
|
2623
|
+
onClick: () => b(v),
|
|
2014
2624
|
children: [
|
|
2015
|
-
|
|
2016
|
-
|
|
2625
|
+
v,
|
|
2626
|
+
c === v && /* @__PURE__ */ s("span", { className: "ss-sort-indicator", children: l === "asc" ? " ▲" : " ▼" })
|
|
2017
2627
|
]
|
|
2018
2628
|
},
|
|
2019
|
-
|
|
2629
|
+
v
|
|
2020
2630
|
)) }) }),
|
|
2021
|
-
/* @__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)) })
|
|
2022
2632
|
] }),
|
|
2023
|
-
|
|
2633
|
+
o && a.length > o && /* @__PURE__ */ n("div", { className: "ss-table-footer", children: [
|
|
2024
2634
|
"Showing ",
|
|
2025
|
-
|
|
2635
|
+
o,
|
|
2026
2636
|
" of ",
|
|
2027
2637
|
a.length,
|
|
2028
2638
|
" rows"
|
|
2029
2639
|
] })
|
|
2030
2640
|
] }) });
|
|
2031
2641
|
}
|
|
2032
|
-
function
|
|
2033
|
-
const r = parseInt(a.replace("#", "").slice(0, 2), 16),
|
|
2034
|
-
for (let t = 0; t <
|
|
2035
|
-
const
|
|
2036
|
-
|
|
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%)`);
|
|
2037
2647
|
}
|
|
2038
|
-
return
|
|
2648
|
+
return o;
|
|
2039
2649
|
}
|
|
2040
|
-
function
|
|
2041
|
-
const
|
|
2042
|
-
return /* @__PURE__ */
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
a.map((
|
|
2045
|
-
const
|
|
2046
|
-
return /* @__PURE__ */
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__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] })
|
|
2049
2659
|
] }, p);
|
|
2050
2660
|
})
|
|
2051
2661
|
] });
|
|
2052
2662
|
}
|
|
2053
|
-
function
|
|
2054
|
-
const
|
|
2055
|
-
const
|
|
2056
|
-
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}`;
|
|
2057
2667
|
});
|
|
2058
|
-
return /* @__PURE__ */
|
|
2668
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2059
2669
|
[0.25, 0.5, 0.75, 1].map((p) => {
|
|
2060
|
-
const
|
|
2061
|
-
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);
|
|
2062
2672
|
}),
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
a.map((p,
|
|
2065
|
-
const
|
|
2066
|
-
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);
|
|
2067
2677
|
})
|
|
2068
2678
|
] });
|
|
2069
2679
|
}
|
|
2070
|
-
function
|
|
2071
|
-
const
|
|
2072
|
-
let
|
|
2073
|
-
const p = a.map((
|
|
2074
|
-
const
|
|
2075
|
-
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;
|
|
2076
2686
|
});
|
|
2077
|
-
return /* @__PURE__ */
|
|
2078
|
-
p.map((
|
|
2687
|
+
return /* @__PURE__ */ n("g", { children: [
|
|
2688
|
+
p.map((f, b) => /* @__PURE__ */ s(
|
|
2079
2689
|
"circle",
|
|
2080
2690
|
{
|
|
2081
|
-
cx:
|
|
2082
|
-
cy:
|
|
2083
|
-
r:
|
|
2691
|
+
cx: i,
|
|
2692
|
+
cy: c,
|
|
2693
|
+
r: d,
|
|
2084
2694
|
fill: "none",
|
|
2085
|
-
stroke:
|
|
2086
|
-
strokeWidth:
|
|
2087
|
-
strokeDasharray: `${
|
|
2088
|
-
strokeDashoffset: -
|
|
2089
|
-
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})`
|
|
2090
2700
|
},
|
|
2091
|
-
|
|
2701
|
+
b
|
|
2092
2702
|
)),
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
] },
|
|
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)) })
|
|
2097
2707
|
] });
|
|
2098
2708
|
}
|
|
2099
|
-
function
|
|
2100
|
-
const { appearance:
|
|
2101
|
-
return /* @__PURE__ */
|
|
2102
|
-
r && /* @__PURE__ */
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
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 })
|
|
2107
2717
|
] })
|
|
2108
2718
|
] }) });
|
|
2109
2719
|
}
|
|
2110
|
-
function
|
|
2111
|
-
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 = _(() => {
|
|
2112
2722
|
if (a) {
|
|
2113
|
-
const
|
|
2114
|
-
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);
|
|
2115
2725
|
}
|
|
2116
|
-
return
|
|
2117
|
-
}, [a, r,
|
|
2118
|
-
|
|
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);
|
|
2119
2729
|
try {
|
|
2120
|
-
const
|
|
2121
|
-
|
|
2122
|
-
const
|
|
2123
|
-
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)
|
|
2124
2734
|
try {
|
|
2125
|
-
const
|
|
2126
|
-
if (
|
|
2127
|
-
const
|
|
2128
|
-
|
|
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;
|
|
2129
2739
|
}
|
|
2130
2740
|
} catch {
|
|
2131
2741
|
}
|
|
2132
|
-
p(
|
|
2133
|
-
} catch (
|
|
2134
|
-
|
|
2742
|
+
p(S);
|
|
2743
|
+
} catch (x) {
|
|
2744
|
+
v(x instanceof Error ? x.message : "Failed to load dashboard");
|
|
2135
2745
|
} finally {
|
|
2136
|
-
|
|
2137
|
-
}
|
|
2138
|
-
}, [
|
|
2139
|
-
return
|
|
2140
|
-
|
|
2141
|
-
}, [
|
|
2142
|
-
if (!
|
|
2143
|
-
const
|
|
2144
|
-
return () => clearInterval(
|
|
2145
|
-
}, [
|
|
2146
|
-
|
|
2147
|
-
/* @__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" }),
|
|
2148
2758
|
" Loading dashboard..."
|
|
2149
2759
|
] }),
|
|
2150
|
-
|
|
2151
|
-
!
|
|
2152
|
-
const
|
|
2153
|
-
if (!
|
|
2154
|
-
const
|
|
2155
|
-
labels:
|
|
2156
|
-
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))
|
|
2157
2767
|
} : { labels: [], values: [] };
|
|
2158
|
-
return /* @__PURE__ */
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
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,
|
|
2162
2772
|
{
|
|
2163
|
-
type:
|
|
2164
|
-
data:
|
|
2165
|
-
width:
|
|
2166
|
-
height:
|
|
2773
|
+
type: x.chartType || "bar",
|
|
2774
|
+
data: z,
|
|
2775
|
+
width: x.w,
|
|
2776
|
+
height: x.h
|
|
2167
2777
|
}
|
|
2168
2778
|
)
|
|
2169
|
-
] },
|
|
2779
|
+
] }, h);
|
|
2170
2780
|
})
|
|
2171
2781
|
] }) });
|
|
2172
2782
|
}
|
|
2173
|
-
function
|
|
2174
|
-
return new Date(
|
|
2783
|
+
function Ve(e) {
|
|
2784
|
+
return new Date(e).toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
|
|
2175
2785
|
}
|
|
2176
|
-
function
|
|
2177
|
-
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) => {
|
|
2178
2788
|
if (!p.generatedSql) return;
|
|
2179
|
-
const
|
|
2180
|
-
|
|
2181
|
-
}, [
|
|
2182
|
-
return /* @__PURE__ */
|
|
2183
|
-
/* @__PURE__ */
|
|
2184
|
-
|
|
2185
|
-
/* @__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" }),
|
|
2186
2796
|
" Loading..."
|
|
2187
2797
|
] }),
|
|
2188
|
-
|
|
2189
|
-
!
|
|
2190
|
-
!
|
|
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(
|
|
2191
2801
|
"div",
|
|
2192
2802
|
{
|
|
2193
2803
|
className: "ss-saved-query-card",
|
|
2194
|
-
onClick: () =>
|
|
2804
|
+
onClick: () => e == null ? void 0 : e(p),
|
|
2195
2805
|
children: [
|
|
2196
|
-
/* @__PURE__ */
|
|
2197
|
-
/* @__PURE__ */
|
|
2198
|
-
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 })
|
|
2199
2809
|
] }),
|
|
2200
|
-
p.naturalLanguage && /* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__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(
|
|
2204
2814
|
"button",
|
|
2205
2815
|
{
|
|
2206
2816
|
type: "button",
|
|
2207
2817
|
className: "ss-btn ss-btn-sm ss-btn-primary",
|
|
2208
|
-
disabled:
|
|
2209
|
-
onClick: (
|
|
2210
|
-
|
|
2818
|
+
disabled: d || !p.generatedSql,
|
|
2819
|
+
onClick: (f) => {
|
|
2820
|
+
f.stopPropagation(), g(p);
|
|
2211
2821
|
},
|
|
2212
|
-
children:
|
|
2822
|
+
children: d ? /* @__PURE__ */ s("span", { className: "ss-spinner" }) : "Run"
|
|
2213
2823
|
}
|
|
2214
2824
|
)
|
|
2215
2825
|
] })
|
|
@@ -2219,105 +2829,106 @@ function Qs({ onSelectQuery: s, onRunQuery: a, appearance: r }) {
|
|
|
2219
2829
|
))
|
|
2220
2830
|
] }) });
|
|
2221
2831
|
}
|
|
2222
|
-
function
|
|
2223
|
-
const
|
|
2224
|
-
const
|
|
2225
|
-
return new
|
|
2226
|
-
}, [
|
|
2227
|
-
|
|
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);
|
|
2228
2838
|
try {
|
|
2229
|
-
const
|
|
2230
|
-
|
|
2839
|
+
const v = await u.getDashboard(a), C = JSON.parse(v.layoutJson || "[]"), x = await Promise.all(
|
|
2840
|
+
C.map(async (h) => {
|
|
2231
2841
|
try {
|
|
2232
|
-
const
|
|
2233
|
-
if (
|
|
2234
|
-
const
|
|
2235
|
-
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 };
|
|
2236
2846
|
}
|
|
2237
2847
|
} catch {
|
|
2238
2848
|
}
|
|
2239
|
-
return
|
|
2849
|
+
return h;
|
|
2240
2850
|
})
|
|
2241
2851
|
);
|
|
2242
|
-
|
|
2243
|
-
} catch (
|
|
2244
|
-
p(
|
|
2852
|
+
c(x);
|
|
2853
|
+
} catch (v) {
|
|
2854
|
+
p(v instanceof Error ? v.message : "Failed to load dashboard");
|
|
2245
2855
|
} finally {
|
|
2246
|
-
|
|
2247
|
-
}
|
|
2248
|
-
}, [
|
|
2249
|
-
return
|
|
2250
|
-
|
|
2251
|
-
}, [
|
|
2252
|
-
if (!
|
|
2253
|
-
const
|
|
2254
|
-
return () => clearInterval(
|
|
2255
|
-
}, [
|
|
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(
|
|
2256
2866
|
"div",
|
|
2257
2867
|
{
|
|
2258
|
-
ref: (
|
|
2259
|
-
if (!
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
const
|
|
2263
|
-
|
|
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);
|
|
2264
2874
|
},
|
|
2265
2875
|
style: { display: "contents" },
|
|
2266
|
-
children: /* @__PURE__ */
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
!
|
|
2270
|
-
if (!
|
|
2271
|
-
const { columns:
|
|
2272
|
-
return /* @__PURE__ */
|
|
2273
|
-
|
|
2274
|
-
/* @__PURE__ */
|
|
2275
|
-
/* @__PURE__ */
|
|
2276
|
-
/* @__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)) })
|
|
2277
2887
|
] })
|
|
2278
|
-
] },
|
|
2888
|
+
] }, C);
|
|
2279
2889
|
})
|
|
2280
2890
|
] })
|
|
2281
2891
|
}
|
|
2282
2892
|
);
|
|
2283
2893
|
}
|
|
2284
2894
|
export {
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
ds as
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
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
|
|
2323
2934
|
};
|