@agg-build/ui 4.19.0 → 4.19.1
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/chunk-CKHECAKV.mjs +2724 -0
- package/dist/{chunk-NSQQ62QK.mjs → chunk-DONMO42Q.mjs} +1 -1
- package/dist/{chunk-GT3DCFIT.mjs → chunk-KRYMEFPL.mjs} +16 -8
- package/dist/{chunk-5YHKIJ23.mjs → chunk-NV6WT3TN.mjs} +481 -826
- package/dist/{chunk-47CCGQH6.mjs → chunk-UXLC3FFY.mjs} +451 -1349
- package/dist/{event-market-2BAMDM5I.mjs → event-market-UREM3ZE7.mjs} +3 -3
- package/dist/index.js +21902 -21626
- package/dist/index.mjs +8 -8
- package/dist/modals.js +898 -335
- package/dist/modals.mjs +5 -5
- package/dist/pages.js +2857 -1683
- package/dist/pages.mjs +4 -4
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1746 -643
- package/dist/trading.mjs +2 -2
- package/dist/types/pages/user-profile/components/available-balance-card.d.mts +2 -1
- package/dist/types/pages/user-profile/components/available-balance-card.d.ts +2 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.mts +3 -1
- package/dist/types/pages/user-profile/components/betdex-account-card.d.ts +3 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.mts +2 -1
- package/dist/types/pages/user-profile/components/betdex-account-transfers.d.ts +2 -1
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.mts +6 -0
- package/dist/types/pages/user-profile/components/betdex-wallet-deposit.d.ts +6 -0
- package/dist/types/profile/tabs/trading-access-tab.d.mts +2 -1
- package/dist/types/profile/tabs/trading-access-tab.d.ts +2 -1
- package/dist/types/trading/manage-betdex-account-modal.d.mts +2 -1
- package/dist/types/trading/manage-betdex-account-modal.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +1 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +1 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +2 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +2 -2
- package/dist/types/withdraw/steps/withdraw-amount.d.mts +3 -1
- package/dist/types/withdraw/steps/withdraw-amount.d.ts +3 -1
- package/dist/types/withdraw/withdraw-modal.types.d.mts +8 -0
- package/dist/types/withdraw/withdraw-modal.types.d.ts +8 -0
- package/package.json +3 -3
- package/dist/chunk-ROA5K67W.mjs +0 -1237
package/dist/chunk-ROA5K67W.mjs
DELETED
|
@@ -1,1237 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
AGG_TERMS_OF_SERVICE_URL,
|
|
4
|
-
BestPricesIcon,
|
|
5
|
-
Button,
|
|
6
|
-
CheckCircleIcon,
|
|
7
|
-
ChevronRightIcon,
|
|
8
|
-
CreateAccountIcon,
|
|
9
|
-
Icon,
|
|
10
|
-
InlineAlert,
|
|
11
|
-
LinkAccountsIcon,
|
|
12
|
-
Modal,
|
|
13
|
-
ProfileIcon,
|
|
14
|
-
RemoteImage,
|
|
15
|
-
StayInControlIcon,
|
|
16
|
-
Typography,
|
|
17
|
-
VenueLogo,
|
|
18
|
-
WarningIcon,
|
|
19
|
-
__async,
|
|
20
|
-
__spreadProps,
|
|
21
|
-
__spreadValues,
|
|
22
|
-
cn
|
|
23
|
-
} from "./chunk-XZVGHKMW.mjs";
|
|
24
|
-
|
|
25
|
-
// src/geo-block-banner/index.tsx
|
|
26
|
-
import { useLabels } from "@agg-build/hooks";
|
|
27
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
-
var GeoBlockBanner = ({
|
|
29
|
-
venue,
|
|
30
|
-
termsUrl = AGG_TERMS_OF_SERVICE_URL,
|
|
31
|
-
className
|
|
32
|
-
}) => {
|
|
33
|
-
const labels = useLabels();
|
|
34
|
-
const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
|
|
35
|
-
return /* @__PURE__ */ jsxs(
|
|
36
|
-
"div",
|
|
37
|
-
{
|
|
38
|
-
className: cn("flex items-center gap-5 rounded-agg-lg bg-agg-secondary-hover p-3", className),
|
|
39
|
-
role: "status",
|
|
40
|
-
children: [
|
|
41
|
-
/* @__PURE__ */ jsxs("p", { className: "min-w-0 flex-1 text-agg-xs leading-agg-4 text-agg-foreground", children: [
|
|
42
|
-
message,
|
|
43
|
-
/* @__PURE__ */ jsx("a", { href: termsUrl, className: "underline", target: "_blank", rel: "noreferrer noopener", children: labels.trading.geoBlockTermsLink }),
|
|
44
|
-
labels.trading.geoBlockMessageSuffix
|
|
45
|
-
] }),
|
|
46
|
-
/* @__PURE__ */ jsx(Icon, { name: "internet-security", className: "h-6 w-6 shrink-0 text-agg-muted-foreground" })
|
|
47
|
-
]
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
GeoBlockBanner.displayName = "GeoBlockBanner";
|
|
52
|
-
|
|
53
|
-
// src/kyc/shared-kyc-modal.tsx
|
|
54
|
-
import { useLabels as useLabels2 } from "@agg-build/hooks";
|
|
55
|
-
import * as Dialog from "@radix-ui/react-dialog";
|
|
56
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
57
|
-
var SharedKycModal = ({
|
|
58
|
-
open,
|
|
59
|
-
state = "initial",
|
|
60
|
-
errorMessage,
|
|
61
|
-
onOpenChange,
|
|
62
|
-
onStartVerification
|
|
63
|
-
}) => {
|
|
64
|
-
const labels = useLabels2();
|
|
65
|
-
const modalLabels = labels.trading.sharedKyc.modal;
|
|
66
|
-
const isInitiating = state === "initiating";
|
|
67
|
-
const handleOpenChange = (nextOpen) => {
|
|
68
|
-
if (isInitiating && !nextOpen) return;
|
|
69
|
-
onOpenChange(nextOpen);
|
|
70
|
-
};
|
|
71
|
-
return /* @__PURE__ */ jsx2(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs2(
|
|
72
|
-
Modal.Container,
|
|
73
|
-
{
|
|
74
|
-
maxWidth: "420px",
|
|
75
|
-
"aria-label": modalLabels.ariaLabel,
|
|
76
|
-
classNames: { container: "!rounded-agg-2xl" },
|
|
77
|
-
children: [
|
|
78
|
-
/* @__PURE__ */ jsx2("div", { className: "flex h-14 shrink-0 items-center justify-end px-5", children: /* @__PURE__ */ jsx2(
|
|
79
|
-
Dialog.Close,
|
|
80
|
-
{
|
|
81
|
-
"aria-label": labels.common.close,
|
|
82
|
-
disabled: isInitiating,
|
|
83
|
-
className: "flex size-11 cursor-pointer items-center justify-center rounded-agg-full text-agg-foreground hover:bg-agg-secondary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
84
|
-
children: /* @__PURE__ */ jsx2(Icon, { name: "close", size: "small", "aria-hidden": "true" })
|
|
85
|
-
}
|
|
86
|
-
) }),
|
|
87
|
-
/* @__PURE__ */ jsx2(Modal.Body, { classNames: { root: "!px-8 !pb-9 !pt-0" }, children: state === "success" ? /* @__PURE__ */ jsxs2(
|
|
88
|
-
"div",
|
|
89
|
-
{
|
|
90
|
-
className: "flex flex-col items-center gap-6 text-center",
|
|
91
|
-
role: "status",
|
|
92
|
-
"aria-live": "polite",
|
|
93
|
-
children: [
|
|
94
|
-
/* @__PURE__ */ jsx2("div", { className: "flex size-12 items-center justify-center rounded-agg-full border border-agg-success bg-agg-success/10 text-agg-success", children: /* @__PURE__ */ jsx2(Icon, { name: "success-check", className: "size-5", "aria-hidden": "true" }) }),
|
|
95
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-2", children: [
|
|
96
|
-
/* @__PURE__ */ jsx2(Dialog.Title, { children: /* @__PURE__ */ jsx2(Typography, { as: "span", variant: "body-large-strong", children: modalLabels.successTitle }) }),
|
|
97
|
-
/* @__PURE__ */ jsx2(Dialog.Description, { children: /* @__PURE__ */ jsx2(Typography, { as: "span", variant: "label", className: "text-pretty text-agg-foreground", children: modalLabels.successDescription }) })
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ jsx2(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: modalLabels.done })
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
) : /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-6 text-center", children: [
|
|
103
|
-
/* @__PURE__ */ jsx2(
|
|
104
|
-
Icon,
|
|
105
|
-
{
|
|
106
|
-
name: "user-trust",
|
|
107
|
-
className: "h-12! w-12! text-agg-muted-foreground",
|
|
108
|
-
"aria-hidden": "true"
|
|
109
|
-
}
|
|
110
|
-
),
|
|
111
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-2", children: [
|
|
112
|
-
/* @__PURE__ */ jsx2(Dialog.Title, { children: /* @__PURE__ */ jsx2(Typography, { as: "span", variant: "body-large-strong", children: state === "pending" ? modalLabels.pendingTitle : modalLabels.title }) }),
|
|
113
|
-
/* @__PURE__ */ jsx2(Dialog.Description, { children: /* @__PURE__ */ jsx2(Typography, { as: "span", variant: "label", className: "text-pretty text-agg-foreground", children: state === "pending" ? modalLabels.pendingDescription : modalLabels.freeDescription }) })
|
|
114
|
-
] }),
|
|
115
|
-
state === "error" || state === "pending" && errorMessage ? /* @__PURE__ */ jsx2(
|
|
116
|
-
InlineAlert,
|
|
117
|
-
{
|
|
118
|
-
tone: "error",
|
|
119
|
-
variant: "surface",
|
|
120
|
-
message: errorMessage || modalLabels.error
|
|
121
|
-
}
|
|
122
|
-
) : null,
|
|
123
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-4", children: [
|
|
124
|
-
/* @__PURE__ */ jsx2(
|
|
125
|
-
Button,
|
|
126
|
-
{
|
|
127
|
-
variant: "primary",
|
|
128
|
-
size: "large",
|
|
129
|
-
isLoading: isInitiating,
|
|
130
|
-
disabled: isInitiating,
|
|
131
|
-
"aria-label": state === "pending" ? modalLabels.checkStatus : modalLabels.startVerification,
|
|
132
|
-
onClick: onStartVerification,
|
|
133
|
-
children: state === "pending" ? modalLabels.checkStatus : modalLabels.startVerification
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
/* @__PURE__ */ jsx2(
|
|
137
|
-
Button,
|
|
138
|
-
{
|
|
139
|
-
variant: "tertiary",
|
|
140
|
-
size: "large",
|
|
141
|
-
disabled: isInitiating,
|
|
142
|
-
onClick: () => handleOpenChange(false),
|
|
143
|
-
children: modalLabels.doItLater
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] })
|
|
147
|
-
] }) })
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
) });
|
|
151
|
-
};
|
|
152
|
-
SharedKycModal.displayName = "SharedKycModal";
|
|
153
|
-
|
|
154
|
-
// src/onboarding/steps/how-it-works.tsx
|
|
155
|
-
import { useCallback, useRef, useState } from "react";
|
|
156
|
-
import { useLabels as useLabels3 } from "@agg-build/hooks";
|
|
157
|
-
|
|
158
|
-
// src/onboarding/onboarding-modal.constants.ts
|
|
159
|
-
import { isVenueActive, Venue } from "@agg-build/sdk";
|
|
160
|
-
var HOW_IT_WORKS_FEATURE_KEYS = [
|
|
161
|
-
"createAccount",
|
|
162
|
-
"linkAccounts",
|
|
163
|
-
"bestPrices",
|
|
164
|
-
"stayInControl"
|
|
165
|
-
];
|
|
166
|
-
var ONBOARDING_STEPS = {
|
|
167
|
-
HOW_IT_WORKS: 0,
|
|
168
|
-
PROFILE_SETUP: 1,
|
|
169
|
-
CONNECT_ACCOUNTS: 2
|
|
170
|
-
};
|
|
171
|
-
var ONCHAIN_VENUES = [
|
|
172
|
-
Venue.polymarket,
|
|
173
|
-
Venue.opinion,
|
|
174
|
-
Venue.predict,
|
|
175
|
-
Venue.pred
|
|
176
|
-
].filter(isVenueActive);
|
|
177
|
-
|
|
178
|
-
// src/onboarding/steps/how-it-works.tsx
|
|
179
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
180
|
-
var defaultIcons = {
|
|
181
|
-
createAccount: /* @__PURE__ */ jsx3(CreateAccountIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
182
|
-
linkAccounts: /* @__PURE__ */ jsx3(LinkAccountsIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
183
|
-
bestPrices: /* @__PURE__ */ jsx3(BestPricesIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" }),
|
|
184
|
-
stayInControl: /* @__PURE__ */ jsx3(StayInControlIcon, { className: "h-[28px] w-[28px] text-agg-muted-foreground" })
|
|
185
|
-
};
|
|
186
|
-
var HowItWorksStep = ({ onContinue, icons }) => {
|
|
187
|
-
const labels = useLabels3();
|
|
188
|
-
const scrollRef = useRef(null);
|
|
189
|
-
const [showTopGradient, setShowTopGradient] = useState(false);
|
|
190
|
-
const [showBottomGradient, setShowBottomGradient] = useState(true);
|
|
191
|
-
const handleScroll = useCallback(() => {
|
|
192
|
-
const el = scrollRef.current;
|
|
193
|
-
if (!el) return;
|
|
194
|
-
setShowTopGradient(el.scrollTop > 0);
|
|
195
|
-
setShowBottomGradient(el.scrollTop + el.clientHeight < el.scrollHeight - 1);
|
|
196
|
-
}, []);
|
|
197
|
-
return /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-6 h-[600px] sm:h-auto", children: [
|
|
198
|
-
/* @__PURE__ */ jsx3("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.howItWorks.title }),
|
|
199
|
-
/* @__PURE__ */ jsxs3("div", { className: "relative flex-1 min-h-0 sm:flex-initial", children: [
|
|
200
|
-
/* @__PURE__ */ jsx3(
|
|
201
|
-
"div",
|
|
202
|
-
{
|
|
203
|
-
ref: scrollRef,
|
|
204
|
-
onScroll: handleScroll,
|
|
205
|
-
className: "flex flex-col gap-4 overflow-y-auto sm:overflow-visible h-full",
|
|
206
|
-
children: HOW_IT_WORKS_FEATURE_KEYS.map((featureKey) => {
|
|
207
|
-
var _a;
|
|
208
|
-
const icon = (_a = icons == null ? void 0 : icons[featureKey]) != null ? _a : defaultIcons[featureKey];
|
|
209
|
-
const feature = labels.onboarding.howItWorks.features[featureKey];
|
|
210
|
-
return /* @__PURE__ */ jsxs3(
|
|
211
|
-
"div",
|
|
212
|
-
{
|
|
213
|
-
className: cn(
|
|
214
|
-
"flex items-center gap-4 py-4 px-5 sm:px-4",
|
|
215
|
-
"rounded-agg-md",
|
|
216
|
-
"bg-agg-secondary-hover"
|
|
217
|
-
),
|
|
218
|
-
children: [
|
|
219
|
-
/* @__PURE__ */ jsxs3("div", { className: "flex flex-col flex-1 min-w-0 gap-[6px]", children: [
|
|
220
|
-
/* @__PURE__ */ jsx3("p", { className: "text-agg-base font-agg-bold leading-agg-6 text-agg-foreground", children: feature.title }),
|
|
221
|
-
/* @__PURE__ */ jsx3("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: feature.description })
|
|
222
|
-
] }),
|
|
223
|
-
icon ? /* @__PURE__ */ jsx3("div", { className: "hidden shrink-0 items-center justify-center text-agg-muted-foreground sm:flex", children: icon }) : null
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
featureKey
|
|
227
|
-
);
|
|
228
|
-
})
|
|
229
|
-
}
|
|
230
|
-
),
|
|
231
|
-
/* @__PURE__ */ jsx3(
|
|
232
|
-
"div",
|
|
233
|
-
{
|
|
234
|
-
className: cn(
|
|
235
|
-
"pointer-events-none absolute inset-x-0 top-0 h-20",
|
|
236
|
-
"bg-gradient-to-b from-agg-secondary to-transparent",
|
|
237
|
-
"sm:hidden transition-opacity",
|
|
238
|
-
showTopGradient ? "opacity-100" : "opacity-0"
|
|
239
|
-
)
|
|
240
|
-
}
|
|
241
|
-
),
|
|
242
|
-
/* @__PURE__ */ jsx3(
|
|
243
|
-
"div",
|
|
244
|
-
{
|
|
245
|
-
className: cn(
|
|
246
|
-
"pointer-events-none absolute inset-x-0 bottom-0 h-20",
|
|
247
|
-
"bg-gradient-to-t from-agg-secondary to-transparent",
|
|
248
|
-
"sm:hidden transition-opacity",
|
|
249
|
-
showBottomGradient ? "opacity-100" : "opacity-0"
|
|
250
|
-
)
|
|
251
|
-
}
|
|
252
|
-
)
|
|
253
|
-
] }),
|
|
254
|
-
/* @__PURE__ */ jsx3(Button, { variant: "primary", size: "large", className: "w-full", onClick: onContinue, children: labels.onboarding.howItWorks.continue })
|
|
255
|
-
] });
|
|
256
|
-
};
|
|
257
|
-
HowItWorksStep.displayName = "HowItWorksStep";
|
|
258
|
-
|
|
259
|
-
// src/onboarding/steps/profile-setup.tsx
|
|
260
|
-
import { useCallback as useCallback2, useRef as useRef2, useState as useState2 } from "react";
|
|
261
|
-
import { useLabels as useLabels4 } from "@agg-build/hooks";
|
|
262
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
263
|
-
var ProfileSetupStep = ({ onContinue }) => {
|
|
264
|
-
const labels = useLabels4();
|
|
265
|
-
const [username, setUsername] = useState2("");
|
|
266
|
-
const [avatarFile, setAvatarFile] = useState2();
|
|
267
|
-
const [avatarPreview, setAvatarPreview] = useState2();
|
|
268
|
-
const fileInputRef = useRef2(null);
|
|
269
|
-
const handleAvatarClick = useCallback2(() => {
|
|
270
|
-
var _a;
|
|
271
|
-
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
272
|
-
}, []);
|
|
273
|
-
const handleFileChange = useCallback2((e) => {
|
|
274
|
-
var _a;
|
|
275
|
-
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
276
|
-
if (!file) return;
|
|
277
|
-
setAvatarFile(file);
|
|
278
|
-
const reader = new FileReader();
|
|
279
|
-
reader.onload = (event) => {
|
|
280
|
-
var _a2;
|
|
281
|
-
setAvatarPreview((_a2 = event.target) == null ? void 0 : _a2.result);
|
|
282
|
-
};
|
|
283
|
-
reader.readAsDataURL(file);
|
|
284
|
-
}, []);
|
|
285
|
-
const handleContinue = useCallback2(() => {
|
|
286
|
-
onContinue({
|
|
287
|
-
username,
|
|
288
|
-
avatarFile,
|
|
289
|
-
avatarPreview
|
|
290
|
-
});
|
|
291
|
-
}, [username, avatarFile, avatarPreview, onContinue]);
|
|
292
|
-
return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-7", children: [
|
|
293
|
-
/* @__PURE__ */ jsx4("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
|
|
294
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-5 items-center w-full", children: [
|
|
295
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex justify-center", children: [
|
|
296
|
-
/* @__PURE__ */ jsxs4(
|
|
297
|
-
"button",
|
|
298
|
-
{
|
|
299
|
-
type: "button",
|
|
300
|
-
onClick: handleAvatarClick,
|
|
301
|
-
className: cn(
|
|
302
|
-
"group relative flex items-center justify-center",
|
|
303
|
-
"h-[80px] w-[80px]",
|
|
304
|
-
"rounded-agg-full",
|
|
305
|
-
"bg-agg-secondary-hover",
|
|
306
|
-
!avatarPreview && "hover:bg-agg-tertiary",
|
|
307
|
-
"transition-colors cursor-pointer",
|
|
308
|
-
"overflow-hidden"
|
|
309
|
-
),
|
|
310
|
-
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
311
|
-
children: [
|
|
312
|
-
!avatarPreview ? /* @__PURE__ */ jsx4(
|
|
313
|
-
"svg",
|
|
314
|
-
{
|
|
315
|
-
"aria-hidden": true,
|
|
316
|
-
viewBox: "0 0 80 80",
|
|
317
|
-
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
318
|
-
children: /* @__PURE__ */ jsx4(
|
|
319
|
-
"circle",
|
|
320
|
-
{
|
|
321
|
-
cx: "40",
|
|
322
|
-
cy: "40",
|
|
323
|
-
r: "39.5",
|
|
324
|
-
fill: "none",
|
|
325
|
-
stroke: "currentColor",
|
|
326
|
-
strokeWidth: "1",
|
|
327
|
-
strokeDasharray: "8 8"
|
|
328
|
-
}
|
|
329
|
-
)
|
|
330
|
-
}
|
|
331
|
-
) : null,
|
|
332
|
-
avatarPreview ? /* @__PURE__ */ jsx4(
|
|
333
|
-
RemoteImage,
|
|
334
|
-
{
|
|
335
|
-
src: avatarPreview,
|
|
336
|
-
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
337
|
-
className: "h-full w-full object-cover"
|
|
338
|
-
}
|
|
339
|
-
) : /* @__PURE__ */ jsx4(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
|
|
340
|
-
]
|
|
341
|
-
}
|
|
342
|
-
),
|
|
343
|
-
/* @__PURE__ */ jsx4(
|
|
344
|
-
"input",
|
|
345
|
-
{
|
|
346
|
-
ref: fileInputRef,
|
|
347
|
-
type: "file",
|
|
348
|
-
accept: "image/*",
|
|
349
|
-
onChange: handleFileChange,
|
|
350
|
-
className: "hidden",
|
|
351
|
-
"aria-hidden": "true"
|
|
352
|
-
}
|
|
353
|
-
)
|
|
354
|
-
] }),
|
|
355
|
-
/* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
356
|
-
/* @__PURE__ */ jsx4(
|
|
357
|
-
"label",
|
|
358
|
-
{
|
|
359
|
-
htmlFor: "onboarding-username",
|
|
360
|
-
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
361
|
-
children: labels.onboarding.profileSetup.usernameLabel
|
|
362
|
-
}
|
|
363
|
-
),
|
|
364
|
-
/* @__PURE__ */ jsx4(
|
|
365
|
-
"input",
|
|
366
|
-
{
|
|
367
|
-
id: "onboarding-username",
|
|
368
|
-
type: "text",
|
|
369
|
-
value: username,
|
|
370
|
-
onChange: (e) => setUsername(e.target.value),
|
|
371
|
-
placeholder: labels.onboarding.profileSetup.usernamePlaceholder,
|
|
372
|
-
className: cn(
|
|
373
|
-
"w-full px-3 py-2.5",
|
|
374
|
-
"rounded-[4px]",
|
|
375
|
-
"border border-agg-separator",
|
|
376
|
-
"bg-agg-secondary text-agg-foreground",
|
|
377
|
-
"placeholder:text-agg-muted-foreground",
|
|
378
|
-
"outline-none",
|
|
379
|
-
"hover:bg-agg-secondary-hover",
|
|
380
|
-
"focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
381
|
-
"transition-colors",
|
|
382
|
-
"text-agg-sm sm:text-agg-base"
|
|
383
|
-
)
|
|
384
|
-
}
|
|
385
|
-
)
|
|
386
|
-
] })
|
|
387
|
-
] }),
|
|
388
|
-
/* @__PURE__ */ jsx4(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
|
|
389
|
-
] });
|
|
390
|
-
};
|
|
391
|
-
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
392
|
-
|
|
393
|
-
// src/onboarding/steps/connect-accounts.tsx
|
|
394
|
-
import { useLabels as useLabels5 } from "@agg-build/hooks";
|
|
395
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
396
|
-
var OnchainVenueLogos = () => {
|
|
397
|
-
return /* @__PURE__ */ jsx5("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsx5("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ jsx5(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
|
|
398
|
-
};
|
|
399
|
-
var VenueCard = ({
|
|
400
|
-
logos,
|
|
401
|
-
title,
|
|
402
|
-
mobileTitle,
|
|
403
|
-
description,
|
|
404
|
-
mobileDescription,
|
|
405
|
-
onConnect,
|
|
406
|
-
connected = false
|
|
407
|
-
}) => {
|
|
408
|
-
const labels = useLabels5();
|
|
409
|
-
const action = connected ? /* @__PURE__ */ jsx5(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx5(
|
|
410
|
-
Button,
|
|
411
|
-
{
|
|
412
|
-
variant: "tertiary",
|
|
413
|
-
size: "large",
|
|
414
|
-
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
415
|
-
onClick: onConnect,
|
|
416
|
-
children: labels.onboarding.connectAccounts.connect
|
|
417
|
-
}
|
|
418
|
-
);
|
|
419
|
-
const mobileAction = connected ? /* @__PURE__ */ jsx5(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ jsx5(
|
|
420
|
-
Button,
|
|
421
|
-
{
|
|
422
|
-
variant: "tertiary",
|
|
423
|
-
size: "medium",
|
|
424
|
-
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
425
|
-
onClick: onConnect,
|
|
426
|
-
suffix: /* @__PURE__ */ jsx5(ChevronRightIcon, { className: "h-4 w-4" }),
|
|
427
|
-
children: labels.onboarding.connectAccounts.connectAccount
|
|
428
|
-
}
|
|
429
|
-
);
|
|
430
|
-
return /* @__PURE__ */ jsxs5(
|
|
431
|
-
"div",
|
|
432
|
-
{
|
|
433
|
-
className: cn(
|
|
434
|
-
"rounded-agg-md p-5 transition-colors",
|
|
435
|
-
connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
|
|
436
|
-
),
|
|
437
|
-
children: [
|
|
438
|
-
/* @__PURE__ */ jsxs5("div", { className: "hidden sm:flex items-center justify-between", children: [
|
|
439
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-5", children: [
|
|
440
|
-
/* @__PURE__ */ jsx5("div", { className: "shrink-0", children: logos }),
|
|
441
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-[2px]", children: [
|
|
442
|
-
/* @__PURE__ */ jsx5("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
|
|
443
|
-
/* @__PURE__ */ jsx5("p", { className: "text-agg-sm text-agg-foreground", children: description })
|
|
444
|
-
] })
|
|
445
|
-
] }),
|
|
446
|
-
/* @__PURE__ */ jsx5("div", { className: "shrink-0", children: action })
|
|
447
|
-
] }),
|
|
448
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-3 sm:hidden", children: [
|
|
449
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-3", children: [
|
|
450
|
-
/* @__PURE__ */ jsx5("div", { className: "shrink-0", children: logos }),
|
|
451
|
-
/* @__PURE__ */ jsx5("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
|
|
452
|
-
] }),
|
|
453
|
-
/* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-start gap-2", children: [
|
|
454
|
-
/* @__PURE__ */ jsx5("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
|
|
455
|
-
mobileAction
|
|
456
|
-
] })
|
|
457
|
-
] })
|
|
458
|
-
]
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
};
|
|
462
|
-
var ConnectAccountsStep = ({
|
|
463
|
-
onConnectOnchain,
|
|
464
|
-
onContinue,
|
|
465
|
-
connectedOnchain = false
|
|
466
|
-
}) => {
|
|
467
|
-
const labels = useLabels5();
|
|
468
|
-
const canContinue = connectedOnchain;
|
|
469
|
-
return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-6", children: [
|
|
470
|
-
/* @__PURE__ */ jsx5("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
|
|
471
|
-
/* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsx5(
|
|
472
|
-
VenueCard,
|
|
473
|
-
{
|
|
474
|
-
logos: /* @__PURE__ */ jsx5(OnchainVenueLogos, {}),
|
|
475
|
-
title: labels.onboarding.connectAccounts.onchainTitle,
|
|
476
|
-
mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
|
|
477
|
-
ONCHAIN_VENUES.length - 1
|
|
478
|
-
),
|
|
479
|
-
description: labels.onboarding.connectAccounts.onchainDescription,
|
|
480
|
-
mobileDescription: labels.onboarding.connectAccounts.onchainMobileDescription,
|
|
481
|
-
onConnect: onConnectOnchain,
|
|
482
|
-
connected: connectedOnchain
|
|
483
|
-
}
|
|
484
|
-
) }),
|
|
485
|
-
/* @__PURE__ */ jsx5(
|
|
486
|
-
Button,
|
|
487
|
-
{
|
|
488
|
-
variant: "primary",
|
|
489
|
-
size: "large",
|
|
490
|
-
className: "w-full",
|
|
491
|
-
onClick: onContinue,
|
|
492
|
-
disabled: !canContinue,
|
|
493
|
-
children: labels.onboarding.connectAccounts.continue
|
|
494
|
-
}
|
|
495
|
-
)
|
|
496
|
-
] });
|
|
497
|
-
};
|
|
498
|
-
ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
499
|
-
|
|
500
|
-
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
501
|
-
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
502
|
-
import { useLabels as useLabels6 } from "@agg-build/hooks";
|
|
503
|
-
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
504
|
-
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
505
|
-
var ConnectOnchainModal = ({
|
|
506
|
-
open,
|
|
507
|
-
onOpenChange,
|
|
508
|
-
onConnect
|
|
509
|
-
}) => {
|
|
510
|
-
const labels = useLabels6();
|
|
511
|
-
const [connecting, setConnecting] = useState3(false);
|
|
512
|
-
const [error, setError] = useState3();
|
|
513
|
-
const handleCancel = useCallback3(() => {
|
|
514
|
-
onOpenChange(false);
|
|
515
|
-
}, [onOpenChange]);
|
|
516
|
-
const handleConnect = useCallback3(() => __async(null, null, function* () {
|
|
517
|
-
if (connecting) return;
|
|
518
|
-
setConnecting(true);
|
|
519
|
-
setError(void 0);
|
|
520
|
-
try {
|
|
521
|
-
yield onConnect();
|
|
522
|
-
onOpenChange(false);
|
|
523
|
-
} catch (err) {
|
|
524
|
-
setError(
|
|
525
|
-
err instanceof Error ? err.message : labels.onboarding.connectOnchainModal.fallbackError
|
|
526
|
-
);
|
|
527
|
-
} finally {
|
|
528
|
-
setConnecting(false);
|
|
529
|
-
}
|
|
530
|
-
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
531
|
-
const handleOpenChange = useCallback3(
|
|
532
|
-
(value) => {
|
|
533
|
-
if (value) {
|
|
534
|
-
setError(void 0);
|
|
535
|
-
setConnecting(false);
|
|
536
|
-
}
|
|
537
|
-
onOpenChange(value);
|
|
538
|
-
},
|
|
539
|
-
[onOpenChange]
|
|
540
|
-
);
|
|
541
|
-
return /* @__PURE__ */ jsx6(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs6(
|
|
542
|
-
Modal.Container,
|
|
543
|
-
{
|
|
544
|
-
maxWidth: "600px",
|
|
545
|
-
"aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
|
|
546
|
-
classNames: { container: "!rounded-agg-lg" },
|
|
547
|
-
children: [
|
|
548
|
-
/* @__PURE__ */ jsx6(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
|
|
549
|
-
/* @__PURE__ */ jsx6(
|
|
550
|
-
Modal.Header,
|
|
551
|
-
{
|
|
552
|
-
hideClose: false,
|
|
553
|
-
hideBorder: true,
|
|
554
|
-
classNames: {
|
|
555
|
-
root: "!min-h-0",
|
|
556
|
-
container: "!py-[18px] !px-8"
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
),
|
|
560
|
-
/* @__PURE__ */ jsx6(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
561
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
562
|
-
/* @__PURE__ */ jsx6("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
|
|
563
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
|
|
564
|
-
] }),
|
|
565
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
|
|
566
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
|
|
567
|
-
/* @__PURE__ */ jsx6("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-[6px]", children: [
|
|
568
|
-
index > 0 && /* @__PURE__ */ jsx6("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
|
|
569
|
-
/* @__PURE__ */ jsx6(VenueLogo, { venue, size: "medium" }),
|
|
570
|
-
/* @__PURE__ */ jsx6("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
|
|
571
|
-
] }, venue)) })
|
|
572
|
-
] }),
|
|
573
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-6 items-center", children: [
|
|
574
|
-
/* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-3 items-center", children: [
|
|
575
|
-
error ? /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
576
|
-
/* @__PURE__ */ jsx6(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
577
|
-
/* @__PURE__ */ jsx6("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
578
|
-
] }) : null,
|
|
579
|
-
/* @__PURE__ */ jsx6(
|
|
580
|
-
Button,
|
|
581
|
-
{
|
|
582
|
-
variant: "primary",
|
|
583
|
-
size: "large",
|
|
584
|
-
onClick: handleConnect,
|
|
585
|
-
isLoading: connecting,
|
|
586
|
-
children: labels.onboarding.connectOnchainModal.connect
|
|
587
|
-
}
|
|
588
|
-
)
|
|
589
|
-
] }),
|
|
590
|
-
/* @__PURE__ */ jsx6(
|
|
591
|
-
Button,
|
|
592
|
-
{
|
|
593
|
-
variant: "tertiary",
|
|
594
|
-
size: "medium",
|
|
595
|
-
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
596
|
-
onClick: handleCancel,
|
|
597
|
-
children: labels.onboarding.connectOnchainModal.cancel
|
|
598
|
-
}
|
|
599
|
-
)
|
|
600
|
-
] })
|
|
601
|
-
] }) })
|
|
602
|
-
]
|
|
603
|
-
}
|
|
604
|
-
) });
|
|
605
|
-
};
|
|
606
|
-
ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
607
|
-
|
|
608
|
-
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
609
|
-
import { getVenueAvailabilityState, useAppConfig, useLabels as useLabels7 } from "@agg-build/hooks";
|
|
610
|
-
import { Venue as Venue2 } from "@agg-build/sdk";
|
|
611
|
-
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
612
|
-
import { useCallback as useCallback4, useEffect, useId, useMemo, useRef as useRef3, useState as useState4 } from "react";
|
|
613
|
-
import { z } from "zod";
|
|
614
|
-
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
615
|
-
var kalshiCredentialsSchema = z.object({
|
|
616
|
-
apiKeyId: z.string().trim().min(1),
|
|
617
|
-
privateKey: z.string().trim().min(1)
|
|
618
|
-
});
|
|
619
|
-
var getSafeConnectionError = ({
|
|
620
|
-
apiKeyId,
|
|
621
|
-
error,
|
|
622
|
-
fallback,
|
|
623
|
-
privateKey
|
|
624
|
-
}) => {
|
|
625
|
-
if (!(error instanceof Error) || !error.message.trim()) return fallback;
|
|
626
|
-
return [apiKeyId, privateKey].filter(Boolean).reduce(
|
|
627
|
-
(message, sensitiveValue) => message.split(sensitiveValue).join("[redacted]"),
|
|
628
|
-
error.message
|
|
629
|
-
).trim();
|
|
630
|
-
};
|
|
631
|
-
var CloseButton = ({
|
|
632
|
-
className,
|
|
633
|
-
disabled
|
|
634
|
-
}) => {
|
|
635
|
-
const labels = useLabels7();
|
|
636
|
-
return /* @__PURE__ */ jsx7(
|
|
637
|
-
Dialog3.Close,
|
|
638
|
-
{
|
|
639
|
-
"aria-label": labels.common.close,
|
|
640
|
-
disabled,
|
|
641
|
-
className: cn(
|
|
642
|
-
"z-30 flex size-6 cursor-pointer items-center justify-center rounded-agg-full",
|
|
643
|
-
"text-agg-foreground transition-colors hover:text-agg-foreground/80",
|
|
644
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent",
|
|
645
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
646
|
-
className
|
|
647
|
-
),
|
|
648
|
-
children: /* @__PURE__ */ jsx7(Icon, { name: "close", size: "medium", className: "!text-agg-foreground" })
|
|
649
|
-
}
|
|
650
|
-
);
|
|
651
|
-
};
|
|
652
|
-
var ConnectKalshiModal = ({
|
|
653
|
-
open,
|
|
654
|
-
onOpenChange,
|
|
655
|
-
onVerify
|
|
656
|
-
}) => {
|
|
657
|
-
const labels = useLabels7();
|
|
658
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = useAppConfig();
|
|
659
|
-
const apiKeyInputRef = useRef3(null);
|
|
660
|
-
const errorId = useId();
|
|
661
|
-
const [apiKeyId, setApiKeyId] = useState4("");
|
|
662
|
-
const [privateKey, setPrivateKey] = useState4("");
|
|
663
|
-
const [isVerifying, setIsVerifying] = useState4(false);
|
|
664
|
-
const [isConnected, setIsConnected] = useState4(false);
|
|
665
|
-
const [error, setError] = useState4();
|
|
666
|
-
const availabilityState = getVenueAvailabilityState({
|
|
667
|
-
venueId: Venue2.kalshi,
|
|
668
|
-
disabledVenues,
|
|
669
|
-
isConfigLoading: isAppConfigLoading
|
|
670
|
-
});
|
|
671
|
-
const parsedCredentials = useMemo(
|
|
672
|
-
() => kalshiCredentialsSchema.safeParse({ apiKeyId, privateKey }),
|
|
673
|
-
[apiKeyId, privateKey]
|
|
674
|
-
);
|
|
675
|
-
useEffect(() => {
|
|
676
|
-
if (!open) return;
|
|
677
|
-
setApiKeyId("");
|
|
678
|
-
setPrivateKey("");
|
|
679
|
-
setError(void 0);
|
|
680
|
-
setIsVerifying(false);
|
|
681
|
-
setIsConnected(false);
|
|
682
|
-
}, [open]);
|
|
683
|
-
const handleOpenAutoFocus = useCallback4((event) => {
|
|
684
|
-
var _a;
|
|
685
|
-
event.preventDefault();
|
|
686
|
-
(_a = apiKeyInputRef.current) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
687
|
-
}, []);
|
|
688
|
-
const handleOpenChange = useCallback4(
|
|
689
|
-
(nextOpen) => {
|
|
690
|
-
if (isVerifying && !nextOpen) return;
|
|
691
|
-
onOpenChange(nextOpen);
|
|
692
|
-
},
|
|
693
|
-
[isVerifying, onOpenChange]
|
|
694
|
-
);
|
|
695
|
-
const handleVerify = useCallback4(() => __async(null, null, function* () {
|
|
696
|
-
if (!parsedCredentials.success || isVerifying || isConnected) return;
|
|
697
|
-
const credentials = parsedCredentials.data;
|
|
698
|
-
setIsVerifying(true);
|
|
699
|
-
setError(void 0);
|
|
700
|
-
try {
|
|
701
|
-
yield onVerify(credentials);
|
|
702
|
-
setApiKeyId("");
|
|
703
|
-
setPrivateKey("");
|
|
704
|
-
setIsConnected(true);
|
|
705
|
-
} catch (verificationError) {
|
|
706
|
-
setError(
|
|
707
|
-
getSafeConnectionError(__spreadProps(__spreadValues({}, credentials), {
|
|
708
|
-
error: verificationError,
|
|
709
|
-
fallback: labels.onboarding.connectKalshiModal.fallbackError
|
|
710
|
-
}))
|
|
711
|
-
);
|
|
712
|
-
} finally {
|
|
713
|
-
setIsVerifying(false);
|
|
714
|
-
}
|
|
715
|
-
}), [
|
|
716
|
-
isConnected,
|
|
717
|
-
isVerifying,
|
|
718
|
-
labels.onboarding.connectKalshiModal.fallbackError,
|
|
719
|
-
onVerify,
|
|
720
|
-
parsedCredentials
|
|
721
|
-
]);
|
|
722
|
-
const handleSubmit = useCallback4(
|
|
723
|
-
(event) => {
|
|
724
|
-
event.preventDefault();
|
|
725
|
-
void handleVerify();
|
|
726
|
-
},
|
|
727
|
-
[handleVerify]
|
|
728
|
-
);
|
|
729
|
-
if (availabilityState === "hidden") return null;
|
|
730
|
-
return /* @__PURE__ */ jsx7(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsx7(
|
|
731
|
-
Modal.Container,
|
|
732
|
-
{
|
|
733
|
-
maxWidth: isConnected ? "480px" : "600px",
|
|
734
|
-
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
735
|
-
classNames: {
|
|
736
|
-
container: "!rounded-t-agg-xl !rounded-b-none md:!rounded-agg-2xl"
|
|
737
|
-
},
|
|
738
|
-
onOpenAutoFocus: isConnected ? void 0 : handleOpenAutoFocus,
|
|
739
|
-
children: isConnected ? /* @__PURE__ */ jsxs7(Modal.Body, { classNames: { root: "relative !px-5 !py-8 md:!px-10 md:!py-12" }, children: [
|
|
740
|
-
/* @__PURE__ */ jsx7(CloseButton, { className: "absolute right-5 top-5 md:right-8 md:top-8" }),
|
|
741
|
-
/* @__PURE__ */ jsxs7(
|
|
742
|
-
"div",
|
|
743
|
-
{
|
|
744
|
-
className: "flex flex-col items-center gap-8 text-center",
|
|
745
|
-
role: "status",
|
|
746
|
-
"aria-live": "polite",
|
|
747
|
-
children: [
|
|
748
|
-
/* @__PURE__ */ jsx7("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success/15", children: /* @__PURE__ */ jsx7(Icon, { name: "success-check", className: "size-6 text-agg-success", "aria-hidden": "true" }) }),
|
|
749
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col items-center gap-3", children: [
|
|
750
|
-
/* @__PURE__ */ jsx7(Dialog3.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
|
|
751
|
-
/* @__PURE__ */ jsx7(Dialog3.Description, { className: "text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
|
|
752
|
-
] }),
|
|
753
|
-
/* @__PURE__ */ jsx7(Button, { variant: "secondary", size: "large", onClick: () => handleOpenChange(false), children: labels.onboarding.connectKalshiModal.success.done })
|
|
754
|
-
]
|
|
755
|
-
}
|
|
756
|
-
)
|
|
757
|
-
] }) : /* @__PURE__ */ jsxs7("form", { className: "flex min-h-0 flex-1 flex-col", onSubmit: handleSubmit, children: [
|
|
758
|
-
/* @__PURE__ */ jsx7(
|
|
759
|
-
Modal.Body,
|
|
760
|
-
{
|
|
761
|
-
classNames: { root: "relative !px-5 !pb-6 !pt-5 md:!px-10 md:!pb-0 md:!pt-12" },
|
|
762
|
-
children: /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-6 md:items-center md:gap-0", children: [
|
|
763
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col md:contents", children: [
|
|
764
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-3 md:contents", children: [
|
|
765
|
-
/* @__PURE__ */ jsx7(
|
|
766
|
-
VenueLogo,
|
|
767
|
-
{
|
|
768
|
-
venue: Venue2.kalshi,
|
|
769
|
-
variant: "logo",
|
|
770
|
-
size: "large",
|
|
771
|
-
className: "!size-10 md:!mb-8 md:!size-[60px]"
|
|
772
|
-
}
|
|
773
|
-
),
|
|
774
|
-
/* @__PURE__ */ jsx7(Dialog3.Title, { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground md:mb-4 md:text-center md:text-agg-2xl md:leading-agg-8", children: labels.onboarding.connectKalshiModal.title }),
|
|
775
|
-
/* @__PURE__ */ jsx7(
|
|
776
|
-
CloseButton,
|
|
777
|
-
{
|
|
778
|
-
disabled: isVerifying,
|
|
779
|
-
className: "ml-auto shrink-0 md:absolute md:right-8 md:top-8 md:ml-0"
|
|
780
|
-
}
|
|
781
|
-
)
|
|
782
|
-
] }),
|
|
783
|
-
/* @__PURE__ */ jsx7(Dialog3.Description, { className: "mt-3 text-agg-sm leading-agg-5 text-agg-foreground md:mb-8 md:mt-0 md:text-center md:text-agg-base md:leading-agg-6", children: labels.onboarding.connectKalshiModal.description })
|
|
784
|
-
] }),
|
|
785
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex w-full flex-col gap-4", children: [
|
|
786
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
787
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
788
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
789
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
790
|
-
] }),
|
|
791
|
-
/* @__PURE__ */ jsxs7("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
792
|
-
/* @__PURE__ */ jsx7("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
793
|
-
/* @__PURE__ */ jsxs7("p", { children: [
|
|
794
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
795
|
-
" ",
|
|
796
|
-
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
797
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
798
|
-
" ",
|
|
799
|
-
/* @__PURE__ */ jsx7(
|
|
800
|
-
"a",
|
|
801
|
-
{
|
|
802
|
-
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
803
|
-
target: "_blank",
|
|
804
|
-
rel: "noreferrer",
|
|
805
|
-
className: "cursor-pointer underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary",
|
|
806
|
-
children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl
|
|
807
|
-
}
|
|
808
|
-
)
|
|
809
|
-
] }),
|
|
810
|
-
/* @__PURE__ */ jsxs7("p", { children: [
|
|
811
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
812
|
-
" ",
|
|
813
|
-
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
814
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
815
|
-
] }),
|
|
816
|
-
/* @__PURE__ */ jsxs7("p", { children: [
|
|
817
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
818
|
-
" ",
|
|
819
|
-
/* @__PURE__ */ jsx7("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
820
|
-
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
821
|
-
] }),
|
|
822
|
-
/* @__PURE__ */ jsx7("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
823
|
-
] }),
|
|
824
|
-
/* @__PURE__ */ jsxs7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
825
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
826
|
-
/* @__PURE__ */ jsx7("br", {}),
|
|
827
|
-
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
828
|
-
] })
|
|
829
|
-
] }),
|
|
830
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
831
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
|
|
832
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
833
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
834
|
-
] }),
|
|
835
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
836
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-2", children: [
|
|
837
|
-
/* @__PURE__ */ jsx7(
|
|
838
|
-
"label",
|
|
839
|
-
{
|
|
840
|
-
htmlFor: "kalshi-api-key-id",
|
|
841
|
-
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
842
|
-
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
843
|
-
}
|
|
844
|
-
),
|
|
845
|
-
/* @__PURE__ */ jsx7(
|
|
846
|
-
"input",
|
|
847
|
-
{
|
|
848
|
-
ref: apiKeyInputRef,
|
|
849
|
-
id: "kalshi-api-key-id",
|
|
850
|
-
type: "text",
|
|
851
|
-
autoComplete: "off",
|
|
852
|
-
value: apiKeyId,
|
|
853
|
-
onChange: (event) => setApiKeyId(event.target.value),
|
|
854
|
-
placeholder: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdPlaceholder,
|
|
855
|
-
disabled: isVerifying,
|
|
856
|
-
"aria-invalid": !!error,
|
|
857
|
-
"aria-describedby": error ? errorId : void 0,
|
|
858
|
-
className: cn(
|
|
859
|
-
"h-10 w-full rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
860
|
-
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
861
|
-
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
862
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
863
|
-
)
|
|
864
|
-
}
|
|
865
|
-
)
|
|
866
|
-
] }),
|
|
867
|
-
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-2", children: [
|
|
868
|
-
/* @__PURE__ */ jsx7(
|
|
869
|
-
"label",
|
|
870
|
-
{
|
|
871
|
-
htmlFor: "kalshi-private-key",
|
|
872
|
-
className: "text-agg-sm font-agg-bold text-agg-foreground",
|
|
873
|
-
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
874
|
-
}
|
|
875
|
-
),
|
|
876
|
-
/* @__PURE__ */ jsx7(
|
|
877
|
-
"textarea",
|
|
878
|
-
{
|
|
879
|
-
id: "kalshi-private-key",
|
|
880
|
-
autoComplete: "off",
|
|
881
|
-
value: privateKey,
|
|
882
|
-
onChange: (event) => setPrivateKey(event.target.value),
|
|
883
|
-
placeholder: labels.onboarding.connectKalshiModal.stepTwo.privateKeyPlaceholder,
|
|
884
|
-
rows: 3,
|
|
885
|
-
disabled: isVerifying,
|
|
886
|
-
"aria-invalid": !!error,
|
|
887
|
-
"aria-describedby": error ? errorId : void 0,
|
|
888
|
-
className: cn(
|
|
889
|
-
"w-full resize-none rounded-agg-sm border border-agg-separator bg-agg-secondary px-3 py-2.5",
|
|
890
|
-
"text-agg-base text-agg-foreground placeholder:text-agg-muted-foreground",
|
|
891
|
-
"outline-none transition-colors focus:border-agg-primary focus:ring-1 focus:ring-agg-primary",
|
|
892
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
893
|
-
)
|
|
894
|
-
}
|
|
895
|
-
)
|
|
896
|
-
] })
|
|
897
|
-
] })
|
|
898
|
-
] }),
|
|
899
|
-
error ? /* @__PURE__ */ jsxs7(
|
|
900
|
-
"div",
|
|
901
|
-
{
|
|
902
|
-
id: errorId,
|
|
903
|
-
className: "flex items-center gap-2 md:justify-center",
|
|
904
|
-
role: "alert",
|
|
905
|
-
"aria-live": "assertive",
|
|
906
|
-
children: [
|
|
907
|
-
/* @__PURE__ */ jsx7(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
|
|
908
|
-
/* @__PURE__ */ jsx7("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
909
|
-
]
|
|
910
|
-
}
|
|
911
|
-
) : null
|
|
912
|
-
] })
|
|
913
|
-
}
|
|
914
|
-
),
|
|
915
|
-
/* @__PURE__ */ jsxs7(
|
|
916
|
-
Modal.Footer,
|
|
917
|
-
{
|
|
918
|
-
classNames: {
|
|
919
|
-
root: "relative !h-auto !gap-3 !p-4 md:!justify-center md:!border-0 md:!px-10 md:!pb-12 md:!pt-8"
|
|
920
|
-
},
|
|
921
|
-
children: [
|
|
922
|
-
/* @__PURE__ */ jsx7(
|
|
923
|
-
"div",
|
|
924
|
-
{
|
|
925
|
-
"aria-hidden": "true",
|
|
926
|
-
className: "pointer-events-none absolute inset-x-0 -top-[60px] h-[60px] bg-gradient-to-b from-transparent to-agg-secondary md:hidden"
|
|
927
|
-
}
|
|
928
|
-
),
|
|
929
|
-
/* @__PURE__ */ jsx7(
|
|
930
|
-
Button,
|
|
931
|
-
{
|
|
932
|
-
variant: "secondary",
|
|
933
|
-
size: "large",
|
|
934
|
-
className: "shrink-0",
|
|
935
|
-
onClick: () => handleOpenChange(false),
|
|
936
|
-
disabled: isVerifying,
|
|
937
|
-
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
938
|
-
}
|
|
939
|
-
),
|
|
940
|
-
/* @__PURE__ */ jsx7(
|
|
941
|
-
Button,
|
|
942
|
-
{
|
|
943
|
-
type: "submit",
|
|
944
|
-
variant: "primary",
|
|
945
|
-
size: "large",
|
|
946
|
-
className: "flex-1 md:flex-none",
|
|
947
|
-
disabled: !parsedCredentials.success || isVerifying,
|
|
948
|
-
isLoading: isVerifying,
|
|
949
|
-
children: labels.onboarding.connectKalshiModal.actions.verifyConnection
|
|
950
|
-
}
|
|
951
|
-
)
|
|
952
|
-
]
|
|
953
|
-
}
|
|
954
|
-
)
|
|
955
|
-
] })
|
|
956
|
-
}
|
|
957
|
-
) });
|
|
958
|
-
};
|
|
959
|
-
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
960
|
-
|
|
961
|
-
// src/onboarding/steps/connect-prophetx-modal.tsx
|
|
962
|
-
import { useAppConfig as useAppConfig2, useLabels as useLabels8 } from "@agg-build/hooks";
|
|
963
|
-
import { Venue as Venue3 } from "@agg-build/sdk";
|
|
964
|
-
import * as Dialog4 from "@radix-ui/react-dialog";
|
|
965
|
-
import { useEffect as useEffect2, useId as useId2, useState as useState5 } from "react";
|
|
966
|
-
import { Fragment, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
967
|
-
function ConnectProphetxModal({
|
|
968
|
-
open,
|
|
969
|
-
onOpenChange,
|
|
970
|
-
onVerify,
|
|
971
|
-
onDisconnect,
|
|
972
|
-
allowExistingConnection = false
|
|
973
|
-
}) {
|
|
974
|
-
const copy = useLabels8().onboarding.connectProphetxModal;
|
|
975
|
-
const common = useLabels8().common;
|
|
976
|
-
const { prophetxExecutionMode, disabledVenues, isLoading } = useAppConfig2();
|
|
977
|
-
const id = useId2();
|
|
978
|
-
const [accessKey, setAccessKey] = useState5("");
|
|
979
|
-
const [secretKey, setSecretKey] = useState5("");
|
|
980
|
-
const [pending, setPending] = useState5(false);
|
|
981
|
-
const [disconnecting, setDisconnecting] = useState5(false);
|
|
982
|
-
const [disconnectError, setDisconnectError] = useState5(false);
|
|
983
|
-
const busy = pending || disconnecting;
|
|
984
|
-
const [connected, setConnected] = useState5(false);
|
|
985
|
-
const [error, setError] = useState5(false);
|
|
986
|
-
useEffect2(() => {
|
|
987
|
-
if (!open) {
|
|
988
|
-
setAccessKey("");
|
|
989
|
-
setSecretKey("");
|
|
990
|
-
setError(false);
|
|
991
|
-
setDisconnectError(false);
|
|
992
|
-
setConnected(false);
|
|
993
|
-
}
|
|
994
|
-
}, [open]);
|
|
995
|
-
if (isLoading || !allowExistingConnection && (prophetxExecutionMode !== "direct" || disabledVenues.includes(Venue3.prophetx)))
|
|
996
|
-
return null;
|
|
997
|
-
return /* @__PURE__ */ jsx8(
|
|
998
|
-
Modal,
|
|
999
|
-
{
|
|
1000
|
-
open,
|
|
1001
|
-
onOpenChange: (value) => {
|
|
1002
|
-
if (!busy) onOpenChange(value);
|
|
1003
|
-
},
|
|
1004
|
-
children: /* @__PURE__ */ jsx8(Modal.Container, { maxWidth: "480px", "aria-label": copy.title, children: /* @__PURE__ */ jsxs8(Modal.Body, { classNames: { root: "relative !p-6" }, children: [
|
|
1005
|
-
/* @__PURE__ */ jsx8(
|
|
1006
|
-
Dialog4.Close,
|
|
1007
|
-
{
|
|
1008
|
-
"aria-label": common.close,
|
|
1009
|
-
disabled: busy,
|
|
1010
|
-
className: "absolute right-4 top-4 cursor-pointer disabled:cursor-not-allowed",
|
|
1011
|
-
children: /* @__PURE__ */ jsx8(Icon, { name: "close", size: "medium" })
|
|
1012
|
-
}
|
|
1013
|
-
),
|
|
1014
|
-
/* @__PURE__ */ jsxs8(
|
|
1015
|
-
"form",
|
|
1016
|
-
{
|
|
1017
|
-
className: "flex flex-col gap-4",
|
|
1018
|
-
onSubmit: (event) => __async(null, null, function* () {
|
|
1019
|
-
event.preventDefault();
|
|
1020
|
-
if (busy || !accessKey.trim() || !secretKey.trim()) return;
|
|
1021
|
-
setPending(true);
|
|
1022
|
-
setError(false);
|
|
1023
|
-
try {
|
|
1024
|
-
yield onVerify({ accessKey: accessKey.trim(), secretKey: secretKey.trim() });
|
|
1025
|
-
setAccessKey("");
|
|
1026
|
-
setSecretKey("");
|
|
1027
|
-
setConnected(true);
|
|
1028
|
-
} catch (e) {
|
|
1029
|
-
setError(true);
|
|
1030
|
-
} finally {
|
|
1031
|
-
setPending(false);
|
|
1032
|
-
}
|
|
1033
|
-
}),
|
|
1034
|
-
children: [
|
|
1035
|
-
/* @__PURE__ */ jsx8(VenueLogo, { venue: Venue3.prophetx, size: "large" }),
|
|
1036
|
-
/* @__PURE__ */ jsx8(Dialog4.Title, { className: "text-agg-xl font-agg-bold text-agg-foreground", children: copy.title }),
|
|
1037
|
-
/* @__PURE__ */ jsx8(Dialog4.Description, { className: "text-agg-sm text-agg-muted-foreground", children: copy.description }),
|
|
1038
|
-
/* @__PURE__ */ jsx8("p", { className: "text-agg-sm text-agg-muted-foreground", children: copy.fundingNotice }),
|
|
1039
|
-
connected ? /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1040
|
-
/* @__PURE__ */ jsx8("p", { role: "status", children: copy.connected }),
|
|
1041
|
-
/* @__PURE__ */ jsx8(Button, { type: "button", onClick: () => onOpenChange(false), children: copy.done })
|
|
1042
|
-
] }) : /* @__PURE__ */ jsxs8(Fragment, { children: [
|
|
1043
|
-
/* @__PURE__ */ jsx8(
|
|
1044
|
-
"a",
|
|
1045
|
-
{
|
|
1046
|
-
className: "text-agg-sm text-agg-primary underline",
|
|
1047
|
-
href: "https://www.prophetx.co",
|
|
1048
|
-
target: "_blank",
|
|
1049
|
-
rel: "noopener noreferrer",
|
|
1050
|
-
children: copy.instructions
|
|
1051
|
-
}
|
|
1052
|
-
),
|
|
1053
|
-
/* @__PURE__ */ jsx8("label", { htmlFor: `${id}-access`, className: "text-agg-sm text-agg-foreground", children: copy.accessKey }),
|
|
1054
|
-
/* @__PURE__ */ jsx8(
|
|
1055
|
-
"input",
|
|
1056
|
-
{
|
|
1057
|
-
id: `${id}-access`,
|
|
1058
|
-
type: "password",
|
|
1059
|
-
autoComplete: "off",
|
|
1060
|
-
spellCheck: false,
|
|
1061
|
-
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
1062
|
-
value: accessKey,
|
|
1063
|
-
onChange: (e) => setAccessKey(e.target.value),
|
|
1064
|
-
disabled: busy,
|
|
1065
|
-
required: true
|
|
1066
|
-
}
|
|
1067
|
-
),
|
|
1068
|
-
/* @__PURE__ */ jsx8("label", { htmlFor: `${id}-secret`, className: "text-agg-sm text-agg-foreground", children: copy.secretKey }),
|
|
1069
|
-
/* @__PURE__ */ jsx8(
|
|
1070
|
-
"input",
|
|
1071
|
-
{
|
|
1072
|
-
id: `${id}-secret`,
|
|
1073
|
-
type: "password",
|
|
1074
|
-
autoComplete: "new-password",
|
|
1075
|
-
spellCheck: false,
|
|
1076
|
-
className: "rounded-agg-md border border-agg-border bg-agg-secondary p-3 text-agg-foreground",
|
|
1077
|
-
value: secretKey,
|
|
1078
|
-
onChange: (e) => setSecretKey(e.target.value),
|
|
1079
|
-
disabled: busy,
|
|
1080
|
-
required: true
|
|
1081
|
-
}
|
|
1082
|
-
),
|
|
1083
|
-
error ? /* @__PURE__ */ jsx8("p", { role: "alert", className: "text-agg-sm text-agg-error", children: copy.error }) : null,
|
|
1084
|
-
/* @__PURE__ */ jsx8(Button, { type: "submit", disabled: busy || !accessKey.trim() || !secretKey.trim(), children: pending ? copy.verifying : copy.verify })
|
|
1085
|
-
] }),
|
|
1086
|
-
allowExistingConnection && onDisconnect ? /* @__PURE__ */ jsx8(
|
|
1087
|
-
Button,
|
|
1088
|
-
{
|
|
1089
|
-
type: "button",
|
|
1090
|
-
variant: "secondary",
|
|
1091
|
-
disabled: busy,
|
|
1092
|
-
onClick: () => __async(null, null, function* () {
|
|
1093
|
-
setDisconnecting(true);
|
|
1094
|
-
setDisconnectError(false);
|
|
1095
|
-
setError(false);
|
|
1096
|
-
try {
|
|
1097
|
-
yield onDisconnect();
|
|
1098
|
-
setAccessKey("");
|
|
1099
|
-
setSecretKey("");
|
|
1100
|
-
onOpenChange(false);
|
|
1101
|
-
} catch (e) {
|
|
1102
|
-
setDisconnectError(true);
|
|
1103
|
-
} finally {
|
|
1104
|
-
setDisconnecting(false);
|
|
1105
|
-
}
|
|
1106
|
-
}),
|
|
1107
|
-
children: disconnecting ? copy.disconnecting : copy.disconnect
|
|
1108
|
-
}
|
|
1109
|
-
) : null,
|
|
1110
|
-
disconnectError ? /* @__PURE__ */ jsx8("p", { role: "alert", className: "text-agg-sm text-agg-error", children: copy.disconnectError }) : null
|
|
1111
|
-
]
|
|
1112
|
-
}
|
|
1113
|
-
)
|
|
1114
|
-
] }) })
|
|
1115
|
-
}
|
|
1116
|
-
);
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
// src/onboarding/index.tsx
|
|
1120
|
-
import { useCallback as useCallback5, useEffect as useEffect3, useState as useState6 } from "react";
|
|
1121
|
-
import { useLabels as useLabels9 } from "@agg-build/hooks";
|
|
1122
|
-
import * as Dialog5 from "@radix-ui/react-dialog";
|
|
1123
|
-
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1124
|
-
var OnboardingModal = ({
|
|
1125
|
-
open,
|
|
1126
|
-
onOpenChange,
|
|
1127
|
-
onProfileSubmit,
|
|
1128
|
-
onConnectOnchain,
|
|
1129
|
-
onComplete,
|
|
1130
|
-
howItWorksIcons,
|
|
1131
|
-
connectedOnchain = false
|
|
1132
|
-
}) => {
|
|
1133
|
-
var _a;
|
|
1134
|
-
const labels = useLabels9();
|
|
1135
|
-
const [step, setStep] = useState6(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
1136
|
-
const stepLabels = {
|
|
1137
|
-
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
1138
|
-
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
1139
|
-
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
1140
|
-
};
|
|
1141
|
-
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
1142
|
-
const [onchainModalOpen, setOnchainModalOpen] = useState6(false);
|
|
1143
|
-
const [onchainConnected, setOnchainConnected] = useState6(false);
|
|
1144
|
-
useEffect3(() => {
|
|
1145
|
-
if (open) {
|
|
1146
|
-
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
1147
|
-
setOnchainConnected(false);
|
|
1148
|
-
}
|
|
1149
|
-
}, [open]);
|
|
1150
|
-
const handleHowItWorksContinue = useCallback5(() => {
|
|
1151
|
-
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
1152
|
-
}, []);
|
|
1153
|
-
const handleProfileContinue = useCallback5(
|
|
1154
|
-
(data) => {
|
|
1155
|
-
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
1156
|
-
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
1157
|
-
},
|
|
1158
|
-
[onProfileSubmit]
|
|
1159
|
-
);
|
|
1160
|
-
const handleConnectContinue = useCallback5(() => {
|
|
1161
|
-
onComplete == null ? void 0 : onComplete();
|
|
1162
|
-
}, [onComplete]);
|
|
1163
|
-
const handleOpenOnchainModal = useCallback5(() => {
|
|
1164
|
-
setOnchainModalOpen(true);
|
|
1165
|
-
}, []);
|
|
1166
|
-
const handleOnchainConnect = useCallback5(() => __async(null, null, function* () {
|
|
1167
|
-
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
1168
|
-
setOnchainConnected(true);
|
|
1169
|
-
}), [onConnectOnchain]);
|
|
1170
|
-
return /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
1171
|
-
/* @__PURE__ */ jsx9(Modal, { open, onOpenChange, children: /* @__PURE__ */ jsxs9(
|
|
1172
|
-
Modal.Container,
|
|
1173
|
-
{
|
|
1174
|
-
maxWidth: "600px",
|
|
1175
|
-
"aria-label": resolvedTitle,
|
|
1176
|
-
classNames: { container: "!rounded-agg-lg" },
|
|
1177
|
-
children: [
|
|
1178
|
-
/* @__PURE__ */ jsx9(Dialog5.Title, { className: "sr-only", children: resolvedTitle }),
|
|
1179
|
-
/* @__PURE__ */ jsxs9(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
|
|
1180
|
-
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ jsx9(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
|
|
1181
|
-
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ jsx9(ProfileSetupStep, { onContinue: handleProfileContinue }),
|
|
1182
|
-
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ jsx9(
|
|
1183
|
-
ConnectAccountsStep,
|
|
1184
|
-
{
|
|
1185
|
-
onConnectOnchain: handleOpenOnchainModal,
|
|
1186
|
-
onContinue: handleConnectContinue,
|
|
1187
|
-
connectedOnchain: connectedOnchain || onchainConnected
|
|
1188
|
-
}
|
|
1189
|
-
)
|
|
1190
|
-
] })
|
|
1191
|
-
]
|
|
1192
|
-
}
|
|
1193
|
-
) }),
|
|
1194
|
-
/* @__PURE__ */ jsx9(
|
|
1195
|
-
ConnectOnchainModal,
|
|
1196
|
-
{
|
|
1197
|
-
open: onchainModalOpen,
|
|
1198
|
-
onOpenChange: setOnchainModalOpen,
|
|
1199
|
-
onConnect: handleOnchainConnect
|
|
1200
|
-
}
|
|
1201
|
-
)
|
|
1202
|
-
] });
|
|
1203
|
-
};
|
|
1204
|
-
OnboardingModal.displayName = "OnboardingModal";
|
|
1205
|
-
|
|
1206
|
-
// src/notifications/deposit-notification-events.ts
|
|
1207
|
-
var AGG_DEPOSIT_NOTIFICATION_EVENT = "agg:deposit-notification";
|
|
1208
|
-
var dispatchAggDepositNotification = (detail) => {
|
|
1209
|
-
if (typeof window === "undefined") return;
|
|
1210
|
-
window.dispatchEvent(new CustomEvent(AGG_DEPOSIT_NOTIFICATION_EVENT, { detail }));
|
|
1211
|
-
};
|
|
1212
|
-
var subscribeAggDepositNotification = (handler) => {
|
|
1213
|
-
if (typeof window === "undefined") return () => {
|
|
1214
|
-
};
|
|
1215
|
-
const handleDepositNotification = (event) => {
|
|
1216
|
-
if (!(event instanceof CustomEvent)) return;
|
|
1217
|
-
handler(event.detail);
|
|
1218
|
-
};
|
|
1219
|
-
window.addEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
1220
|
-
return () => {
|
|
1221
|
-
window.removeEventListener(AGG_DEPOSIT_NOTIFICATION_EVENT, handleDepositNotification);
|
|
1222
|
-
};
|
|
1223
|
-
};
|
|
1224
|
-
|
|
1225
|
-
export {
|
|
1226
|
-
dispatchAggDepositNotification,
|
|
1227
|
-
subscribeAggDepositNotification,
|
|
1228
|
-
GeoBlockBanner,
|
|
1229
|
-
SharedKycModal,
|
|
1230
|
-
HowItWorksStep,
|
|
1231
|
-
ProfileSetupStep,
|
|
1232
|
-
ConnectAccountsStep,
|
|
1233
|
-
ConnectOnchainModal,
|
|
1234
|
-
ConnectKalshiModal,
|
|
1235
|
-
ConnectProphetxModal,
|
|
1236
|
-
OnboardingModal
|
|
1237
|
-
};
|