@agg-build/ui 2.7.3 → 2.8.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/{chunk-MZBYIXYA.mjs → chunk-2QCNDFNC.mjs} +193 -103
- package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
- package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
- package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
- package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
- package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
- package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
- package/dist/events.js +168 -91
- package/dist/events.mjs +3 -3
- package/dist/index.js +1315 -746
- package/dist/index.mjs +7 -7
- package/dist/modals.js +941 -418
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +978 -609
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +94 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1403 -902
- package/dist/trading.mjs +4 -4
- package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
- package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +8 -0
- package/dist/types/primitives/select/select.types.d.ts +8 -0
- package/dist/types/profile/profile-modal.constants.d.mts +2 -1
- package/dist/types/profile/profile-modal.constants.d.ts +2 -1
- package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
- package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
- package/package.json +3 -3
package/dist/modals.js
CHANGED
|
@@ -4362,7 +4362,11 @@ var Select = ({
|
|
|
4362
4362
|
triggerClassName,
|
|
4363
4363
|
contentClassName,
|
|
4364
4364
|
itemClassName,
|
|
4365
|
-
disabled = SELECT_DEFAULT_IS_DISABLED
|
|
4365
|
+
disabled = SELECT_DEFAULT_IS_DISABLED,
|
|
4366
|
+
variant = "default",
|
|
4367
|
+
openOnHover = false,
|
|
4368
|
+
contentAlign = "start",
|
|
4369
|
+
contentSideOffset = 8
|
|
4366
4370
|
}) => {
|
|
4367
4371
|
var _a;
|
|
4368
4372
|
const labels = (0, import_hooks13.useLabels)();
|
|
@@ -4373,17 +4377,30 @@ var Select = ({
|
|
|
4373
4377
|
const isDisabled = resolveIsSelectDisabled({ disabled, items });
|
|
4374
4378
|
const selectedItem = resolveSelectedItem(items, value);
|
|
4375
4379
|
const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
|
|
4376
|
-
const [menuRect, setMenuRect] = (0, import_react2.useState)(
|
|
4377
|
-
null
|
|
4378
|
-
);
|
|
4380
|
+
const [menuRect, setMenuRect] = (0, import_react2.useState)(null);
|
|
4379
4381
|
const containerRef = (0, import_react2.useRef)(null);
|
|
4380
4382
|
const portalRef = (0, import_react2.useRef)(null);
|
|
4381
|
-
const
|
|
4383
|
+
const closeTimerRef = (0, import_react2.useRef)(null);
|
|
4384
|
+
const openedByHoverRef = (0, import_react2.useRef)(false);
|
|
4385
|
+
const handleClose = (0, import_react2.useCallback)(() => {
|
|
4386
|
+
setIsOpen(false);
|
|
4387
|
+
openedByHoverRef.current = false;
|
|
4388
|
+
}, []);
|
|
4382
4389
|
const updateMenuRect = (0, import_react2.useCallback)(() => {
|
|
4383
4390
|
const el = containerRef.current;
|
|
4384
4391
|
if (!el) return;
|
|
4385
4392
|
const r = el.getBoundingClientRect();
|
|
4386
|
-
setMenuRect({
|
|
4393
|
+
setMenuRect({
|
|
4394
|
+
top: r.bottom + contentSideOffset,
|
|
4395
|
+
left: r.left,
|
|
4396
|
+
right: r.right,
|
|
4397
|
+
width: r.width
|
|
4398
|
+
});
|
|
4399
|
+
}, [contentSideOffset]);
|
|
4400
|
+
(0, import_react2.useEffect)(() => {
|
|
4401
|
+
return () => {
|
|
4402
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
4403
|
+
};
|
|
4387
4404
|
}, []);
|
|
4388
4405
|
(0, import_react2.useLayoutEffect)(() => {
|
|
4389
4406
|
if (!isOpen) {
|
|
@@ -4421,7 +4438,33 @@ var Select = ({
|
|
|
4421
4438
|
document.addEventListener("keydown", handleKeyDown);
|
|
4422
4439
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
4423
4440
|
}, [isOpen, handleClose]);
|
|
4424
|
-
const
|
|
4441
|
+
const handlePointerEnter = (event) => {
|
|
4442
|
+
if (!openOnHover || isDisabled || event.pointerType === "touch") return;
|
|
4443
|
+
if (closeTimerRef.current) {
|
|
4444
|
+
clearTimeout(closeTimerRef.current);
|
|
4445
|
+
closeTimerRef.current = null;
|
|
4446
|
+
}
|
|
4447
|
+
if (isOpen) return;
|
|
4448
|
+
openedByHoverRef.current = true;
|
|
4449
|
+
setIsOpen(true);
|
|
4450
|
+
};
|
|
4451
|
+
const handlePointerLeave = (event) => {
|
|
4452
|
+
if (!openOnHover || event.pointerType === "touch") return;
|
|
4453
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
4454
|
+
closeTimerRef.current = setTimeout(() => {
|
|
4455
|
+
handleClose();
|
|
4456
|
+
closeTimerRef.current = null;
|
|
4457
|
+
}, 120);
|
|
4458
|
+
};
|
|
4459
|
+
const handleTriggerClick = () => {
|
|
4460
|
+
if (openedByHoverRef.current && isOpen) {
|
|
4461
|
+
openedByHoverRef.current = false;
|
|
4462
|
+
return;
|
|
4463
|
+
}
|
|
4464
|
+
setIsOpen((previousValue) => !previousValue);
|
|
4465
|
+
};
|
|
4466
|
+
const isInline = variant === "inline";
|
|
4467
|
+
const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
|
|
4425
4468
|
const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4426
4469
|
"div",
|
|
4427
4470
|
{
|
|
@@ -4432,16 +4475,20 @@ var Select = ({
|
|
|
4432
4475
|
style: {
|
|
4433
4476
|
position: "fixed",
|
|
4434
4477
|
top: menuRect.top,
|
|
4435
|
-
left: menuRect.left,
|
|
4478
|
+
left: contentAlign === "start" ? menuRect.left : void 0,
|
|
4479
|
+
right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
|
|
4436
4480
|
width: menuRect.width,
|
|
4437
4481
|
zIndex: SELECT_DROPDOWN_Z
|
|
4438
4482
|
},
|
|
4439
4483
|
className: cn(
|
|
4440
4484
|
AGG_ROOT_CLASS_NAME,
|
|
4441
4485
|
rootClassName,
|
|
4442
|
-
"agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto
|
|
4486
|
+
"agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto border border-agg-separator bg-agg-secondary flex flex-col",
|
|
4487
|
+
isInline ? "min-w-[120px] gap-0 rounded-agg-lg py-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]" : "gap-1 rounded-[12px] p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]",
|
|
4443
4488
|
contentClassName
|
|
4444
4489
|
),
|
|
4490
|
+
onPointerEnter: handlePointerEnter,
|
|
4491
|
+
onPointerLeave: handlePointerLeave,
|
|
4445
4492
|
children: items.map((item) => {
|
|
4446
4493
|
const isSelected = item.value === value;
|
|
4447
4494
|
const isHidden = item.hidden === true;
|
|
@@ -4455,9 +4502,10 @@ var Select = ({
|
|
|
4455
4502
|
disabled: item.disabled,
|
|
4456
4503
|
className: cn(
|
|
4457
4504
|
"agg-select-item",
|
|
4458
|
-
"relative flex w-full items-center
|
|
4505
|
+
"relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
|
|
4506
|
+
isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
|
|
4459
4507
|
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
4460
|
-
isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
4508
|
+
isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
4461
4509
|
item.disabled && "cursor-not-allowed opacity-60",
|
|
4462
4510
|
itemClassName
|
|
4463
4511
|
),
|
|
@@ -4469,6 +4517,13 @@ var Select = ({
|
|
|
4469
4517
|
handleClose();
|
|
4470
4518
|
},
|
|
4471
4519
|
children: [
|
|
4520
|
+
isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4521
|
+
"span",
|
|
4522
|
+
{
|
|
4523
|
+
className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
|
|
4524
|
+
"aria-hidden": true
|
|
4525
|
+
}
|
|
4526
|
+
) : null,
|
|
4472
4527
|
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4473
4528
|
"span",
|
|
4474
4529
|
{
|
|
@@ -4498,7 +4553,11 @@ var Select = ({
|
|
|
4498
4553
|
"div",
|
|
4499
4554
|
{
|
|
4500
4555
|
ref: containerRef,
|
|
4501
|
-
className: cn(
|
|
4556
|
+
className: cn(
|
|
4557
|
+
"group/agg-select relative inline-flex",
|
|
4558
|
+
isInline ? "w-auto" : "w-full",
|
|
4559
|
+
className
|
|
4560
|
+
),
|
|
4502
4561
|
children: [
|
|
4503
4562
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
4504
4563
|
"button",
|
|
@@ -4510,19 +4569,19 @@ var Select = ({
|
|
|
4510
4569
|
disabled: isDisabled,
|
|
4511
4570
|
className: cn(
|
|
4512
4571
|
"agg-select-trigger",
|
|
4513
|
-
"flex
|
|
4514
|
-
"
|
|
4572
|
+
"flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
|
|
4573
|
+
isInline ? "h-auto w-auto bg-transparent px-2 py-1 pr-8 text-left text-agg-base leading-agg-6" : "h-10 w-full border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 text-left text-agg-sm leading-agg-5",
|
|
4515
4574
|
triggerRadiusClass,
|
|
4516
|
-
getMotionClassName(
|
|
4575
|
+
!isInline && getMotionClassName(
|
|
4517
4576
|
enableAnimations,
|
|
4518
4577
|
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
4519
4578
|
),
|
|
4520
|
-
isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
4521
|
-
"hover:border-agg-primary"
|
|
4522
|
-
"focus:border-agg-primary focus:ring-0",
|
|
4523
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
4579
|
+
!isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
4580
|
+
!isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
|
|
4524
4581
|
),
|
|
4525
|
-
onClick:
|
|
4582
|
+
onClick: handleTriggerClick,
|
|
4583
|
+
onPointerEnter: handlePointerEnter,
|
|
4584
|
+
onPointerLeave: handlePointerLeave,
|
|
4526
4585
|
children: [
|
|
4527
4586
|
(selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "h-4 w-4 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: selectedItem.icon }) : (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4528
4587
|
RemoteImage,
|
|
@@ -4536,14 +4595,23 @@ var Select = ({
|
|
|
4536
4595
|
]
|
|
4537
4596
|
}
|
|
4538
4597
|
),
|
|
4539
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4540
|
-
|
|
4598
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4599
|
+
"span",
|
|
4541
4600
|
{
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4601
|
+
className: cn(
|
|
4602
|
+
"agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
|
|
4603
|
+
isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
|
|
4604
|
+
),
|
|
4605
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
4606
|
+
Icon,
|
|
4607
|
+
{
|
|
4608
|
+
name: isOpen ? "chevron-up" : "chevron-down-thin",
|
|
4609
|
+
size: "small",
|
|
4610
|
+
color: "currentColor"
|
|
4611
|
+
}
|
|
4612
|
+
)
|
|
4545
4613
|
}
|
|
4546
|
-
)
|
|
4614
|
+
),
|
|
4547
4615
|
isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
|
|
4548
4616
|
]
|
|
4549
4617
|
}
|
|
@@ -7078,8 +7146,8 @@ var WithdrawModal = (props) => {
|
|
|
7078
7146
|
WithdrawModal.displayName = "WithdrawModal";
|
|
7079
7147
|
|
|
7080
7148
|
// src/onboarding/index.tsx
|
|
7081
|
-
var
|
|
7082
|
-
var
|
|
7149
|
+
var import_react17 = require("react");
|
|
7150
|
+
var import_hooks38 = require("@agg-build/hooks");
|
|
7083
7151
|
var Dialog4 = __toESM(require("@radix-ui/react-dialog"));
|
|
7084
7152
|
|
|
7085
7153
|
// src/onboarding/onboarding-modal.constants.ts
|
|
@@ -7185,11 +7253,266 @@ var HowItWorksStep = ({ onContinue, icons }) => {
|
|
|
7185
7253
|
HowItWorksStep.displayName = "HowItWorksStep";
|
|
7186
7254
|
|
|
7187
7255
|
// src/onboarding/steps/profile-setup.tsx
|
|
7188
|
-
var
|
|
7189
|
-
var
|
|
7256
|
+
var import_react14 = require("react");
|
|
7257
|
+
var import_hooks34 = require("@agg-build/hooks");
|
|
7190
7258
|
|
|
7191
|
-
// src/primitives/
|
|
7259
|
+
// src/primitives/currency-input/index.tsx
|
|
7192
7260
|
var import_hooks31 = require("@agg-build/hooks");
|
|
7261
|
+
var import_react10 = require("react");
|
|
7262
|
+
|
|
7263
|
+
// src/primitives/currency-input/currency-input.constants.ts
|
|
7264
|
+
var CURRENCY_INPUT_DEFAULT_PREFIX = "$";
|
|
7265
|
+
var CURRENCY_INPUT_DEFAULT_MIN = 0;
|
|
7266
|
+
var CURRENCY_INPUT_DEFAULT_DECIMAL_PLACES = 2;
|
|
7267
|
+
var CURRENCY_INPUT_DEFAULT_DISABLED = false;
|
|
7268
|
+
var CURRENCY_INPUT_DEFAULT_AUTO_FOCUS = false;
|
|
7269
|
+
var CURRENCY_INPUT_DEFAULT_IS_INVALID = false;
|
|
7270
|
+
|
|
7271
|
+
// src/primitives/currency-input/currency-input.utils.ts
|
|
7272
|
+
var resolveCurrencyInputFormatParts = (locale) => {
|
|
7273
|
+
var _a, _b, _c, _d;
|
|
7274
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(1234.5);
|
|
7275
|
+
return {
|
|
7276
|
+
group: (_b = (_a = parts.find((part) => part.type === "group")) == null ? void 0 : _a.value) != null ? _b : ",",
|
|
7277
|
+
decimal: (_d = (_c = parts.find((part) => part.type === "decimal")) == null ? void 0 : _c.value) != null ? _d : "."
|
|
7278
|
+
};
|
|
7279
|
+
};
|
|
7280
|
+
var parseCurrencyInputDisplay = (display, prefix, parts) => {
|
|
7281
|
+
let normalizedValue = display.startsWith(prefix) ? display.slice(prefix.length) : display;
|
|
7282
|
+
const escapedGroup = parts.group.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7283
|
+
const escapedDecimal = parts.decimal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7284
|
+
normalizedValue = normalizedValue.replace(new RegExp(escapedGroup, "g"), "").replace(new RegExp(escapedDecimal), ".");
|
|
7285
|
+
normalizedValue = normalizedValue.replace(/[^0-9.]/g, "");
|
|
7286
|
+
const dotIndex = normalizedValue.indexOf(".");
|
|
7287
|
+
if (dotIndex !== -1) {
|
|
7288
|
+
normalizedValue = normalizedValue.slice(0, dotIndex + 1) + normalizedValue.slice(dotIndex + 1).replace(/\./g, "");
|
|
7289
|
+
}
|
|
7290
|
+
return normalizedValue;
|
|
7291
|
+
};
|
|
7292
|
+
var normalizeCurrencyInputInitialZero = (nextRaw, previousRaw) => {
|
|
7293
|
+
const prevIsEffectivelyZero = !previousRaw || previousRaw === "0";
|
|
7294
|
+
if (!prevIsEffectivelyZero || nextRaw.includes(".") || nextRaw.length !== 2 || !nextRaw.includes("0")) {
|
|
7295
|
+
return nextRaw;
|
|
7296
|
+
}
|
|
7297
|
+
if (nextRaw === "00") return "0";
|
|
7298
|
+
if (nextRaw.startsWith("0")) return nextRaw.slice(1);
|
|
7299
|
+
if (nextRaw.endsWith("0")) return nextRaw.slice(0, -1);
|
|
7300
|
+
return nextRaw;
|
|
7301
|
+
};
|
|
7302
|
+
var formatCurrencyInputRawValue = (raw, locale, decimalPlaces, parts) => {
|
|
7303
|
+
if (!raw) return "0";
|
|
7304
|
+
const trailingDot = raw.endsWith(".");
|
|
7305
|
+
const dotIndex = raw.indexOf(".");
|
|
7306
|
+
const decimalDigits = dotIndex >= 0 ? raw.slice(dotIndex + 1) : "";
|
|
7307
|
+
const numericValue = parseFloat(raw);
|
|
7308
|
+
if (isNaN(numericValue)) return "0";
|
|
7309
|
+
const formattedValue = new Intl.NumberFormat(locale, {
|
|
7310
|
+
minimumFractionDigits: decimalDigits.length > 0 ? Math.min(decimalDigits.length, decimalPlaces) : 0,
|
|
7311
|
+
maximumFractionDigits: decimalPlaces
|
|
7312
|
+
}).format(numericValue);
|
|
7313
|
+
return trailingDot ? formattedValue + parts.decimal : formattedValue;
|
|
7314
|
+
};
|
|
7315
|
+
var clampCurrencyInputValue = (value, min, max) => {
|
|
7316
|
+
const normalizedMinimum = Math.max(min, value);
|
|
7317
|
+
return max !== void 0 ? Math.min(max, normalizedMinimum) : normalizedMinimum;
|
|
7318
|
+
};
|
|
7319
|
+
var countDigitsBeforePosition = (value, position) => {
|
|
7320
|
+
let count = 0;
|
|
7321
|
+
for (let index = 0; index < position && index < value.length; index += 1) {
|
|
7322
|
+
if (/\d/.test(value[index])) count += 1;
|
|
7323
|
+
}
|
|
7324
|
+
return count;
|
|
7325
|
+
};
|
|
7326
|
+
var findPositionAfterDigits = (value, digitCount) => {
|
|
7327
|
+
if (digitCount === 0) return 0;
|
|
7328
|
+
let count = 0;
|
|
7329
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
7330
|
+
if (/\d/.test(value[index])) count += 1;
|
|
7331
|
+
if (count === digitCount) return index + 1;
|
|
7332
|
+
}
|
|
7333
|
+
return value.length;
|
|
7334
|
+
};
|
|
7335
|
+
var sanitizeCurrencyInputPastedValue = (input, parts, decimalPlaces) => {
|
|
7336
|
+
const escapedGroup = parts.group.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7337
|
+
const escapedDecimal = parts.decimal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7338
|
+
let sanitizedValue = input.replace(new RegExp(escapedGroup, "g"), "").replace(new RegExp(escapedDecimal), ".");
|
|
7339
|
+
sanitizedValue = sanitizedValue.replace(/[^0-9.]/g, "");
|
|
7340
|
+
const firstDotIndex = sanitizedValue.indexOf(".");
|
|
7341
|
+
if (firstDotIndex !== -1) {
|
|
7342
|
+
sanitizedValue = sanitizedValue.slice(0, firstDotIndex + 1) + sanitizedValue.slice(firstDotIndex + 1).replace(/\./g, "");
|
|
7343
|
+
}
|
|
7344
|
+
const dotIndex = sanitizedValue.indexOf(".");
|
|
7345
|
+
if (dotIndex !== -1) {
|
|
7346
|
+
sanitizedValue = sanitizedValue.slice(0, dotIndex + 1 + decimalPlaces);
|
|
7347
|
+
}
|
|
7348
|
+
return sanitizedValue;
|
|
7349
|
+
};
|
|
7350
|
+
|
|
7351
|
+
// src/primitives/currency-input/index.tsx
|
|
7352
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
7353
|
+
var CurrencyInput = ({
|
|
7354
|
+
value,
|
|
7355
|
+
onChange,
|
|
7356
|
+
prefix = CURRENCY_INPUT_DEFAULT_PREFIX,
|
|
7357
|
+
min = CURRENCY_INPUT_DEFAULT_MIN,
|
|
7358
|
+
max,
|
|
7359
|
+
decimalPlaces = CURRENCY_INPUT_DEFAULT_DECIMAL_PLACES,
|
|
7360
|
+
disabled = CURRENCY_INPUT_DEFAULT_DISABLED,
|
|
7361
|
+
autoFocus = CURRENCY_INPUT_DEFAULT_AUTO_FOCUS,
|
|
7362
|
+
isInvalid = CURRENCY_INPUT_DEFAULT_IS_INVALID,
|
|
7363
|
+
classNames,
|
|
7364
|
+
ariaLabel,
|
|
7365
|
+
onFocus,
|
|
7366
|
+
onBlur
|
|
7367
|
+
}) => {
|
|
7368
|
+
const {
|
|
7369
|
+
general: { locale }
|
|
7370
|
+
} = (0, import_hooks31.useSdkUiConfig)();
|
|
7371
|
+
const parts = (0, import_react10.useMemo)(() => resolveCurrencyInputFormatParts(locale), [locale]);
|
|
7372
|
+
const [raw, setRaw] = (0, import_react10.useState)(() => value >= 0 ? String(value) : "");
|
|
7373
|
+
const isEditingRef = (0, import_react10.useRef)(false);
|
|
7374
|
+
const inputRef = (0, import_react10.useRef)(null);
|
|
7375
|
+
const caretPosRef = (0, import_react10.useRef)(null);
|
|
7376
|
+
(0, import_react10.useEffect)(() => {
|
|
7377
|
+
if (!isEditingRef.current) {
|
|
7378
|
+
setRaw(value >= 0 ? String(value) : "");
|
|
7379
|
+
}
|
|
7380
|
+
}, [value]);
|
|
7381
|
+
const numericDisplay = formatCurrencyInputRawValue(raw, locale, decimalPlaces, parts);
|
|
7382
|
+
const displayValue = prefix + numericDisplay;
|
|
7383
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
7384
|
+
if (caretPosRef.current !== null && inputRef.current) {
|
|
7385
|
+
inputRef.current.setSelectionRange(caretPosRef.current, caretPosRef.current);
|
|
7386
|
+
caretPosRef.current = null;
|
|
7387
|
+
}
|
|
7388
|
+
}, [displayValue]);
|
|
7389
|
+
const handleGuardCaret = () => {
|
|
7390
|
+
var _a, _b, _c, _d;
|
|
7391
|
+
const inputElement = inputRef.current;
|
|
7392
|
+
if (!inputElement) return;
|
|
7393
|
+
const minPosition = prefix.length;
|
|
7394
|
+
if (((_a = inputElement.selectionStart) != null ? _a : 0) < minPosition || ((_b = inputElement.selectionEnd) != null ? _b : 0) < minPosition) {
|
|
7395
|
+
inputElement.setSelectionRange(
|
|
7396
|
+
Math.max((_c = inputElement.selectionStart) != null ? _c : 0, minPosition),
|
|
7397
|
+
Math.max((_d = inputElement.selectionEnd) != null ? _d : 0, minPosition)
|
|
7398
|
+
);
|
|
7399
|
+
}
|
|
7400
|
+
};
|
|
7401
|
+
const handleSelect = () => {
|
|
7402
|
+
handleGuardCaret();
|
|
7403
|
+
};
|
|
7404
|
+
const handleKeyDown = (event) => {
|
|
7405
|
+
var _a, _b, _c;
|
|
7406
|
+
const inputElement = inputRef.current;
|
|
7407
|
+
if (!inputElement) return;
|
|
7408
|
+
const minPosition = prefix.length;
|
|
7409
|
+
if (event.key === "Backspace" && ((_a = inputElement.selectionStart) != null ? _a : 0) <= minPosition && inputElement.selectionStart === inputElement.selectionEnd) {
|
|
7410
|
+
event.preventDefault();
|
|
7411
|
+
}
|
|
7412
|
+
if (event.key === "ArrowLeft" && ((_b = inputElement.selectionStart) != null ? _b : 0) <= minPosition && !event.shiftKey) {
|
|
7413
|
+
event.preventDefault();
|
|
7414
|
+
}
|
|
7415
|
+
if (event.key === "Home") {
|
|
7416
|
+
event.preventDefault();
|
|
7417
|
+
if (event.shiftKey) {
|
|
7418
|
+
inputElement.setSelectionRange(minPosition, (_c = inputElement.selectionEnd) != null ? _c : minPosition);
|
|
7419
|
+
} else {
|
|
7420
|
+
inputElement.setSelectionRange(minPosition, minPosition);
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
};
|
|
7424
|
+
const handleChange = (event) => {
|
|
7425
|
+
var _a;
|
|
7426
|
+
isEditingRef.current = true;
|
|
7427
|
+
const inputValue = event.target.value;
|
|
7428
|
+
if (!inputValue.startsWith(prefix)) {
|
|
7429
|
+
const strippedValue = parseCurrencyInputDisplay(inputValue, prefix, parts);
|
|
7430
|
+
if (!strippedValue) {
|
|
7431
|
+
setRaw("");
|
|
7432
|
+
onChange == null ? void 0 : onChange(min);
|
|
7433
|
+
caretPosRef.current = prefix.length;
|
|
7434
|
+
return;
|
|
7435
|
+
}
|
|
7436
|
+
}
|
|
7437
|
+
const previousCaretPosition = (_a = event.target.selectionStart) != null ? _a : 0;
|
|
7438
|
+
const numericPortion = inputValue.slice(prefix.length);
|
|
7439
|
+
const caretInNumericPortion = Math.max(0, previousCaretPosition - prefix.length);
|
|
7440
|
+
const digitsBeforeCaret = countDigitsBeforePosition(numericPortion, caretInNumericPortion);
|
|
7441
|
+
const nextRaw = normalizeCurrencyInputInitialZero(
|
|
7442
|
+
parseCurrencyInputDisplay(inputValue, prefix, parts),
|
|
7443
|
+
raw
|
|
7444
|
+
);
|
|
7445
|
+
const dotIndex = nextRaw.indexOf(".");
|
|
7446
|
+
const clampedRaw = dotIndex !== -1 ? nextRaw.slice(0, dotIndex + 1 + decimalPlaces) : nextRaw;
|
|
7447
|
+
const numericValue = parseFloat(clampedRaw);
|
|
7448
|
+
const clampedNumericValue = isNaN(numericValue) ? min : clampCurrencyInputValue(numericValue, min, max);
|
|
7449
|
+
const wasValueClamped = !isNaN(numericValue) && clampedNumericValue !== numericValue;
|
|
7450
|
+
const resolvedRaw = wasValueClamped ? String(clampedNumericValue) : clampedRaw;
|
|
7451
|
+
setRaw(resolvedRaw);
|
|
7452
|
+
onChange == null ? void 0 : onChange(clampedNumericValue);
|
|
7453
|
+
const nextNumericDisplay = formatCurrencyInputRawValue(
|
|
7454
|
+
resolvedRaw,
|
|
7455
|
+
locale,
|
|
7456
|
+
decimalPlaces,
|
|
7457
|
+
parts
|
|
7458
|
+
);
|
|
7459
|
+
caretPosRef.current = wasValueClamped || resolvedRaw.endsWith(".") ? prefix.length + nextNumericDisplay.length : prefix.length + findPositionAfterDigits(nextNumericDisplay, digitsBeforeCaret);
|
|
7460
|
+
};
|
|
7461
|
+
const handlePaste = (event) => {
|
|
7462
|
+
event.preventDefault();
|
|
7463
|
+
const pastedValue = event.clipboardData.getData("text/plain");
|
|
7464
|
+
const clampedValue = sanitizeCurrencyInputPastedValue(pastedValue, parts, decimalPlaces);
|
|
7465
|
+
if (!clampedValue) return;
|
|
7466
|
+
const numericValue = parseFloat(clampedValue);
|
|
7467
|
+
const clampedNumericValue = isNaN(numericValue) ? min : clampCurrencyInputValue(numericValue, min, max);
|
|
7468
|
+
const resolvedRaw = clampedNumericValue !== numericValue ? String(clampedNumericValue) : clampedValue;
|
|
7469
|
+
setRaw(resolvedRaw);
|
|
7470
|
+
onChange == null ? void 0 : onChange(clampedNumericValue);
|
|
7471
|
+
};
|
|
7472
|
+
const handleFocus = () => {
|
|
7473
|
+
isEditingRef.current = true;
|
|
7474
|
+
requestAnimationFrame(handleGuardCaret);
|
|
7475
|
+
onFocus == null ? void 0 : onFocus();
|
|
7476
|
+
};
|
|
7477
|
+
const handleBlur = () => {
|
|
7478
|
+
isEditingRef.current = false;
|
|
7479
|
+
const numericValue = parseFloat(raw);
|
|
7480
|
+
const nextValue = isNaN(numericValue) ? min : clampCurrencyInputValue(numericValue, min, max);
|
|
7481
|
+
setRaw(nextValue >= 0 ? String(nextValue) : "");
|
|
7482
|
+
onChange == null ? void 0 : onChange(nextValue);
|
|
7483
|
+
onBlur == null ? void 0 : onBlur();
|
|
7484
|
+
};
|
|
7485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
7486
|
+
"input",
|
|
7487
|
+
{
|
|
7488
|
+
ref: inputRef,
|
|
7489
|
+
type: "text",
|
|
7490
|
+
inputMode: "decimal",
|
|
7491
|
+
autoFocus,
|
|
7492
|
+
value: displayValue,
|
|
7493
|
+
disabled,
|
|
7494
|
+
"aria-label": ariaLabel,
|
|
7495
|
+
"aria-invalid": isInvalid || void 0,
|
|
7496
|
+
className: cn(
|
|
7497
|
+
"min-w-0 bg-transparent outline-none",
|
|
7498
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
7499
|
+
isInvalid && "text-agg-error",
|
|
7500
|
+
classNames == null ? void 0 : classNames.root,
|
|
7501
|
+
classNames == null ? void 0 : classNames.input
|
|
7502
|
+
),
|
|
7503
|
+
onChange: handleChange,
|
|
7504
|
+
onFocus: handleFocus,
|
|
7505
|
+
onBlur: handleBlur,
|
|
7506
|
+
onPaste: handlePaste,
|
|
7507
|
+
onSelect: handleSelect,
|
|
7508
|
+
onKeyDown: handleKeyDown
|
|
7509
|
+
}
|
|
7510
|
+
);
|
|
7511
|
+
};
|
|
7512
|
+
CurrencyInput.displayName = "CurrencyInput";
|
|
7513
|
+
|
|
7514
|
+
// src/primitives/venue-logo/index.tsx
|
|
7515
|
+
var import_hooks32 = require("@agg-build/hooks");
|
|
7193
7516
|
|
|
7194
7517
|
// src/primitives/venue-logo/venue-logo.utils.ts
|
|
7195
7518
|
var resolveVenueLogoLabel = ({
|
|
@@ -7209,7 +7532,7 @@ var resolveVenueLogoIsColor = ({
|
|
|
7209
7532
|
};
|
|
7210
7533
|
|
|
7211
7534
|
// src/primitives/venue-logo/index.tsx
|
|
7212
|
-
var
|
|
7535
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
7213
7536
|
var VenueLogo = ({
|
|
7214
7537
|
venue,
|
|
7215
7538
|
variant = "icon",
|
|
@@ -7222,7 +7545,7 @@ var VenueLogo = ({
|
|
|
7222
7545
|
title
|
|
7223
7546
|
}) => {
|
|
7224
7547
|
var _a, _b;
|
|
7225
|
-
const labels = (0,
|
|
7548
|
+
const labels = (0, import_hooks32.useLabels)();
|
|
7226
7549
|
const sizeClass = sizeClasses[size];
|
|
7227
7550
|
const resolvedLabel = resolveVenueLogoLabel({
|
|
7228
7551
|
ariaLabel,
|
|
@@ -7235,7 +7558,7 @@ var VenueLogo = ({
|
|
|
7235
7558
|
console.warn(`[AggUI] Unknown venue "${venue}" \u2014 using default logo`);
|
|
7236
7559
|
}
|
|
7237
7560
|
if (variant === "logo") {
|
|
7238
|
-
return /* @__PURE__ */ (0,
|
|
7561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
7239
7562
|
RemoteImage,
|
|
7240
7563
|
{
|
|
7241
7564
|
src: (_a = venueLogoUrlRegistry[venue]) != null ? _a : DEFAULT_VENUE_LOGO_URL,
|
|
@@ -7250,7 +7573,7 @@ var VenueLogo = ({
|
|
|
7250
7573
|
isColor,
|
|
7251
7574
|
isMonochromatic
|
|
7252
7575
|
});
|
|
7253
|
-
return /* @__PURE__ */ (0,
|
|
7576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
7254
7577
|
Component,
|
|
7255
7578
|
{
|
|
7256
7579
|
className: cn("group/agg-venue-logo", "shrink-0", sizeClass, className),
|
|
@@ -7264,19 +7587,19 @@ var VenueLogo = ({
|
|
|
7264
7587
|
VenueLogo.displayName = "VenueLogo";
|
|
7265
7588
|
|
|
7266
7589
|
// src/primitives/tabs/index.tsx
|
|
7267
|
-
var
|
|
7268
|
-
var
|
|
7590
|
+
var import_hooks33 = require("@agg-build/hooks");
|
|
7591
|
+
var import_react12 = require("react");
|
|
7269
7592
|
|
|
7270
7593
|
// src/shared/use-horizontal-scroll-state.ts
|
|
7271
|
-
var
|
|
7594
|
+
var import_react11 = require("react");
|
|
7272
7595
|
var useHorizontalScrollState = () => {
|
|
7273
|
-
const containerRef = (0,
|
|
7274
|
-
const [hasOverflow, setHasOverflow] = (0,
|
|
7275
|
-
const [isAtStart, setIsAtStart] = (0,
|
|
7276
|
-
const [isAtEnd, setIsAtEnd] = (0,
|
|
7277
|
-
const [canScrollLeft, setCanScrollLeft] = (0,
|
|
7278
|
-
const [canScrollRight, setCanScrollRight] = (0,
|
|
7279
|
-
const update = (0,
|
|
7596
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
7597
|
+
const [hasOverflow, setHasOverflow] = (0, import_react11.useState)(false);
|
|
7598
|
+
const [isAtStart, setIsAtStart] = (0, import_react11.useState)(true);
|
|
7599
|
+
const [isAtEnd, setIsAtEnd] = (0, import_react11.useState)(true);
|
|
7600
|
+
const [canScrollLeft, setCanScrollLeft] = (0, import_react11.useState)(false);
|
|
7601
|
+
const [canScrollRight, setCanScrollRight] = (0, import_react11.useState)(false);
|
|
7602
|
+
const update = (0, import_react11.useCallback)(() => {
|
|
7280
7603
|
const el = containerRef.current;
|
|
7281
7604
|
if (!el) return;
|
|
7282
7605
|
const epsilon = 2;
|
|
@@ -7289,13 +7612,13 @@ var useHorizontalScrollState = () => {
|
|
|
7289
7612
|
setCanScrollLeft(nextHasOverflow && !nextIsAtStart);
|
|
7290
7613
|
setCanScrollRight(nextHasOverflow && !nextIsAtEnd);
|
|
7291
7614
|
}, []);
|
|
7292
|
-
(0,
|
|
7615
|
+
(0, import_react11.useEffect)(() => {
|
|
7293
7616
|
const el = containerRef.current;
|
|
7294
7617
|
if (!el) return;
|
|
7295
7618
|
el.addEventListener("scroll", update, { passive: true });
|
|
7296
7619
|
return () => el.removeEventListener("scroll", update);
|
|
7297
7620
|
}, [update]);
|
|
7298
|
-
(0,
|
|
7621
|
+
(0, import_react11.useEffect)(() => {
|
|
7299
7622
|
if (typeof ResizeObserver === "undefined") return;
|
|
7300
7623
|
const el = containerRef.current;
|
|
7301
7624
|
if (!el) return;
|
|
@@ -7339,7 +7662,7 @@ var findEdgeEnabledIndex = (items, direction) => {
|
|
|
7339
7662
|
};
|
|
7340
7663
|
|
|
7341
7664
|
// src/primitives/tabs/index.tsx
|
|
7342
|
-
var
|
|
7665
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
7343
7666
|
var getTabButtonClassName = ({
|
|
7344
7667
|
enableAnimations,
|
|
7345
7668
|
isBarVariant,
|
|
@@ -7382,12 +7705,12 @@ var Tabs = ({
|
|
|
7382
7705
|
className,
|
|
7383
7706
|
classNames
|
|
7384
7707
|
}) => {
|
|
7385
|
-
const labels = (0,
|
|
7708
|
+
const labels = (0, import_hooks33.useLabels)();
|
|
7386
7709
|
const {
|
|
7387
7710
|
features: { enableAnimations }
|
|
7388
|
-
} = (0,
|
|
7389
|
-
const buttonRefs = (0,
|
|
7390
|
-
const dragStateRef = (0,
|
|
7711
|
+
} = (0, import_hooks33.useSdkUiConfig)();
|
|
7712
|
+
const buttonRefs = (0, import_react12.useRef)([]);
|
|
7713
|
+
const dragStateRef = (0, import_react12.useRef)({
|
|
7391
7714
|
isPointerDown: false,
|
|
7392
7715
|
isDragging: false,
|
|
7393
7716
|
pointerId: null,
|
|
@@ -7395,11 +7718,11 @@ var Tabs = ({
|
|
|
7395
7718
|
startClientY: 0,
|
|
7396
7719
|
startScrollLeft: 0
|
|
7397
7720
|
});
|
|
7398
|
-
const suppressClickRef = (0,
|
|
7721
|
+
const suppressClickRef = (0, import_react12.useRef)(false);
|
|
7399
7722
|
const resolvedAriaLabel = ariaLabel != null ? ariaLabel : labels.common.tabsAria;
|
|
7400
|
-
const [isMobileViewport, setIsMobileViewport] = (0,
|
|
7401
|
-
const [isDraggingTabs, setIsDraggingTabs] = (0,
|
|
7402
|
-
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0,
|
|
7723
|
+
const [isMobileViewport, setIsMobileViewport] = (0, import_react12.useState)(false);
|
|
7724
|
+
const [isDraggingTabs, setIsDraggingTabs] = (0, import_react12.useState)(false);
|
|
7725
|
+
const [activeUnderlineStyle, setActiveUnderlineStyle] = (0, import_react12.useState)({
|
|
7403
7726
|
transform: "translateX(0px)",
|
|
7404
7727
|
width: 0,
|
|
7405
7728
|
opacity: 0
|
|
@@ -7414,14 +7737,14 @@ var Tabs = ({
|
|
|
7414
7737
|
update: updateScrollState
|
|
7415
7738
|
} = useHorizontalScrollState();
|
|
7416
7739
|
const isBarVariant = variant === "bar";
|
|
7417
|
-
const resolvedOverflowBehavior = (0,
|
|
7740
|
+
const resolvedOverflowBehavior = (0, import_react12.useMemo)(() => {
|
|
7418
7741
|
if (overflowBehavior) return overflowBehavior;
|
|
7419
7742
|
if (!isBarVariant) return "scroll";
|
|
7420
7743
|
return isMobileViewport ? "select" : "scroll";
|
|
7421
7744
|
}, [isBarVariant, isMobileViewport, overflowBehavior]);
|
|
7422
7745
|
const shouldUseOverflowScroll = resolvedOverflowBehavior === "scroll";
|
|
7423
7746
|
const shouldUseOverflowSelect = resolvedOverflowBehavior === "select";
|
|
7424
|
-
(0,
|
|
7747
|
+
(0, import_react12.useEffect)(() => {
|
|
7425
7748
|
if (typeof window === "undefined") return;
|
|
7426
7749
|
const mediaQueryList = window.matchMedia(MOBILE_TABS_MEDIA_QUERY);
|
|
7427
7750
|
const handleMediaQueryChange = (event) => {
|
|
@@ -7439,12 +7762,12 @@ var Tabs = ({
|
|
|
7439
7762
|
mediaQueryList.removeListener(handleMediaQueryChange);
|
|
7440
7763
|
};
|
|
7441
7764
|
}, []);
|
|
7442
|
-
const renderedItems = (0,
|
|
7765
|
+
const renderedItems = (0, import_react12.useMemo)(() => {
|
|
7443
7766
|
return items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
7444
7767
|
disabled: item.disabled || item.isComingSoon
|
|
7445
7768
|
}));
|
|
7446
7769
|
}, [items]);
|
|
7447
|
-
const selectItems = (0,
|
|
7770
|
+
const selectItems = (0, import_react12.useMemo)(() => {
|
|
7448
7771
|
return renderedItems.map((item) => ({
|
|
7449
7772
|
value: item.value,
|
|
7450
7773
|
label: item.isComingSoon ? `${item.label} (soon)` : item.label,
|
|
@@ -7577,7 +7900,7 @@ var Tabs = ({
|
|
|
7577
7900
|
event == null ? void 0 : event.stopPropagation();
|
|
7578
7901
|
suppressClickRef.current = false;
|
|
7579
7902
|
};
|
|
7580
|
-
const updateActiveUnderline = (0,
|
|
7903
|
+
const updateActiveUnderline = (0, import_react12.useCallback)(() => {
|
|
7581
7904
|
if (isBarVariant) {
|
|
7582
7905
|
setActiveUnderlineStyle({
|
|
7583
7906
|
transform: "translateX(0px)",
|
|
@@ -7600,10 +7923,10 @@ var Tabs = ({
|
|
|
7600
7923
|
opacity: 1
|
|
7601
7924
|
});
|
|
7602
7925
|
}, [isBarVariant, renderedItems, value]);
|
|
7603
|
-
(0,
|
|
7926
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
7604
7927
|
updateActiveUnderline();
|
|
7605
7928
|
}, [updateActiveUnderline]);
|
|
7606
|
-
(0,
|
|
7929
|
+
(0, import_react12.useEffect)(() => {
|
|
7607
7930
|
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
7608
7931
|
const tabListElement = tabListRef.current;
|
|
7609
7932
|
if (!tabListElement) return;
|
|
@@ -7615,11 +7938,11 @@ var Tabs = ({
|
|
|
7615
7938
|
tabListElement.removeEventListener("scroll", handleScroll);
|
|
7616
7939
|
};
|
|
7617
7940
|
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
7618
|
-
(0,
|
|
7941
|
+
(0, import_react12.useEffect)(() => {
|
|
7619
7942
|
if (!shouldUseOverflowScroll) return;
|
|
7620
7943
|
updateScrollState();
|
|
7621
7944
|
}, [renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
|
|
7622
|
-
(0,
|
|
7945
|
+
(0, import_react12.useEffect)(() => {
|
|
7623
7946
|
if (isBarVariant || !shouldUseOverflowScroll) return;
|
|
7624
7947
|
if (typeof ResizeObserver === "undefined") return;
|
|
7625
7948
|
const tabListElement = tabListRef.current;
|
|
@@ -7632,7 +7955,7 @@ var Tabs = ({
|
|
|
7632
7955
|
resizeObserver.disconnect();
|
|
7633
7956
|
};
|
|
7634
7957
|
}, [isBarVariant, shouldUseOverflowScroll, tabListRef, updateActiveUnderline]);
|
|
7635
|
-
(0,
|
|
7958
|
+
(0, import_react12.useEffect)(() => {
|
|
7636
7959
|
if (!shouldUseOverflowScroll) return;
|
|
7637
7960
|
const tabListElement = tabListRef.current;
|
|
7638
7961
|
if (!tabListElement) return;
|
|
@@ -7660,7 +7983,7 @@ var Tabs = ({
|
|
|
7660
7983
|
});
|
|
7661
7984
|
}, [enableAnimations, renderedItems, shouldUseOverflowScroll, updateScrollState, value]);
|
|
7662
7985
|
if (shouldUseOverflowSelect) {
|
|
7663
|
-
return /* @__PURE__ */ (0,
|
|
7986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: cn("group/agg-tabs w-full", className, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7664
7987
|
Select,
|
|
7665
7988
|
{
|
|
7666
7989
|
ariaLabel,
|
|
@@ -7672,7 +7995,7 @@ var Tabs = ({
|
|
|
7672
7995
|
}
|
|
7673
7996
|
) });
|
|
7674
7997
|
}
|
|
7675
|
-
return /* @__PURE__ */ (0,
|
|
7998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
7676
7999
|
"div",
|
|
7677
8000
|
{
|
|
7678
8001
|
className: cn(
|
|
@@ -7683,7 +8006,7 @@ var Tabs = ({
|
|
|
7683
8006
|
classNames == null ? void 0 : classNames.root
|
|
7684
8007
|
),
|
|
7685
8008
|
children: [
|
|
7686
|
-
/* @__PURE__ */ (0,
|
|
8009
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
7687
8010
|
"div",
|
|
7688
8011
|
{
|
|
7689
8012
|
ref: tabListRef,
|
|
@@ -7697,7 +8020,7 @@ var Tabs = ({
|
|
|
7697
8020
|
onPointerUp: handleEndTabListDrag,
|
|
7698
8021
|
onWheel: handleTabListWheel,
|
|
7699
8022
|
children: [
|
|
7700
|
-
shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0,
|
|
8023
|
+
shouldUseOverflowScroll && !isBarVariant && hasOverflow ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7701
8024
|
"span",
|
|
7702
8025
|
{
|
|
7703
8026
|
"aria-hidden": true,
|
|
@@ -7708,7 +8031,7 @@ var Tabs = ({
|
|
|
7708
8031
|
var _a;
|
|
7709
8032
|
const isActive = item.value === value;
|
|
7710
8033
|
const isComingSoon = (_a = item == null ? void 0 : item.isComingSoon) != null ? _a : false;
|
|
7711
|
-
return /* @__PURE__ */ (0,
|
|
8034
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
7712
8035
|
"button",
|
|
7713
8036
|
{
|
|
7714
8037
|
ref: (buttonElement) => {
|
|
@@ -7744,7 +8067,7 @@ var Tabs = ({
|
|
|
7744
8067
|
),
|
|
7745
8068
|
children: [
|
|
7746
8069
|
item.icon ? item.icon : null,
|
|
7747
|
-
/* @__PURE__ */ (0,
|
|
8070
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
7748
8071
|
"span",
|
|
7749
8072
|
{
|
|
7750
8073
|
className: cn(
|
|
@@ -7762,7 +8085,7 @@ var Tabs = ({
|
|
|
7762
8085
|
item.value
|
|
7763
8086
|
);
|
|
7764
8087
|
}),
|
|
7765
|
-
!isBarVariant ? /* @__PURE__ */ (0,
|
|
8088
|
+
!isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7766
8089
|
"span",
|
|
7767
8090
|
{
|
|
7768
8091
|
"aria-hidden": true,
|
|
@@ -7781,8 +8104,8 @@ var Tabs = ({
|
|
|
7781
8104
|
]
|
|
7782
8105
|
}
|
|
7783
8106
|
),
|
|
7784
|
-
shouldUseOverflowScroll && !isBarVariant ? /* @__PURE__ */ (0,
|
|
7785
|
-
/* @__PURE__ */ (0,
|
|
8107
|
+
shouldUseOverflowScroll && !isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
8108
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7786
8109
|
"span",
|
|
7787
8110
|
{
|
|
7788
8111
|
"aria-hidden": true,
|
|
@@ -7794,7 +8117,7 @@ var Tabs = ({
|
|
|
7794
8117
|
)
|
|
7795
8118
|
}
|
|
7796
8119
|
),
|
|
7797
|
-
/* @__PURE__ */ (0,
|
|
8120
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7798
8121
|
"span",
|
|
7799
8122
|
{
|
|
7800
8123
|
"aria-hidden": true,
|
|
@@ -7807,8 +8130,8 @@ var Tabs = ({
|
|
|
7807
8130
|
}
|
|
7808
8131
|
)
|
|
7809
8132
|
] }) : null,
|
|
7810
|
-
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0,
|
|
7811
|
-
/* @__PURE__ */ (0,
|
|
8133
|
+
shouldUseOverflowScroll && isBarVariant ? /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [
|
|
8134
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7812
8135
|
"button",
|
|
7813
8136
|
{
|
|
7814
8137
|
type: "button",
|
|
@@ -7830,10 +8153,10 @@ var Tabs = ({
|
|
|
7830
8153
|
behavior: getScrollBehavior(enableAnimations)
|
|
7831
8154
|
});
|
|
7832
8155
|
},
|
|
7833
|
-
children: /* @__PURE__ */ (0,
|
|
8156
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "chevron-left", size: "small", color: "currentColor" })
|
|
7834
8157
|
}
|
|
7835
8158
|
),
|
|
7836
|
-
/* @__PURE__ */ (0,
|
|
8159
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
7837
8160
|
"button",
|
|
7838
8161
|
{
|
|
7839
8162
|
type: "button",
|
|
@@ -7855,7 +8178,7 @@ var Tabs = ({
|
|
|
7855
8178
|
behavior: getScrollBehavior(enableAnimations)
|
|
7856
8179
|
});
|
|
7857
8180
|
},
|
|
7858
|
-
children: /* @__PURE__ */ (0,
|
|
8181
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { name: "chevron-right", size: "small", color: "currentColor" })
|
|
7859
8182
|
}
|
|
7860
8183
|
)
|
|
7861
8184
|
] }) : null
|
|
@@ -7867,26 +8190,26 @@ Tabs.displayName = "Tabs";
|
|
|
7867
8190
|
|
|
7868
8191
|
// src/primitives/toast/index.tsx
|
|
7869
8192
|
var RadixToast = __toESM(require("@radix-ui/react-toast"));
|
|
7870
|
-
var
|
|
7871
|
-
var
|
|
7872
|
-
var ToastContext = (0,
|
|
8193
|
+
var import_react13 = require("react");
|
|
8194
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
8195
|
+
var ToastContext = (0, import_react13.createContext)(null);
|
|
7873
8196
|
function useOptionalToast() {
|
|
7874
|
-
return (0,
|
|
8197
|
+
return (0, import_react13.useContext)(ToastContext);
|
|
7875
8198
|
}
|
|
7876
8199
|
|
|
7877
8200
|
// src/onboarding/steps/profile-setup.tsx
|
|
7878
|
-
var
|
|
8201
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
7879
8202
|
var ProfileSetupStep = ({ onContinue }) => {
|
|
7880
|
-
const labels = (0,
|
|
7881
|
-
const [username, setUsername] = (0,
|
|
7882
|
-
const [avatarFile, setAvatarFile] = (0,
|
|
7883
|
-
const [avatarPreview, setAvatarPreview] = (0,
|
|
7884
|
-
const fileInputRef = (0,
|
|
7885
|
-
const handleAvatarClick = (0,
|
|
8203
|
+
const labels = (0, import_hooks34.useLabels)();
|
|
8204
|
+
const [username, setUsername] = (0, import_react14.useState)("");
|
|
8205
|
+
const [avatarFile, setAvatarFile] = (0, import_react14.useState)();
|
|
8206
|
+
const [avatarPreview, setAvatarPreview] = (0, import_react14.useState)();
|
|
8207
|
+
const fileInputRef = (0, import_react14.useRef)(null);
|
|
8208
|
+
const handleAvatarClick = (0, import_react14.useCallback)(() => {
|
|
7886
8209
|
var _a;
|
|
7887
8210
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
7888
8211
|
}, []);
|
|
7889
|
-
const handleFileChange = (0,
|
|
8212
|
+
const handleFileChange = (0, import_react14.useCallback)((e) => {
|
|
7890
8213
|
var _a;
|
|
7891
8214
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
7892
8215
|
if (!file) return;
|
|
@@ -7898,18 +8221,18 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7898
8221
|
};
|
|
7899
8222
|
reader.readAsDataURL(file);
|
|
7900
8223
|
}, []);
|
|
7901
|
-
const handleContinue = (0,
|
|
8224
|
+
const handleContinue = (0, import_react14.useCallback)(() => {
|
|
7902
8225
|
onContinue({
|
|
7903
8226
|
username,
|
|
7904
8227
|
avatarFile,
|
|
7905
8228
|
avatarPreview
|
|
7906
8229
|
});
|
|
7907
8230
|
}, [username, avatarFile, avatarPreview, onContinue]);
|
|
7908
|
-
return /* @__PURE__ */ (0,
|
|
7909
|
-
/* @__PURE__ */ (0,
|
|
7910
|
-
/* @__PURE__ */ (0,
|
|
7911
|
-
/* @__PURE__ */ (0,
|
|
7912
|
-
/* @__PURE__ */ (0,
|
|
8231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex flex-col gap-7", children: [
|
|
8232
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.profileSetup.title }),
|
|
8233
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex flex-col gap-5 items-center w-full", children: [
|
|
8234
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex justify-center", children: [
|
|
8235
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
|
|
7913
8236
|
"button",
|
|
7914
8237
|
{
|
|
7915
8238
|
type: "button",
|
|
@@ -7925,13 +8248,13 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7925
8248
|
),
|
|
7926
8249
|
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
7927
8250
|
children: [
|
|
7928
|
-
!avatarPreview ? /* @__PURE__ */ (0,
|
|
8251
|
+
!avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7929
8252
|
"svg",
|
|
7930
8253
|
{
|
|
7931
8254
|
"aria-hidden": true,
|
|
7932
8255
|
viewBox: "0 0 80 80",
|
|
7933
8256
|
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
7934
|
-
children: /* @__PURE__ */ (0,
|
|
8257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7935
8258
|
"circle",
|
|
7936
8259
|
{
|
|
7937
8260
|
cx: "40",
|
|
@@ -7945,18 +8268,18 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7945
8268
|
)
|
|
7946
8269
|
}
|
|
7947
8270
|
) : null,
|
|
7948
|
-
avatarPreview ? /* @__PURE__ */ (0,
|
|
8271
|
+
avatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7949
8272
|
RemoteImage,
|
|
7950
8273
|
{
|
|
7951
8274
|
src: avatarPreview,
|
|
7952
8275
|
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
7953
8276
|
className: "h-full w-full object-cover"
|
|
7954
8277
|
}
|
|
7955
|
-
) : /* @__PURE__ */ (0,
|
|
8278
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(ProfileIcon, { className: "h-7 w-7 text-agg-muted-foreground" })
|
|
7956
8279
|
]
|
|
7957
8280
|
}
|
|
7958
8281
|
),
|
|
7959
|
-
/* @__PURE__ */ (0,
|
|
8282
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7960
8283
|
"input",
|
|
7961
8284
|
{
|
|
7962
8285
|
ref: fileInputRef,
|
|
@@ -7968,8 +8291,8 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7968
8291
|
}
|
|
7969
8292
|
)
|
|
7970
8293
|
] }),
|
|
7971
|
-
/* @__PURE__ */ (0,
|
|
7972
|
-
/* @__PURE__ */ (0,
|
|
8294
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { className: "flex flex-col gap-2 w-full", children: [
|
|
8295
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7973
8296
|
"label",
|
|
7974
8297
|
{
|
|
7975
8298
|
htmlFor: "onboarding-username",
|
|
@@ -7977,7 +8300,7 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
7977
8300
|
children: labels.onboarding.profileSetup.usernameLabel
|
|
7978
8301
|
}
|
|
7979
8302
|
),
|
|
7980
|
-
/* @__PURE__ */ (0,
|
|
8303
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
7981
8304
|
"input",
|
|
7982
8305
|
{
|
|
7983
8306
|
id: "onboarding-username",
|
|
@@ -8001,16 +8324,16 @@ var ProfileSetupStep = ({ onContinue }) => {
|
|
|
8001
8324
|
)
|
|
8002
8325
|
] })
|
|
8003
8326
|
] }),
|
|
8004
|
-
/* @__PURE__ */ (0,
|
|
8327
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Button, { variant: "primary", size: "large", className: "w-full", onClick: handleContinue, children: labels.onboarding.profileSetup.continue })
|
|
8005
8328
|
] });
|
|
8006
8329
|
};
|
|
8007
8330
|
ProfileSetupStep.displayName = "ProfileSetupStep";
|
|
8008
8331
|
|
|
8009
8332
|
// src/onboarding/steps/connect-accounts.tsx
|
|
8010
|
-
var
|
|
8011
|
-
var
|
|
8333
|
+
var import_hooks35 = require("@agg-build/hooks");
|
|
8334
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
8012
8335
|
var OnchainVenueLogos = () => {
|
|
8013
|
-
return /* @__PURE__ */ (0,
|
|
8336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "flex gap-1 sm:gap-0 sm:-space-x-5", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { style: { zIndex: ONCHAIN_VENUES.length - index }, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(VenueLogo, { venue, variant: "logo", size: "medium", className: "sm:h-8 sm:w-8" }) }, venue)) });
|
|
8014
8337
|
};
|
|
8015
8338
|
var VenueCard = ({
|
|
8016
8339
|
logos,
|
|
@@ -8021,8 +8344,8 @@ var VenueCard = ({
|
|
|
8021
8344
|
onConnect,
|
|
8022
8345
|
connected = false
|
|
8023
8346
|
}) => {
|
|
8024
|
-
const labels = (0,
|
|
8025
|
-
const action = connected ? /* @__PURE__ */ (0,
|
|
8347
|
+
const labels = (0, import_hooks35.useLabels)();
|
|
8348
|
+
const action = connected ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8026
8349
|
Button,
|
|
8027
8350
|
{
|
|
8028
8351
|
variant: "tertiary",
|
|
@@ -8032,18 +8355,18 @@ var VenueCard = ({
|
|
|
8032
8355
|
children: labels.onboarding.connectAccounts.connect
|
|
8033
8356
|
}
|
|
8034
8357
|
);
|
|
8035
|
-
const mobileAction = connected ? /* @__PURE__ */ (0,
|
|
8358
|
+
const mobileAction = connected ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(CheckCircleIcon, { className: "h-6 w-6 text-agg-success" }) : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8036
8359
|
Button,
|
|
8037
8360
|
{
|
|
8038
8361
|
variant: "tertiary",
|
|
8039
8362
|
size: "medium",
|
|
8040
8363
|
className: "!h-auto !px-0 !py-0 text-agg-primary hover:bg-transparent hover:text-agg-primary-hover",
|
|
8041
8364
|
onClick: onConnect,
|
|
8042
|
-
suffix: /* @__PURE__ */ (0,
|
|
8365
|
+
suffix: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ChevronRightIcon, { className: "h-4 w-4" }),
|
|
8043
8366
|
children: labels.onboarding.connectAccounts.connectAccount
|
|
8044
8367
|
}
|
|
8045
8368
|
);
|
|
8046
|
-
return /* @__PURE__ */ (0,
|
|
8369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(
|
|
8047
8370
|
"div",
|
|
8048
8371
|
{
|
|
8049
8372
|
className: cn(
|
|
@@ -8051,23 +8374,23 @@ var VenueCard = ({
|
|
|
8051
8374
|
connected ? "bg-agg-success/5" : "bg-agg-secondary-hover hover:bg-agg-tertiary"
|
|
8052
8375
|
),
|
|
8053
8376
|
children: [
|
|
8054
|
-
/* @__PURE__ */ (0,
|
|
8055
|
-
/* @__PURE__ */ (0,
|
|
8056
|
-
/* @__PURE__ */ (0,
|
|
8057
|
-
/* @__PURE__ */ (0,
|
|
8058
|
-
/* @__PURE__ */ (0,
|
|
8059
|
-
/* @__PURE__ */ (0,
|
|
8377
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "hidden sm:flex items-center justify-between", children: [
|
|
8378
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex items-center gap-5", children: [
|
|
8379
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "shrink-0", children: logos }),
|
|
8380
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex flex-col gap-[2px]", children: [
|
|
8381
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("p", { className: "text-agg-base font-agg-bold text-agg-foreground", children: title }),
|
|
8382
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("p", { className: "text-agg-sm text-agg-foreground", children: description })
|
|
8060
8383
|
] })
|
|
8061
8384
|
] }),
|
|
8062
|
-
/* @__PURE__ */ (0,
|
|
8385
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "shrink-0", children: action })
|
|
8063
8386
|
] }),
|
|
8064
|
-
/* @__PURE__ */ (0,
|
|
8065
|
-
/* @__PURE__ */ (0,
|
|
8066
|
-
/* @__PURE__ */ (0,
|
|
8067
|
-
/* @__PURE__ */ (0,
|
|
8387
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex flex-col gap-3 sm:hidden", children: [
|
|
8388
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
8389
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "shrink-0", children: logos }),
|
|
8390
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("p", { className: "text-agg-lg font-agg-bold text-agg-foreground", children: mobileTitle != null ? mobileTitle : title })
|
|
8068
8391
|
] }),
|
|
8069
|
-
/* @__PURE__ */ (0,
|
|
8070
|
-
/* @__PURE__ */ (0,
|
|
8392
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex flex-col items-start gap-2", children: [
|
|
8393
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("p", { className: "text-agg-base text-agg-foreground", children: mobileDescription != null ? mobileDescription : description }),
|
|
8071
8394
|
mobileAction
|
|
8072
8395
|
] })
|
|
8073
8396
|
] })
|
|
@@ -8080,14 +8403,14 @@ var ConnectAccountsStep = ({
|
|
|
8080
8403
|
onContinue,
|
|
8081
8404
|
connectedOnchain = false
|
|
8082
8405
|
}) => {
|
|
8083
|
-
const labels = (0,
|
|
8406
|
+
const labels = (0, import_hooks35.useLabels)();
|
|
8084
8407
|
const canContinue = connectedOnchain;
|
|
8085
|
-
return /* @__PURE__ */ (0,
|
|
8086
|
-
/* @__PURE__ */ (0,
|
|
8087
|
-
/* @__PURE__ */ (0,
|
|
8408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("div", { className: "flex flex-col gap-6", children: [
|
|
8409
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("h2", { className: "text-center text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectAccounts.title }),
|
|
8410
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8088
8411
|
VenueCard,
|
|
8089
8412
|
{
|
|
8090
|
-
logos: /* @__PURE__ */ (0,
|
|
8413
|
+
logos: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(OnchainVenueLogos, {}),
|
|
8091
8414
|
title: labels.onboarding.connectAccounts.onchainTitle,
|
|
8092
8415
|
mobileTitle: labels.onboarding.connectAccounts.onchainMobileTitle(
|
|
8093
8416
|
ONCHAIN_VENUES.length - 1
|
|
@@ -8098,7 +8421,7 @@ var ConnectAccountsStep = ({
|
|
|
8098
8421
|
connected: connectedOnchain
|
|
8099
8422
|
}
|
|
8100
8423
|
) }),
|
|
8101
|
-
/* @__PURE__ */ (0,
|
|
8424
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
8102
8425
|
Button,
|
|
8103
8426
|
{
|
|
8104
8427
|
variant: "primary",
|
|
@@ -8114,22 +8437,22 @@ var ConnectAccountsStep = ({
|
|
|
8114
8437
|
ConnectAccountsStep.displayName = "ConnectAccountsStep";
|
|
8115
8438
|
|
|
8116
8439
|
// src/onboarding/steps/connect-onchain-modal.tsx
|
|
8117
|
-
var
|
|
8118
|
-
var
|
|
8440
|
+
var import_react15 = require("react");
|
|
8441
|
+
var import_hooks36 = require("@agg-build/hooks");
|
|
8119
8442
|
var Dialog2 = __toESM(require("@radix-ui/react-dialog"));
|
|
8120
|
-
var
|
|
8443
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
8121
8444
|
var ConnectOnchainModal = ({
|
|
8122
8445
|
open,
|
|
8123
8446
|
onOpenChange,
|
|
8124
8447
|
onConnect
|
|
8125
8448
|
}) => {
|
|
8126
|
-
const labels = (0,
|
|
8127
|
-
const [connecting, setConnecting] = (0,
|
|
8128
|
-
const [error, setError] = (0,
|
|
8129
|
-
const handleCancel = (0,
|
|
8449
|
+
const labels = (0, import_hooks36.useLabels)();
|
|
8450
|
+
const [connecting, setConnecting] = (0, import_react15.useState)(false);
|
|
8451
|
+
const [error, setError] = (0, import_react15.useState)();
|
|
8452
|
+
const handleCancel = (0, import_react15.useCallback)(() => {
|
|
8130
8453
|
onOpenChange(false);
|
|
8131
8454
|
}, [onOpenChange]);
|
|
8132
|
-
const handleConnect = (0,
|
|
8455
|
+
const handleConnect = (0, import_react15.useCallback)(() => __async(null, null, function* () {
|
|
8133
8456
|
if (connecting) return;
|
|
8134
8457
|
setConnecting(true);
|
|
8135
8458
|
setError(void 0);
|
|
@@ -8144,7 +8467,7 @@ var ConnectOnchainModal = ({
|
|
|
8144
8467
|
setConnecting(false);
|
|
8145
8468
|
}
|
|
8146
8469
|
}), [connecting, labels.onboarding.connectOnchainModal.fallbackError, onConnect, onOpenChange]);
|
|
8147
|
-
const handleOpenChange = (0,
|
|
8470
|
+
const handleOpenChange = (0, import_react15.useCallback)(
|
|
8148
8471
|
(value) => {
|
|
8149
8472
|
if (value) {
|
|
8150
8473
|
setError(void 0);
|
|
@@ -8154,15 +8477,15 @@ var ConnectOnchainModal = ({
|
|
|
8154
8477
|
},
|
|
8155
8478
|
[onOpenChange]
|
|
8156
8479
|
);
|
|
8157
|
-
return /* @__PURE__ */ (0,
|
|
8480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
8158
8481
|
Modal.Container,
|
|
8159
8482
|
{
|
|
8160
8483
|
maxWidth: "600px",
|
|
8161
8484
|
"aria-label": labels.onboarding.connectOnchainModal.ariaLabel,
|
|
8162
8485
|
classNames: { container: "!rounded-agg-lg" },
|
|
8163
8486
|
children: [
|
|
8164
|
-
/* @__PURE__ */ (0,
|
|
8165
|
-
/* @__PURE__ */ (0,
|
|
8487
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Dialog2.Title, { className: "sr-only", children: labels.onboarding.connectOnchainModal.title }),
|
|
8488
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
8166
8489
|
Modal.Header,
|
|
8167
8490
|
{
|
|
8168
8491
|
hideClose: false,
|
|
@@ -8173,26 +8496,26 @@ var ConnectOnchainModal = ({
|
|
|
8173
8496
|
}
|
|
8174
8497
|
}
|
|
8175
8498
|
),
|
|
8176
|
-
/* @__PURE__ */ (0,
|
|
8177
|
-
/* @__PURE__ */ (0,
|
|
8178
|
-
/* @__PURE__ */ (0,
|
|
8179
|
-
/* @__PURE__ */ (0,
|
|
8499
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Modal.Body, { classNames: { root: "!px-5 !pt-0 !pb-[60px] sm:!px-8" }, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-8 items-center", children: [
|
|
8500
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-4 items-center text-center", children: [
|
|
8501
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("h2", { className: "text-agg-2xl font-agg-bold text-agg-foreground", children: labels.onboarding.connectOnchainModal.title }),
|
|
8502
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-agg-base text-center leading-agg-6 text-agg-foreground whitespace-pre-line", children: labels.onboarding.connectOnchainModal.description })
|
|
8180
8503
|
] }),
|
|
8181
|
-
/* @__PURE__ */ (0,
|
|
8182
|
-
/* @__PURE__ */ (0,
|
|
8183
|
-
/* @__PURE__ */ (0,
|
|
8184
|
-
index > 0 && /* @__PURE__ */ (0,
|
|
8185
|
-
/* @__PURE__ */ (0,
|
|
8186
|
-
/* @__PURE__ */ (0,
|
|
8504
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex w-full flex-col items-center gap-4 rounded-agg-xl bg-agg-secondary-hover p-6", children: [
|
|
8505
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-agg-sm font-agg-bold uppercase leading-agg-5 text-agg-muted-foreground", children: labels.onboarding.connectOnchainModal.supportedVenuesLabel }),
|
|
8506
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-3", children: ONCHAIN_VENUES.map((venue, index) => /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex items-center gap-[6px]", children: [
|
|
8507
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "mr-2.5 h-3 w-px bg-agg-separator" }),
|
|
8508
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(VenueLogo, { venue, size: "medium" }),
|
|
8509
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "text-agg-base text-agg-foreground", children: labels.venues[venue] })
|
|
8187
8510
|
] }, venue)) })
|
|
8188
8511
|
] }),
|
|
8189
|
-
/* @__PURE__ */ (0,
|
|
8190
|
-
/* @__PURE__ */ (0,
|
|
8191
|
-
error ? /* @__PURE__ */ (0,
|
|
8192
|
-
/* @__PURE__ */ (0,
|
|
8193
|
-
/* @__PURE__ */ (0,
|
|
8512
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-6 items-center", children: [
|
|
8513
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-3 items-center", children: [
|
|
8514
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
8515
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(WarningIcon, { className: "h-3.5 w-3.5 shrink-0 text-agg-error" }),
|
|
8516
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
8194
8517
|
] }) : null,
|
|
8195
|
-
/* @__PURE__ */ (0,
|
|
8518
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
8196
8519
|
Button,
|
|
8197
8520
|
{
|
|
8198
8521
|
variant: "primary",
|
|
@@ -8203,7 +8526,7 @@ var ConnectOnchainModal = ({
|
|
|
8203
8526
|
}
|
|
8204
8527
|
)
|
|
8205
8528
|
] }),
|
|
8206
|
-
/* @__PURE__ */ (0,
|
|
8529
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
8207
8530
|
Button,
|
|
8208
8531
|
{
|
|
8209
8532
|
variant: "tertiary",
|
|
@@ -8222,12 +8545,12 @@ var ConnectOnchainModal = ({
|
|
|
8222
8545
|
ConnectOnchainModal.displayName = "ConnectOnchainModal";
|
|
8223
8546
|
|
|
8224
8547
|
// src/onboarding/steps/connect-kalshi-modal.tsx
|
|
8225
|
-
var
|
|
8548
|
+
var import_hooks37 = require("@agg-build/hooks");
|
|
8226
8549
|
var import_sdk11 = require("@agg-build/sdk");
|
|
8227
8550
|
var Dialog3 = __toESM(require("@radix-ui/react-dialog"));
|
|
8228
|
-
var
|
|
8551
|
+
var import_react16 = require("react");
|
|
8229
8552
|
var import_zod = require("zod");
|
|
8230
|
-
var
|
|
8553
|
+
var import_jsx_runtime129 = require("react/jsx-runtime");
|
|
8231
8554
|
var kalshiCredentialsSchema = import_zod.z.object({
|
|
8232
8555
|
apiKeyId: import_zod.z.string().trim().min(1),
|
|
8233
8556
|
privateKey: import_zod.z.string().trim().min(1)
|
|
@@ -8249,25 +8572,25 @@ var ConnectKalshiModal = ({
|
|
|
8249
8572
|
onOpenChange,
|
|
8250
8573
|
onVerify
|
|
8251
8574
|
}) => {
|
|
8252
|
-
const labels = (0,
|
|
8253
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
8254
|
-
const apiKeyInputRef = (0,
|
|
8255
|
-
const errorId = (0,
|
|
8256
|
-
const [apiKeyId, setApiKeyId] = (0,
|
|
8257
|
-
const [privateKey, setPrivateKey] = (0,
|
|
8258
|
-
const [isVerifying, setIsVerifying] = (0,
|
|
8259
|
-
const [isConnected, setIsConnected] = (0,
|
|
8260
|
-
const [error, setError] = (0,
|
|
8261
|
-
const availabilityState = (0,
|
|
8575
|
+
const labels = (0, import_hooks37.useLabels)();
|
|
8576
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks37.useAppConfig)();
|
|
8577
|
+
const apiKeyInputRef = (0, import_react16.useRef)(null);
|
|
8578
|
+
const errorId = (0, import_react16.useId)();
|
|
8579
|
+
const [apiKeyId, setApiKeyId] = (0, import_react16.useState)("");
|
|
8580
|
+
const [privateKey, setPrivateKey] = (0, import_react16.useState)("");
|
|
8581
|
+
const [isVerifying, setIsVerifying] = (0, import_react16.useState)(false);
|
|
8582
|
+
const [isConnected, setIsConnected] = (0, import_react16.useState)(false);
|
|
8583
|
+
const [error, setError] = (0, import_react16.useState)();
|
|
8584
|
+
const availabilityState = (0, import_hooks37.getVenueAvailabilityState)({
|
|
8262
8585
|
venueId: import_sdk11.Venue.kalshi,
|
|
8263
8586
|
disabledVenues,
|
|
8264
8587
|
isConfigLoading: isAppConfigLoading
|
|
8265
8588
|
});
|
|
8266
|
-
const parsedCredentials = (0,
|
|
8589
|
+
const parsedCredentials = (0, import_react16.useMemo)(
|
|
8267
8590
|
() => kalshiCredentialsSchema.safeParse({ apiKeyId, privateKey }),
|
|
8268
8591
|
[apiKeyId, privateKey]
|
|
8269
8592
|
);
|
|
8270
|
-
(0,
|
|
8593
|
+
(0, import_react16.useEffect)(() => {
|
|
8271
8594
|
if (!open) return;
|
|
8272
8595
|
setApiKeyId("");
|
|
8273
8596
|
setPrivateKey("");
|
|
@@ -8280,14 +8603,14 @@ var ConnectKalshiModal = ({
|
|
|
8280
8603
|
});
|
|
8281
8604
|
return () => window.cancelAnimationFrame(animationFrame);
|
|
8282
8605
|
}, [open]);
|
|
8283
|
-
const handleOpenChange = (0,
|
|
8606
|
+
const handleOpenChange = (0, import_react16.useCallback)(
|
|
8284
8607
|
(nextOpen) => {
|
|
8285
8608
|
if (isVerifying && !nextOpen) return;
|
|
8286
8609
|
onOpenChange(nextOpen);
|
|
8287
8610
|
},
|
|
8288
8611
|
[isVerifying, onOpenChange]
|
|
8289
8612
|
);
|
|
8290
|
-
const handleVerify = (0,
|
|
8613
|
+
const handleVerify = (0, import_react16.useCallback)(() => __async(null, null, function* () {
|
|
8291
8614
|
if (!parsedCredentials.success || isVerifying || isConnected) return;
|
|
8292
8615
|
const credentials = parsedCredentials.data;
|
|
8293
8616
|
setIsVerifying(true);
|
|
@@ -8314,7 +8637,7 @@ var ConnectKalshiModal = ({
|
|
|
8314
8637
|
onVerify,
|
|
8315
8638
|
parsedCredentials
|
|
8316
8639
|
]);
|
|
8317
|
-
const handleSubmit = (0,
|
|
8640
|
+
const handleSubmit = (0, import_react16.useCallback)(
|
|
8318
8641
|
(event) => {
|
|
8319
8642
|
event.preventDefault();
|
|
8320
8643
|
void handleVerify();
|
|
@@ -8322,30 +8645,30 @@ var ConnectKalshiModal = ({
|
|
|
8322
8645
|
[handleVerify]
|
|
8323
8646
|
);
|
|
8324
8647
|
if (availabilityState === "hidden") return null;
|
|
8325
|
-
return /* @__PURE__ */ (0,
|
|
8648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Modal, { open, onOpenChange: handleOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
8326
8649
|
Modal.Container,
|
|
8327
8650
|
{
|
|
8328
8651
|
maxWidth: "600px",
|
|
8329
8652
|
"aria-label": labels.onboarding.connectKalshiModal.ariaLabel,
|
|
8330
8653
|
classNames: { container: "!rounded-agg-2xl" },
|
|
8331
8654
|
children: [
|
|
8332
|
-
/* @__PURE__ */ (0,
|
|
8655
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "flex h-[60px] shrink-0 items-center justify-end px-8", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8333
8656
|
Dialog3.Close,
|
|
8334
8657
|
{
|
|
8335
8658
|
"aria-label": labels.common.close,
|
|
8336
8659
|
className: "flex size-10 cursor-pointer items-center justify-center rounded-agg-full text-agg-secondary transition-colors hover:bg-agg-quaternary hover:text-agg-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-accent disabled:cursor-default disabled:opacity-50",
|
|
8337
8660
|
disabled: isVerifying,
|
|
8338
|
-
children: /* @__PURE__ */ (0,
|
|
8661
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "close", size: "medium" })
|
|
8339
8662
|
}
|
|
8340
8663
|
) }),
|
|
8341
|
-
/* @__PURE__ */ (0,
|
|
8664
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Modal.Body, { classNames: { root: "!px-5 !pb-12 !pt-0 sm:!px-10" }, children: isConnected ? /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
8342
8665
|
"div",
|
|
8343
8666
|
{
|
|
8344
8667
|
className: "flex flex-col items-center gap-8 pb-3 text-center",
|
|
8345
8668
|
role: "status",
|
|
8346
8669
|
"aria-live": "polite",
|
|
8347
8670
|
children: [
|
|
8348
|
-
/* @__PURE__ */ (0,
|
|
8671
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "flex size-[60px] items-center justify-center rounded-agg-full bg-agg-success", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8349
8672
|
Icon,
|
|
8350
8673
|
{
|
|
8351
8674
|
name: "success-check",
|
|
@@ -8353,11 +8676,11 @@ var ConnectKalshiModal = ({
|
|
|
8353
8676
|
"aria-hidden": "true"
|
|
8354
8677
|
}
|
|
8355
8678
|
) }),
|
|
8356
|
-
/* @__PURE__ */ (0,
|
|
8357
|
-
/* @__PURE__ */ (0,
|
|
8358
|
-
/* @__PURE__ */ (0,
|
|
8679
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
8680
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Dialog3.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.title }),
|
|
8681
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Dialog3.Description, { className: "max-w-[480px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.success.description })
|
|
8359
8682
|
] }),
|
|
8360
|
-
/* @__PURE__ */ (0,
|
|
8683
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8361
8684
|
Button,
|
|
8362
8685
|
{
|
|
8363
8686
|
variant: "primary",
|
|
@@ -8369,27 +8692,27 @@ var ConnectKalshiModal = ({
|
|
|
8369
8692
|
)
|
|
8370
8693
|
]
|
|
8371
8694
|
}
|
|
8372
|
-
) : /* @__PURE__ */ (0,
|
|
8373
|
-
/* @__PURE__ */ (0,
|
|
8374
|
-
/* @__PURE__ */ (0,
|
|
8375
|
-
/* @__PURE__ */ (0,
|
|
8376
|
-
/* @__PURE__ */ (0,
|
|
8695
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("form", { className: "flex flex-col items-center gap-8", onSubmit: handleSubmit, children: [
|
|
8696
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(VenueLogo, { venue: import_sdk11.Venue.kalshi, variant: "logo", size: "large", className: "size-[60px]" }),
|
|
8697
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col items-center gap-4 text-center", children: [
|
|
8698
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Dialog3.Title, { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.onboarding.connectKalshiModal.title }),
|
|
8699
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Dialog3.Description, { className: "max-w-[520px] text-agg-base leading-agg-6 text-agg-foreground", children: labels.onboarding.connectKalshiModal.description })
|
|
8377
8700
|
] }),
|
|
8378
|
-
/* @__PURE__ */ (0,
|
|
8379
|
-
/* @__PURE__ */ (0,
|
|
8380
|
-
/* @__PURE__ */ (0,
|
|
8381
|
-
/* @__PURE__ */ (0,
|
|
8382
|
-
/* @__PURE__ */ (0,
|
|
8701
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
|
|
8702
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
8703
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
8704
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepOne.label }),
|
|
8705
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepOne.title })
|
|
8383
8706
|
] }),
|
|
8384
|
-
/* @__PURE__ */ (0,
|
|
8385
|
-
/* @__PURE__ */ (0,
|
|
8386
|
-
/* @__PURE__ */ (0,
|
|
8707
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8708
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.signIn }),
|
|
8709
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("p", { children: [
|
|
8387
8710
|
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfilePrefix,
|
|
8388
8711
|
" ",
|
|
8389
|
-
/* @__PURE__ */ (0,
|
|
8712
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.profileText }),
|
|
8390
8713
|
labels.onboarding.connectKalshiModal.stepOne.instructions.goToProfileSeparator,
|
|
8391
8714
|
" ",
|
|
8392
|
-
/* @__PURE__ */ (0,
|
|
8715
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8393
8716
|
"a",
|
|
8394
8717
|
{
|
|
8395
8718
|
href: labels.onboarding.connectKalshiModal.stepOne.instructions.profileUrl,
|
|
@@ -8400,34 +8723,34 @@ var ConnectKalshiModal = ({
|
|
|
8400
8723
|
}
|
|
8401
8724
|
)
|
|
8402
8725
|
] }),
|
|
8403
|
-
/* @__PURE__ */ (0,
|
|
8726
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("p", { children: [
|
|
8404
8727
|
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeyPrefix,
|
|
8405
8728
|
" ",
|
|
8406
|
-
/* @__PURE__ */ (0,
|
|
8729
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKeyText }),
|
|
8407
8730
|
labels.onboarding.connectKalshiModal.stepOne.instructions.clickCreateKeySuffix
|
|
8408
8731
|
] }),
|
|
8409
|
-
/* @__PURE__ */ (0,
|
|
8732
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("p", { children: [
|
|
8410
8733
|
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsPrefix,
|
|
8411
8734
|
" ",
|
|
8412
|
-
/* @__PURE__ */ (0,
|
|
8735
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "font-agg-bold", children: labels.onboarding.connectKalshiModal.stepOne.instructions.readWriteText }),
|
|
8413
8736
|
labels.onboarding.connectKalshiModal.stepOne.instructions.selectPermissionsSuffix
|
|
8414
8737
|
] }),
|
|
8415
|
-
/* @__PURE__ */ (0,
|
|
8738
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { children: labels.onboarding.connectKalshiModal.stepOne.instructions.createKey })
|
|
8416
8739
|
] }),
|
|
8417
|
-
/* @__PURE__ */ (0,
|
|
8740
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: [
|
|
8418
8741
|
labels.onboarding.connectKalshiModal.stepOne.footerLineOne,
|
|
8419
|
-
/* @__PURE__ */ (0,
|
|
8742
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("br", {}),
|
|
8420
8743
|
labels.onboarding.connectKalshiModal.stepOne.footerLineTwo
|
|
8421
8744
|
] })
|
|
8422
8745
|
] }),
|
|
8423
|
-
/* @__PURE__ */ (0,
|
|
8424
|
-
/* @__PURE__ */ (0,
|
|
8425
|
-
/* @__PURE__ */ (0,
|
|
8426
|
-
/* @__PURE__ */ (0,
|
|
8746
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-3 rounded-agg-xl bg-agg-secondary-hover p-4", children: [
|
|
8747
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
8748
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 text-agg-muted-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.label }),
|
|
8749
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.title })
|
|
8427
8750
|
] }),
|
|
8428
|
-
/* @__PURE__ */ (0,
|
|
8429
|
-
/* @__PURE__ */ (0,
|
|
8430
|
-
/* @__PURE__ */ (0,
|
|
8751
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-foreground", children: labels.onboarding.connectKalshiModal.stepTwo.description }),
|
|
8752
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
8753
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8431
8754
|
"label",
|
|
8432
8755
|
{
|
|
8433
8756
|
htmlFor: "kalshi-api-key-id",
|
|
@@ -8435,7 +8758,7 @@ var ConnectKalshiModal = ({
|
|
|
8435
8758
|
children: labels.onboarding.connectKalshiModal.stepTwo.apiKeyIdLabel
|
|
8436
8759
|
}
|
|
8437
8760
|
),
|
|
8438
|
-
/* @__PURE__ */ (0,
|
|
8761
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8439
8762
|
"input",
|
|
8440
8763
|
{
|
|
8441
8764
|
ref: apiKeyInputRef,
|
|
@@ -8457,8 +8780,8 @@ var ConnectKalshiModal = ({
|
|
|
8457
8780
|
}
|
|
8458
8781
|
)
|
|
8459
8782
|
] }),
|
|
8460
|
-
/* @__PURE__ */ (0,
|
|
8461
|
-
/* @__PURE__ */ (0,
|
|
8783
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
8784
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8462
8785
|
"label",
|
|
8463
8786
|
{
|
|
8464
8787
|
htmlFor: "kalshi-private-key",
|
|
@@ -8466,7 +8789,7 @@ var ConnectKalshiModal = ({
|
|
|
8466
8789
|
children: labels.onboarding.connectKalshiModal.stepTwo.privateKeyLabel
|
|
8467
8790
|
}
|
|
8468
8791
|
),
|
|
8469
|
-
/* @__PURE__ */ (0,
|
|
8792
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8470
8793
|
"textarea",
|
|
8471
8794
|
{
|
|
8472
8795
|
id: "kalshi-private-key",
|
|
@@ -8489,22 +8812,22 @@ var ConnectKalshiModal = ({
|
|
|
8489
8812
|
] })
|
|
8490
8813
|
] })
|
|
8491
8814
|
] }),
|
|
8492
|
-
/* @__PURE__ */ (0,
|
|
8493
|
-
/* @__PURE__ */ (0,
|
|
8494
|
-
/* @__PURE__ */ (0,
|
|
8495
|
-
/* @__PURE__ */ (0,
|
|
8496
|
-
/* @__PURE__ */ (0,
|
|
8815
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex w-full items-center justify-between gap-4", children: [
|
|
8816
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-base text-agg-foreground", children: labels.onboarding.connectKalshiModal.help.label }),
|
|
8817
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
8818
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
|
|
8819
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "document", size: "small", className: "size-4 text-agg-primary" }),
|
|
8497
8820
|
labels.onboarding.connectKalshiModal.help.docsLinkLabel
|
|
8498
8821
|
] }),
|
|
8499
|
-
/* @__PURE__ */ (0,
|
|
8500
|
-
/* @__PURE__ */ (0,
|
|
8501
|
-
/* @__PURE__ */ (0,
|
|
8822
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "h-3 w-px bg-agg-separator" }),
|
|
8823
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("span", { className: "flex items-center gap-2 text-agg-base font-agg-bold text-agg-primary", children: [
|
|
8824
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "play-square", size: "small", className: "size-4 text-agg-primary" }),
|
|
8502
8825
|
labels.onboarding.connectKalshiModal.help.tutorialLinkLabel
|
|
8503
8826
|
] })
|
|
8504
8827
|
] })
|
|
8505
8828
|
] }),
|
|
8506
|
-
/* @__PURE__ */ (0,
|
|
8507
|
-
error ? /* @__PURE__ */ (0,
|
|
8829
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex flex-col items-center gap-5", children: [
|
|
8830
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
8508
8831
|
"div",
|
|
8509
8832
|
{
|
|
8510
8833
|
id: errorId,
|
|
@@ -8512,13 +8835,13 @@ var ConnectKalshiModal = ({
|
|
|
8512
8835
|
role: "alert",
|
|
8513
8836
|
"aria-live": "assertive",
|
|
8514
8837
|
children: [
|
|
8515
|
-
/* @__PURE__ */ (0,
|
|
8516
|
-
/* @__PURE__ */ (0,
|
|
8838
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Icon, { name: "warning", size: "small", className: "size-3.5 text-agg-error" }),
|
|
8839
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "text-agg-sm leading-agg-5 text-agg-error", children: error })
|
|
8517
8840
|
]
|
|
8518
8841
|
}
|
|
8519
8842
|
) : null,
|
|
8520
|
-
/* @__PURE__ */ (0,
|
|
8521
|
-
/* @__PURE__ */ (0,
|
|
8843
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
|
|
8844
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8522
8845
|
Button,
|
|
8523
8846
|
{
|
|
8524
8847
|
variant: "secondary",
|
|
@@ -8528,7 +8851,7 @@ var ConnectKalshiModal = ({
|
|
|
8528
8851
|
children: labels.onboarding.connectKalshiModal.actions.cancel
|
|
8529
8852
|
}
|
|
8530
8853
|
),
|
|
8531
|
-
/* @__PURE__ */ (0,
|
|
8854
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8532
8855
|
Button,
|
|
8533
8856
|
{
|
|
8534
8857
|
type: "submit",
|
|
@@ -8549,7 +8872,7 @@ var ConnectKalshiModal = ({
|
|
|
8549
8872
|
ConnectKalshiModal.displayName = "ConnectKalshiModal";
|
|
8550
8873
|
|
|
8551
8874
|
// src/onboarding/index.tsx
|
|
8552
|
-
var
|
|
8875
|
+
var import_jsx_runtime130 = require("react/jsx-runtime");
|
|
8553
8876
|
var OnboardingModal = ({
|
|
8554
8877
|
open,
|
|
8555
8878
|
onOpenChange,
|
|
@@ -8560,55 +8883,55 @@ var OnboardingModal = ({
|
|
|
8560
8883
|
connectedOnchain = false
|
|
8561
8884
|
}) => {
|
|
8562
8885
|
var _a;
|
|
8563
|
-
const labels = (0,
|
|
8564
|
-
const [step, setStep] = (0,
|
|
8886
|
+
const labels = (0, import_hooks38.useLabels)();
|
|
8887
|
+
const [step, setStep] = (0, import_react17.useState)(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
8565
8888
|
const stepLabels = {
|
|
8566
8889
|
[ONBOARDING_STEPS.HOW_IT_WORKS]: labels.onboarding.modal.stepHowItWorks,
|
|
8567
8890
|
[ONBOARDING_STEPS.PROFILE_SETUP]: labels.onboarding.modal.stepProfileSetup,
|
|
8568
8891
|
[ONBOARDING_STEPS.CONNECT_ACCOUNTS]: labels.onboarding.modal.stepConnectAccounts
|
|
8569
8892
|
};
|
|
8570
8893
|
const resolvedTitle = (_a = stepLabels[step]) != null ? _a : labels.onboarding.modal.title;
|
|
8571
|
-
const [onchainModalOpen, setOnchainModalOpen] = (0,
|
|
8572
|
-
const [onchainConnected, setOnchainConnected] = (0,
|
|
8573
|
-
(0,
|
|
8894
|
+
const [onchainModalOpen, setOnchainModalOpen] = (0, import_react17.useState)(false);
|
|
8895
|
+
const [onchainConnected, setOnchainConnected] = (0, import_react17.useState)(false);
|
|
8896
|
+
(0, import_react17.useEffect)(() => {
|
|
8574
8897
|
if (open) {
|
|
8575
8898
|
setStep(ONBOARDING_STEPS.HOW_IT_WORKS);
|
|
8576
8899
|
setOnchainConnected(false);
|
|
8577
8900
|
}
|
|
8578
8901
|
}, [open]);
|
|
8579
|
-
const handleHowItWorksContinue = (0,
|
|
8902
|
+
const handleHowItWorksContinue = (0, import_react17.useCallback)(() => {
|
|
8580
8903
|
setStep(ONBOARDING_STEPS.PROFILE_SETUP);
|
|
8581
8904
|
}, []);
|
|
8582
|
-
const handleProfileContinue = (0,
|
|
8905
|
+
const handleProfileContinue = (0, import_react17.useCallback)(
|
|
8583
8906
|
(data) => {
|
|
8584
8907
|
onProfileSubmit == null ? void 0 : onProfileSubmit(data);
|
|
8585
8908
|
setStep(ONBOARDING_STEPS.CONNECT_ACCOUNTS);
|
|
8586
8909
|
},
|
|
8587
8910
|
[onProfileSubmit]
|
|
8588
8911
|
);
|
|
8589
|
-
const handleConnectContinue = (0,
|
|
8912
|
+
const handleConnectContinue = (0, import_react17.useCallback)(() => {
|
|
8590
8913
|
onComplete == null ? void 0 : onComplete();
|
|
8591
8914
|
}, [onComplete]);
|
|
8592
|
-
const handleOpenOnchainModal = (0,
|
|
8915
|
+
const handleOpenOnchainModal = (0, import_react17.useCallback)(() => {
|
|
8593
8916
|
setOnchainModalOpen(true);
|
|
8594
8917
|
}, []);
|
|
8595
|
-
const handleOnchainConnect = (0,
|
|
8918
|
+
const handleOnchainConnect = (0, import_react17.useCallback)(() => __async(null, null, function* () {
|
|
8596
8919
|
yield onConnectOnchain == null ? void 0 : onConnectOnchain();
|
|
8597
8920
|
setOnchainConnected(true);
|
|
8598
8921
|
}), [onConnectOnchain]);
|
|
8599
|
-
return /* @__PURE__ */ (0,
|
|
8600
|
-
/* @__PURE__ */ (0,
|
|
8922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [
|
|
8923
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Modal, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(
|
|
8601
8924
|
Modal.Container,
|
|
8602
8925
|
{
|
|
8603
8926
|
maxWidth: "600px",
|
|
8604
8927
|
"aria-label": resolvedTitle,
|
|
8605
8928
|
classNames: { container: "!rounded-agg-lg" },
|
|
8606
8929
|
children: [
|
|
8607
|
-
/* @__PURE__ */ (0,
|
|
8608
|
-
/* @__PURE__ */ (0,
|
|
8609
|
-
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0,
|
|
8610
|
-
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0,
|
|
8611
|
-
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0,
|
|
8930
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Dialog4.Title, { className: "sr-only", children: resolvedTitle }),
|
|
8931
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Modal.Body, { classNames: { root: "px-5 py-6 sm:px-10 sm:py-8" }, children: [
|
|
8932
|
+
step === ONBOARDING_STEPS.HOW_IT_WORKS && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(HowItWorksStep, { onContinue: handleHowItWorksContinue, icons: howItWorksIcons }),
|
|
8933
|
+
step === ONBOARDING_STEPS.PROFILE_SETUP && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(ProfileSetupStep, { onContinue: handleProfileContinue }),
|
|
8934
|
+
step === ONBOARDING_STEPS.CONNECT_ACCOUNTS && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
8612
8935
|
ConnectAccountsStep,
|
|
8613
8936
|
{
|
|
8614
8937
|
onConnectOnchain: handleOpenOnchainModal,
|
|
@@ -8620,7 +8943,7 @@ var OnboardingModal = ({
|
|
|
8620
8943
|
]
|
|
8621
8944
|
}
|
|
8622
8945
|
) }),
|
|
8623
|
-
/* @__PURE__ */ (0,
|
|
8946
|
+
/* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
8624
8947
|
ConnectOnchainModal,
|
|
8625
8948
|
{
|
|
8626
8949
|
open: onchainModalOpen,
|
|
@@ -8633,28 +8956,34 @@ var OnboardingModal = ({
|
|
|
8633
8956
|
OnboardingModal.displayName = "OnboardingModal";
|
|
8634
8957
|
|
|
8635
8958
|
// src/profile/index.tsx
|
|
8636
|
-
var
|
|
8637
|
-
var
|
|
8959
|
+
var import_react21 = require("react");
|
|
8960
|
+
var import_hooks42 = require("@agg-build/hooks");
|
|
8638
8961
|
var import_sdk12 = require("@agg-build/sdk");
|
|
8639
8962
|
|
|
8640
8963
|
// src/profile/profile-modal.constants.ts
|
|
8641
8964
|
var PROFILE_TAB_KEYS = {
|
|
8642
8965
|
PROFILE_ACCOUNTS: "profile-accounts",
|
|
8643
|
-
TRADING_ACCESS: "trading-access"
|
|
8966
|
+
TRADING_ACCESS: "trading-access",
|
|
8967
|
+
BALANCE_MANAGEMENT: "balance-management"
|
|
8644
8968
|
};
|
|
8645
|
-
var
|
|
8969
|
+
var getProfileTabItems = (balanceManagementLabel) => [
|
|
8646
8970
|
{
|
|
8647
8971
|
value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
|
|
8648
8972
|
label: "Profile & accounts",
|
|
8649
8973
|
icon: "profile-about-tab"
|
|
8650
8974
|
},
|
|
8651
|
-
{ value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" }
|
|
8975
|
+
{ value: PROFILE_TAB_KEYS.TRADING_ACCESS, label: "Trading access", icon: "shield-trust" },
|
|
8976
|
+
{
|
|
8977
|
+
value: PROFILE_TAB_KEYS.BALANCE_MANAGEMENT,
|
|
8978
|
+
label: balanceManagementLabel,
|
|
8979
|
+
icon: "bolt"
|
|
8980
|
+
}
|
|
8652
8981
|
];
|
|
8653
8982
|
|
|
8654
8983
|
// src/profile/tabs/about-tab.tsx
|
|
8655
|
-
var
|
|
8656
|
-
var
|
|
8657
|
-
var
|
|
8984
|
+
var import_react18 = require("react");
|
|
8985
|
+
var import_hooks39 = require("@agg-build/hooks");
|
|
8986
|
+
var import_jsx_runtime131 = require("react/jsx-runtime");
|
|
8658
8987
|
var AboutTab = ({
|
|
8659
8988
|
avatarPreview,
|
|
8660
8989
|
onDeleteProfile: _onDeleteProfile,
|
|
@@ -8664,13 +8993,13 @@ var AboutTab = ({
|
|
|
8664
8993
|
draftAvatarPreview,
|
|
8665
8994
|
avatarError: _avatarError
|
|
8666
8995
|
}) => {
|
|
8667
|
-
const labels = (0,
|
|
8668
|
-
const fileInputRef = (0,
|
|
8669
|
-
const handleAvatarClick = (0,
|
|
8996
|
+
const labels = (0, import_hooks39.useLabels)();
|
|
8997
|
+
const fileInputRef = (0, import_react18.useRef)(null);
|
|
8998
|
+
const handleAvatarClick = (0, import_react18.useCallback)(() => {
|
|
8670
8999
|
var _a;
|
|
8671
9000
|
(_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
8672
9001
|
}, []);
|
|
8673
|
-
const handleFileChange = (0,
|
|
9002
|
+
const handleFileChange = (0, import_react18.useCallback)(
|
|
8674
9003
|
(e) => {
|
|
8675
9004
|
var _a;
|
|
8676
9005
|
const file = (_a = e.target.files) == null ? void 0 : _a[0];
|
|
@@ -8686,8 +9015,8 @@ var AboutTab = ({
|
|
|
8686
9015
|
);
|
|
8687
9016
|
const resolvedPreview = draftAvatarPreview != null ? draftAvatarPreview : avatarPreview;
|
|
8688
9017
|
const hasAvatarPreview = Boolean(resolvedPreview);
|
|
8689
|
-
return /* @__PURE__ */ (0,
|
|
8690
|
-
/* @__PURE__ */ (0,
|
|
9018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "agg-profile-about flex flex-col gap-8", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "agg-profile-avatar-section flex w-full items-center gap-6", children: [
|
|
9019
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(
|
|
8691
9020
|
"button",
|
|
8692
9021
|
{
|
|
8693
9022
|
type: "button",
|
|
@@ -8704,13 +9033,13 @@ var AboutTab = ({
|
|
|
8704
9033
|
),
|
|
8705
9034
|
"aria-label": labels.onboarding.profileSetup.uploadProfilePictureAria,
|
|
8706
9035
|
children: [
|
|
8707
|
-
!hasAvatarPreview ? /* @__PURE__ */ (0,
|
|
9036
|
+
!hasAvatarPreview ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8708
9037
|
"svg",
|
|
8709
9038
|
{
|
|
8710
9039
|
"aria-hidden": true,
|
|
8711
9040
|
viewBox: "0 0 80 80",
|
|
8712
9041
|
className: "pointer-events-none absolute inset-0 h-full w-full text-agg-separator group-hover:text-agg-muted-foreground",
|
|
8713
|
-
children: /* @__PURE__ */ (0,
|
|
9042
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8714
9043
|
"circle",
|
|
8715
9044
|
{
|
|
8716
9045
|
cx: "40",
|
|
@@ -8724,18 +9053,18 @@ var AboutTab = ({
|
|
|
8724
9053
|
)
|
|
8725
9054
|
}
|
|
8726
9055
|
) : null,
|
|
8727
|
-
resolvedPreview ? /* @__PURE__ */ (0,
|
|
9056
|
+
resolvedPreview ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8728
9057
|
RemoteImage,
|
|
8729
9058
|
{
|
|
8730
9059
|
src: resolvedPreview,
|
|
8731
9060
|
alt: labels.onboarding.profileSetup.profilePreviewAlt,
|
|
8732
9061
|
className: "h-full w-full object-cover"
|
|
8733
9062
|
}
|
|
8734
|
-
) : /* @__PURE__ */ (0,
|
|
9063
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(Icon, { name: "profile", className: "h-7 w-7 text-agg-muted-foreground" })
|
|
8735
9064
|
]
|
|
8736
9065
|
}
|
|
8737
9066
|
),
|
|
8738
|
-
/* @__PURE__ */ (0,
|
|
9067
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8739
9068
|
"input",
|
|
8740
9069
|
{
|
|
8741
9070
|
ref: fileInputRef,
|
|
@@ -8746,8 +9075,8 @@ var AboutTab = ({
|
|
|
8746
9075
|
"aria-hidden": "true"
|
|
8747
9076
|
}
|
|
8748
9077
|
),
|
|
8749
|
-
/* @__PURE__ */ (0,
|
|
8750
|
-
/* @__PURE__ */ (0,
|
|
9078
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("div", { className: "agg-form-section flex min-w-0 flex-1 flex-col gap-2", children: [
|
|
9079
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8751
9080
|
"label",
|
|
8752
9081
|
{
|
|
8753
9082
|
htmlFor: "profile-username",
|
|
@@ -8755,7 +9084,7 @@ var AboutTab = ({
|
|
|
8755
9084
|
children: "Username"
|
|
8756
9085
|
}
|
|
8757
9086
|
),
|
|
8758
|
-
/* @__PURE__ */ (0,
|
|
9087
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
8759
9088
|
"input",
|
|
8760
9089
|
{
|
|
8761
9090
|
id: "profile-username",
|
|
@@ -8782,9 +9111,9 @@ var AboutTab = ({
|
|
|
8782
9111
|
AboutTab.displayName = "AboutTab";
|
|
8783
9112
|
|
|
8784
9113
|
// src/profile/tabs/accounts-wallets-tab.tsx
|
|
8785
|
-
var
|
|
8786
|
-
var SectionTitle = ({ children }) => /* @__PURE__ */ (0,
|
|
8787
|
-
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0,
|
|
9114
|
+
var import_jsx_runtime132 = require("react/jsx-runtime");
|
|
9115
|
+
var SectionTitle = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
9116
|
+
var AccountRow = ({ children, className }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8788
9117
|
"div",
|
|
8789
9118
|
{
|
|
8790
9119
|
className: cn(
|
|
@@ -8800,11 +9129,11 @@ var AccountIdentity = ({
|
|
|
8800
9129
|
icon,
|
|
8801
9130
|
label,
|
|
8802
9131
|
iconClassName
|
|
8803
|
-
}) => /* @__PURE__ */ (0,
|
|
8804
|
-
/* @__PURE__ */ (0,
|
|
8805
|
-
/* @__PURE__ */ (0,
|
|
9132
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
9133
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: cn("flex h-5 w-5 shrink-0 items-center justify-center", iconClassName), children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: icon, size: "small", color: "currentColor" }) }),
|
|
9134
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: label })
|
|
8806
9135
|
] });
|
|
8807
|
-
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
9136
|
+
var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8808
9137
|
"button",
|
|
8809
9138
|
{
|
|
8810
9139
|
type: "button",
|
|
@@ -8813,7 +9142,7 @@ var ConnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
8813
9142
|
children: "Connect"
|
|
8814
9143
|
}
|
|
8815
9144
|
);
|
|
8816
|
-
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
9145
|
+
var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8817
9146
|
"button",
|
|
8818
9147
|
{
|
|
8819
9148
|
type: "button",
|
|
@@ -8822,7 +9151,7 @@ var DisconnectTextButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runti
|
|
|
8822
9151
|
children: "Disconnect"
|
|
8823
9152
|
}
|
|
8824
9153
|
);
|
|
8825
|
-
var VerifiedBadge = () => /* @__PURE__ */ (0,
|
|
9154
|
+
var VerifiedBadge = () => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(Icon, { name: "check-badge", size: "small", color: "var(--agg-color-primary, #536dfe)" });
|
|
8826
9155
|
var getWalletIconName = (wallet) => {
|
|
8827
9156
|
const chain = wallet.chain.toLowerCase();
|
|
8828
9157
|
if (chain === "solana" || chain === "svm") {
|
|
@@ -8840,12 +9169,12 @@ var ConnectedAccountRow = ({
|
|
|
8840
9169
|
onDisconnect
|
|
8841
9170
|
}) => {
|
|
8842
9171
|
const displayLabel = connected ? connectedLabel != null ? connectedLabel : label : label;
|
|
8843
|
-
return /* @__PURE__ */ (0,
|
|
8844
|
-
/* @__PURE__ */ (0,
|
|
8845
|
-
/* @__PURE__ */ (0,
|
|
8846
|
-
connected ? /* @__PURE__ */ (0,
|
|
9172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(AccountRow, { className: "agg-social-account-row gap-4", children: [
|
|
9173
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
9174
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(AccountIdentity, { icon, label: displayLabel, iconClassName }),
|
|
9175
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VerifiedBadge, {}) : null
|
|
8847
9176
|
] }),
|
|
8848
|
-
connected ? /* @__PURE__ */ (0,
|
|
9177
|
+
connected ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(DisconnectTextButton, { onClick: onDisconnect }) : /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(ConnectTextButton, { onClick: onConnect })
|
|
8849
9178
|
] });
|
|
8850
9179
|
};
|
|
8851
9180
|
var AccountsWalletsTab = ({
|
|
@@ -8864,11 +9193,11 @@ var AccountsWalletsTab = ({
|
|
|
8864
9193
|
const google = socialAccounts == null ? void 0 : socialAccounts.google;
|
|
8865
9194
|
const apple = socialAccounts == null ? void 0 : socialAccounts.apple;
|
|
8866
9195
|
const hasEmail = Boolean(email);
|
|
8867
|
-
return /* @__PURE__ */ (0,
|
|
8868
|
-
/* @__PURE__ */ (0,
|
|
8869
|
-
/* @__PURE__ */ (0,
|
|
8870
|
-
/* @__PURE__ */ (0,
|
|
8871
|
-
/* @__PURE__ */ (0,
|
|
9196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "agg-accounts-wallets-tab flex flex-col gap-6", children: [
|
|
9197
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "agg-social-accounts-section flex flex-col gap-3", children: [
|
|
9198
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(SectionTitle, { children: "Connected accounts" }),
|
|
9199
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "agg-social-accounts-list flex flex-col gap-4", children: [
|
|
9200
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8872
9201
|
ConnectedAccountRow,
|
|
8873
9202
|
{
|
|
8874
9203
|
icon: "google",
|
|
@@ -8880,7 +9209,7 @@ var AccountsWalletsTab = ({
|
|
|
8880
9209
|
onDisconnect: onDisconnectGoogle
|
|
8881
9210
|
}
|
|
8882
9211
|
),
|
|
8883
|
-
/* @__PURE__ */ (0,
|
|
9212
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8884
9213
|
ConnectedAccountRow,
|
|
8885
9214
|
{
|
|
8886
9215
|
icon: "apple",
|
|
@@ -8892,7 +9221,7 @@ var AccountsWalletsTab = ({
|
|
|
8892
9221
|
onDisconnect: onDisconnectApple
|
|
8893
9222
|
}
|
|
8894
9223
|
),
|
|
8895
|
-
/* @__PURE__ */ (0,
|
|
9224
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8896
9225
|
ConnectedAccountRow,
|
|
8897
9226
|
{
|
|
8898
9227
|
icon: "twitter",
|
|
@@ -8904,7 +9233,7 @@ var AccountsWalletsTab = ({
|
|
|
8904
9233
|
onDisconnect: onDisconnectTwitter
|
|
8905
9234
|
}
|
|
8906
9235
|
),
|
|
8907
|
-
/* @__PURE__ */ (0,
|
|
9236
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8908
9237
|
ConnectedAccountRow,
|
|
8909
9238
|
{
|
|
8910
9239
|
icon: "email",
|
|
@@ -8917,12 +9246,12 @@ var AccountsWalletsTab = ({
|
|
|
8917
9246
|
)
|
|
8918
9247
|
] })
|
|
8919
9248
|
] }),
|
|
8920
|
-
wallets.length > 0 ? /* @__PURE__ */ (0,
|
|
8921
|
-
/* @__PURE__ */ (0,
|
|
8922
|
-
/* @__PURE__ */ (0,
|
|
9249
|
+
wallets.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "agg-wallets-section flex flex-col gap-3", children: [
|
|
9250
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(SectionTitle, { children: "Wallets" }),
|
|
9251
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "flex flex-col gap-2", children: wallets.map((wallet) => {
|
|
8923
9252
|
var _a;
|
|
8924
|
-
return /* @__PURE__ */ (0,
|
|
8925
|
-
/* @__PURE__ */ (0,
|
|
9253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(AccountRow, { className: "gap-4", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
9254
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(
|
|
8926
9255
|
AccountIdentity,
|
|
8927
9256
|
{
|
|
8928
9257
|
icon: getWalletIconName(wallet),
|
|
@@ -8930,7 +9259,7 @@ var AccountsWalletsTab = ({
|
|
|
8930
9259
|
label: (_a = wallet.displayAddress) != null ? _a : wallet.address
|
|
8931
9260
|
}
|
|
8932
9261
|
),
|
|
8933
|
-
/* @__PURE__ */ (0,
|
|
9262
|
+
/* @__PURE__ */ (0, import_jsx_runtime132.jsx)(VerifiedBadge, {})
|
|
8934
9263
|
] }) }, `${wallet.chain}:${wallet.address}`);
|
|
8935
9264
|
}) })
|
|
8936
9265
|
] }) : null
|
|
@@ -8939,9 +9268,9 @@ var AccountsWalletsTab = ({
|
|
|
8939
9268
|
AccountsWalletsTab.displayName = "AccountsWalletsTab";
|
|
8940
9269
|
|
|
8941
9270
|
// src/profile/tabs/trading-access-tab.tsx
|
|
8942
|
-
var
|
|
8943
|
-
var
|
|
8944
|
-
var
|
|
9271
|
+
var import_hooks40 = require("@agg-build/hooks");
|
|
9272
|
+
var import_react19 = require("react");
|
|
9273
|
+
var import_jsx_runtime133 = require("react/jsx-runtime");
|
|
8945
9274
|
var TRADING_ACCESS_VENUES = [
|
|
8946
9275
|
"kalshi",
|
|
8947
9276
|
"polymarket",
|
|
@@ -8953,8 +9282,8 @@ var TRADING_ACCESS_VENUES = [
|
|
|
8953
9282
|
"hyperliquid"
|
|
8954
9283
|
];
|
|
8955
9284
|
var TRADING_ACCESS_VENUE_ITEMS = TRADING_ACCESS_VENUES.map((id) => ({ id }));
|
|
8956
|
-
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0,
|
|
8957
|
-
var AccessRow = ({ children }) => /* @__PURE__ */ (0,
|
|
9285
|
+
var SectionTitle2 = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("h3", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children });
|
|
9286
|
+
var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
8958
9287
|
"div",
|
|
8959
9288
|
{
|
|
8960
9289
|
className: cn(
|
|
@@ -8966,17 +9295,17 @@ var AccessRow = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)
|
|
|
8966
9295
|
}
|
|
8967
9296
|
);
|
|
8968
9297
|
var AvailableStatus = () => {
|
|
8969
|
-
const labels = (0,
|
|
8970
|
-
return /* @__PURE__ */ (0,
|
|
8971
|
-
/* @__PURE__ */ (0,
|
|
8972
|
-
/* @__PURE__ */ (0,
|
|
9298
|
+
const labels = (0, import_hooks40.useLabels)();
|
|
9299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
9300
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon, { name: "check-badge", size: "small", className: "text-agg-primary" }),
|
|
9301
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground whitespace-nowrap", children: labels.trading.tradingAccessAvailable })
|
|
8973
9302
|
] });
|
|
8974
9303
|
};
|
|
8975
9304
|
var GeoblockedStatus = () => {
|
|
8976
|
-
const labels = (0,
|
|
8977
|
-
return /* @__PURE__ */ (0,
|
|
8978
|
-
/* @__PURE__ */ (0,
|
|
8979
|
-
/* @__PURE__ */ (0,
|
|
9305
|
+
const labels = (0, import_hooks40.useLabels)();
|
|
9306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-center gap-2 text-agg-muted-foreground", children: [
|
|
9307
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon, { name: "warning-filled", size: "small", color: "currentColor" }),
|
|
9308
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 whitespace-nowrap", children: labels.trading.venueUnavailableInRegion })
|
|
8980
9309
|
] });
|
|
8981
9310
|
};
|
|
8982
9311
|
var TradingAccessTab = ({
|
|
@@ -8985,23 +9314,23 @@ var TradingAccessTab = ({
|
|
|
8985
9314
|
onDisconnectKalshi
|
|
8986
9315
|
}) => {
|
|
8987
9316
|
var _a, _b, _c, _d;
|
|
8988
|
-
const labels = (0,
|
|
9317
|
+
const labels = (0, import_hooks40.useLabels)();
|
|
8989
9318
|
const verifyConnectionLabel = (_d = (_c = (_b = (_a = labels.onboarding) == null ? void 0 : _a.connectKalshiModal) == null ? void 0 : _b.actions) == null ? void 0 : _c.verifyConnection) != null ? _d : labels.trading.kycVerify;
|
|
8990
|
-
const { disabledVenues, isLoading: isAppConfigLoading } = (0,
|
|
8991
|
-
const { isLocationBlocked } = (0,
|
|
8992
|
-
const visibleVenues = (0,
|
|
8993
|
-
() => (0,
|
|
9319
|
+
const { disabledVenues, isLoading: isAppConfigLoading } = (0, import_hooks40.useAppConfig)();
|
|
9320
|
+
const { isLocationBlocked } = (0, import_hooks40.useGeoBlock)();
|
|
9321
|
+
const visibleVenues = (0, import_react19.useMemo)(
|
|
9322
|
+
() => (0, import_hooks40.getVisibleVenuesByConfig)(TRADING_ACCESS_VENUE_ITEMS, disabledVenues),
|
|
8994
9323
|
[disabledVenues]
|
|
8995
9324
|
);
|
|
8996
|
-
return /* @__PURE__ */ (0,
|
|
8997
|
-
/* @__PURE__ */ (0,
|
|
8998
|
-
/* @__PURE__ */ (0,
|
|
9325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "agg-trading-access-section flex flex-col gap-4", children: [
|
|
9326
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(SectionTitle2, { children: labels.trading.tradingAccessVenues }),
|
|
9327
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { className: "flex flex-col gap-3", children: visibleVenues.map(({ id: venue }) => {
|
|
8999
9328
|
var _a2;
|
|
9000
9329
|
const venueAccount = venueAccounts == null ? void 0 : venueAccounts.find((account) => account.venue === venue);
|
|
9001
9330
|
const isKalshi = venue === "kalshi";
|
|
9002
9331
|
const isConnected = (venueAccount == null ? void 0 : venueAccount.status) === "active";
|
|
9003
9332
|
const isVerified = (venueAccount == null ? void 0 : venueAccount.kycStatus) === "verified";
|
|
9004
|
-
const availabilityState = (0,
|
|
9333
|
+
const availabilityState = (0, import_hooks40.getVenueAvailabilityState)({
|
|
9005
9334
|
venueId: venue,
|
|
9006
9335
|
disabledVenues,
|
|
9007
9336
|
isConfigLoading: isKalshi && isAppConfigLoading,
|
|
@@ -9009,12 +9338,12 @@ var TradingAccessTab = ({
|
|
|
9009
9338
|
});
|
|
9010
9339
|
const displayName = (_a2 = venueLogoLabels[venue]) != null ? _a2 : venue;
|
|
9011
9340
|
if (availabilityState === "hidden") return null;
|
|
9012
|
-
return /* @__PURE__ */ (0,
|
|
9013
|
-
/* @__PURE__ */ (0,
|
|
9014
|
-
/* @__PURE__ */ (0,
|
|
9015
|
-
/* @__PURE__ */ (0,
|
|
9341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(AccessRow, { children: [
|
|
9342
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
|
|
9343
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(VenueLogo, { venue, size: "small" }),
|
|
9344
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "truncate text-agg-base font-agg-normal leading-6 text-agg-foreground", children: displayName })
|
|
9016
9345
|
] }),
|
|
9017
|
-
availabilityState === "geoblocked" ? /* @__PURE__ */ (0,
|
|
9346
|
+
availabilityState === "geoblocked" ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(GeoblockedStatus, {}) : isKalshi && !isConnected ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
9018
9347
|
"button",
|
|
9019
9348
|
{
|
|
9020
9349
|
type: "button",
|
|
@@ -9023,9 +9352,9 @@ var TradingAccessTab = ({
|
|
|
9023
9352
|
className: "shrink-0 cursor-pointer text-agg-sm font-agg-bold leading-agg-5 text-agg-primary whitespace-nowrap focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary disabled:cursor-not-allowed disabled:opacity-60",
|
|
9024
9353
|
children: labels.trading.tradingAccessAddKalshiAccount
|
|
9025
9354
|
}
|
|
9026
|
-
) : isKalshi && !isVerified ? /* @__PURE__ */ (0,
|
|
9027
|
-
/* @__PURE__ */ (0,
|
|
9028
|
-
/* @__PURE__ */ (0,
|
|
9355
|
+
) : isKalshi && !isVerified ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
9356
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: labels.trading.kycRequired }),
|
|
9357
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
9029
9358
|
"button",
|
|
9030
9359
|
{
|
|
9031
9360
|
type: "button",
|
|
@@ -9035,10 +9364,10 @@ var TradingAccessTab = ({
|
|
|
9035
9364
|
children: verifyConnectionLabel
|
|
9036
9365
|
}
|
|
9037
9366
|
)
|
|
9038
|
-
] }) : isKalshi && isVerified ? /* @__PURE__ */ (0,
|
|
9039
|
-
/* @__PURE__ */ (0,
|
|
9040
|
-
/* @__PURE__ */ (0,
|
|
9041
|
-
onDisconnectKalshi ? /* @__PURE__ */ (0,
|
|
9367
|
+
] }) : isKalshi && isVerified ? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)("div", { className: "flex items-center gap-4", children: [
|
|
9368
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)("span", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground whitespace-nowrap", children: labels.trading.verified }),
|
|
9369
|
+
/* @__PURE__ */ (0, import_jsx_runtime133.jsx)(AvailableStatus, {}),
|
|
9370
|
+
onDisconnectKalshi ? /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(
|
|
9042
9371
|
"button",
|
|
9043
9372
|
{
|
|
9044
9373
|
type: "button",
|
|
@@ -9047,15 +9376,194 @@ var TradingAccessTab = ({
|
|
|
9047
9376
|
children: labels.auth.disconnect
|
|
9048
9377
|
}
|
|
9049
9378
|
) : null
|
|
9050
|
-
] }) : /* @__PURE__ */ (0,
|
|
9379
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(AvailableStatus, {})
|
|
9051
9380
|
] }, venue);
|
|
9052
9381
|
}) })
|
|
9053
9382
|
] });
|
|
9054
9383
|
};
|
|
9055
9384
|
TradingAccessTab.displayName = "TradingAccessTab";
|
|
9056
9385
|
|
|
9386
|
+
// src/profile/tabs/balance-management-tab.tsx
|
|
9387
|
+
var import_react20 = require("react");
|
|
9388
|
+
var import_hooks41 = require("@agg-build/hooks");
|
|
9389
|
+
var import_jsx_runtime134 = require("react/jsx-runtime");
|
|
9390
|
+
var CHAIN_IDS_BY_NETWORK = {
|
|
9391
|
+
mainnet: 1,
|
|
9392
|
+
bnb: 56,
|
|
9393
|
+
polygon: 137,
|
|
9394
|
+
base: 8453,
|
|
9395
|
+
arbitrum: 42161,
|
|
9396
|
+
solana: 792703809,
|
|
9397
|
+
hyperliquid: 1337
|
|
9398
|
+
};
|
|
9399
|
+
var NETWORK_BY_CHAIN_ID = Object.fromEntries(
|
|
9400
|
+
Object.entries(CHAIN_IDS_BY_NETWORK).map(([network, chainId]) => [chainId, network])
|
|
9401
|
+
);
|
|
9402
|
+
var networkItems = SUPPORTED_NETWORKS.filter(
|
|
9403
|
+
(network) => network.value in CHAIN_IDS_BY_NETWORK
|
|
9404
|
+
).map((network) => ({
|
|
9405
|
+
value: network.value,
|
|
9406
|
+
label: network.label,
|
|
9407
|
+
iconUrl: network.iconUrl
|
|
9408
|
+
}));
|
|
9409
|
+
var dollarsToRaw = (amount) => String(Math.round(amount * 1e6));
|
|
9410
|
+
var rawToDollars = (amount) => Number(amount) / 1e6;
|
|
9411
|
+
var BalanceManagementTab = ({ enabled }) => {
|
|
9412
|
+
const labels = (0, import_hooks41.useAggLabels)().balanceRefill;
|
|
9413
|
+
const { policies, isLoading, isError, createPolicy, updatePolicy } = (0, import_hooks41.useBalanceRefillPolicies)({
|
|
9414
|
+
enabled
|
|
9415
|
+
});
|
|
9416
|
+
const policy = policies[0];
|
|
9417
|
+
const [network, setNetwork] = (0, import_react20.useState)("polygon");
|
|
9418
|
+
const [minimum, setMinimum] = (0, import_react20.useState)(100);
|
|
9419
|
+
const [refillAmount, setRefillAmount] = (0, import_react20.useState)(50);
|
|
9420
|
+
const [dailyCap, setDailyCap] = (0, import_react20.useState)(200);
|
|
9421
|
+
const [maximumFee, setMaximumFee] = (0, import_react20.useState)(2);
|
|
9422
|
+
const [feedback, setFeedback] = (0, import_react20.useState)(null);
|
|
9423
|
+
(0, import_react20.useEffect)(() => {
|
|
9424
|
+
var _a;
|
|
9425
|
+
if (!policy) return;
|
|
9426
|
+
setNetwork((_a = NETWORK_BY_CHAIN_ID[policy.targetChainId]) != null ? _a : "polygon");
|
|
9427
|
+
setMinimum(rawToDollars(policy.minimumRaw));
|
|
9428
|
+
setRefillAmount(rawToDollars(policy.refillAmountRaw));
|
|
9429
|
+
setDailyCap(rawToDollars(policy.dailyCapRaw));
|
|
9430
|
+
setMaximumFee(rawToDollars(policy.maxFeeRaw));
|
|
9431
|
+
}, [policy]);
|
|
9432
|
+
const validationError = (0, import_react20.useMemo)(() => {
|
|
9433
|
+
if (minimum <= 0 || refillAmount <= 0 || dailyCap <= 0 || maximumFee <= 0) {
|
|
9434
|
+
return labels.saveError;
|
|
9435
|
+
}
|
|
9436
|
+
if (dailyCap < Math.max(minimum, refillAmount) + maximumFee) {
|
|
9437
|
+
return labels.saveError;
|
|
9438
|
+
}
|
|
9439
|
+
return null;
|
|
9440
|
+
}, [dailyCap, labels.saveError, maximumFee, minimum, refillAmount]);
|
|
9441
|
+
const isPending = createPolicy.isPending || updatePolicy.isPending;
|
|
9442
|
+
const handleSave = () => __async(null, null, function* () {
|
|
9443
|
+
if (validationError) {
|
|
9444
|
+
setFeedback(validationError);
|
|
9445
|
+
return;
|
|
9446
|
+
}
|
|
9447
|
+
setFeedback(null);
|
|
9448
|
+
const params = {
|
|
9449
|
+
minimumRaw: dollarsToRaw(minimum),
|
|
9450
|
+
refillAmountRaw: dollarsToRaw(refillAmount),
|
|
9451
|
+
dailyCapRaw: dollarsToRaw(dailyCap),
|
|
9452
|
+
maxFeeRaw: dollarsToRaw(maximumFee)
|
|
9453
|
+
};
|
|
9454
|
+
try {
|
|
9455
|
+
if (policy) {
|
|
9456
|
+
yield updatePolicy.mutateAsync({ policyId: policy.id, params });
|
|
9457
|
+
} else {
|
|
9458
|
+
yield createPolicy.mutateAsync(__spreadProps(__spreadValues({}, params), {
|
|
9459
|
+
targetChainId: CHAIN_IDS_BY_NETWORK[network],
|
|
9460
|
+
targetTokenSymbol: "USDC"
|
|
9461
|
+
}));
|
|
9462
|
+
}
|
|
9463
|
+
setFeedback(labels.saved);
|
|
9464
|
+
} catch (e) {
|
|
9465
|
+
setFeedback(labels.saveError);
|
|
9466
|
+
}
|
|
9467
|
+
});
|
|
9468
|
+
const handleStatus = () => __async(null, null, function* () {
|
|
9469
|
+
if (!policy) return;
|
|
9470
|
+
try {
|
|
9471
|
+
yield updatePolicy.mutateAsync({
|
|
9472
|
+
policyId: policy.id,
|
|
9473
|
+
params: { status: policy.status === "enabled" ? "paused" : "enabled" }
|
|
9474
|
+
});
|
|
9475
|
+
setFeedback(labels.saved);
|
|
9476
|
+
} catch (e) {
|
|
9477
|
+
setFeedback(labels.saveError);
|
|
9478
|
+
}
|
|
9479
|
+
});
|
|
9480
|
+
if (isLoading)
|
|
9481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.loading });
|
|
9482
|
+
if (isError)
|
|
9483
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { role: "alert", className: "text-agg-sm text-agg-error", children: labels.loadError });
|
|
9484
|
+
const latestAttempt = policy == null ? void 0 : policy.latestAttempt;
|
|
9485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("section", { className: "agg-balance-management-tab flex flex-col gap-6", children: [
|
|
9486
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
9487
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("h2", { className: "text-agg-lg font-agg-semibold text-agg-foreground", children: labels.title }),
|
|
9488
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: labels.description })
|
|
9489
|
+
] }),
|
|
9490
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "rounded-agg-lg border border-agg-separator p-5 flex flex-col gap-5", children: [
|
|
9491
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("label", { className: "flex flex-col gap-2 text-agg-sm text-agg-foreground", children: [
|
|
9492
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { children: labels.networkLabel }),
|
|
9493
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
9494
|
+
Select,
|
|
9495
|
+
{
|
|
9496
|
+
items: networkItems,
|
|
9497
|
+
value: network,
|
|
9498
|
+
onChange: (value) => setNetwork(value),
|
|
9499
|
+
ariaLabel: labels.networkLabel,
|
|
9500
|
+
disabled: Boolean(policy)
|
|
9501
|
+
}
|
|
9502
|
+
)
|
|
9503
|
+
] }),
|
|
9504
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2", children: [
|
|
9505
|
+
[labels.minimumLabel, minimum, setMinimum],
|
|
9506
|
+
[labels.refillAmountLabel, refillAmount, setRefillAmount],
|
|
9507
|
+
[labels.dailyCapLabel, dailyCap, setDailyCap],
|
|
9508
|
+
[labels.maximumFeeLabel, maximumFee, setMaximumFee]
|
|
9509
|
+
].map(([label, value, onChange]) => /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(
|
|
9510
|
+
"label",
|
|
9511
|
+
{
|
|
9512
|
+
className: "flex flex-col gap-2 rounded-agg-md bg-agg-secondary px-4 py-3 text-agg-sm text-agg-foreground",
|
|
9513
|
+
children: [
|
|
9514
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { children: label }),
|
|
9515
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
9516
|
+
CurrencyInput,
|
|
9517
|
+
{
|
|
9518
|
+
value,
|
|
9519
|
+
onChange,
|
|
9520
|
+
min: 0.01,
|
|
9521
|
+
decimalPlaces: 2,
|
|
9522
|
+
ariaLabel: label,
|
|
9523
|
+
classNames: { input: "w-full text-agg-base font-agg-semibold" }
|
|
9524
|
+
}
|
|
9525
|
+
)
|
|
9526
|
+
]
|
|
9527
|
+
},
|
|
9528
|
+
label
|
|
9529
|
+
)) }),
|
|
9530
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-xs text-agg-secondary-foreground", children: labels.consent }),
|
|
9531
|
+
policy ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: policy.status === "enabled" ? labels.activeLabel : labels.pausedLabel }) : null,
|
|
9532
|
+
latestAttempt ? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("p", { className: "text-agg-sm text-agg-secondary-foreground", children: [
|
|
9533
|
+
labels.lastRefill,
|
|
9534
|
+
": ",
|
|
9535
|
+
labels.statuses[latestAttempt.status]
|
|
9536
|
+
] }) : null,
|
|
9537
|
+
feedback ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("p", { role: feedback === labels.saveError ? "alert" : "status", className: "text-agg-sm", children: feedback }) : null,
|
|
9538
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsxs)("div", { className: "flex flex-wrap gap-3", children: [
|
|
9539
|
+
/* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
9540
|
+
Button,
|
|
9541
|
+
{
|
|
9542
|
+
variant: "primary",
|
|
9543
|
+
size: "large",
|
|
9544
|
+
isLoading: isPending,
|
|
9545
|
+
disabled: Boolean(validationError),
|
|
9546
|
+
onClick: () => void handleSave(),
|
|
9547
|
+
children: policy ? labels.saveAction : labels.enableAction
|
|
9548
|
+
}
|
|
9549
|
+
),
|
|
9550
|
+
policy ? /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
9551
|
+
Button,
|
|
9552
|
+
{
|
|
9553
|
+
variant: "secondary",
|
|
9554
|
+
size: "large",
|
|
9555
|
+
isLoading: isPending,
|
|
9556
|
+
onClick: () => void handleStatus(),
|
|
9557
|
+
children: policy.status === "enabled" ? labels.pauseAction : labels.resumeAction
|
|
9558
|
+
}
|
|
9559
|
+
) : null
|
|
9560
|
+
] })
|
|
9561
|
+
] })
|
|
9562
|
+
] });
|
|
9563
|
+
};
|
|
9564
|
+
|
|
9057
9565
|
// src/profile/index.tsx
|
|
9058
|
-
var
|
|
9566
|
+
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
9059
9567
|
var ProfileModal = ({
|
|
9060
9568
|
open,
|
|
9061
9569
|
onOpenChange,
|
|
@@ -9079,30 +9587,35 @@ var ProfileModal = ({
|
|
|
9079
9587
|
onDisconnectExchange
|
|
9080
9588
|
}) => {
|
|
9081
9589
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
9082
|
-
const client = (0,
|
|
9083
|
-
const
|
|
9590
|
+
const client = (0, import_hooks42.useAggClient)();
|
|
9591
|
+
const labels = (0, import_hooks42.useAggLabels)();
|
|
9592
|
+
const { user } = (0, import_hooks42.useAggAuthState)();
|
|
9084
9593
|
const toastCtx = useOptionalToast();
|
|
9085
|
-
const [activeTab, setActiveTab] = (0,
|
|
9594
|
+
const [activeTab, setActiveTab] = (0, import_react21.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
|
|
9595
|
+
const profileTabItems = (0, import_react21.useMemo)(
|
|
9596
|
+
() => getProfileTabItems(labels.balanceRefill.tabLabel),
|
|
9597
|
+
[labels.balanceRefill.tabLabel]
|
|
9598
|
+
);
|
|
9086
9599
|
const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
|
|
9087
|
-
const [draftUsername, setDraftUsername] = (0,
|
|
9088
|
-
const [draftAvatarFile, setDraftAvatarFile] = (0,
|
|
9089
|
-
const [draftAvatarPreview, setDraftAvatarPreview] = (0,
|
|
9090
|
-
const [isSaving, setIsSaving] = (0,
|
|
9091
|
-
const [avatarTypeError, setAvatarTypeError] = (0,
|
|
9092
|
-
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0,
|
|
9093
|
-
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0,
|
|
9600
|
+
const [draftUsername, setDraftUsername] = (0, import_react21.useState)(resolvedInitialUsername);
|
|
9601
|
+
const [draftAvatarFile, setDraftAvatarFile] = (0, import_react21.useState)();
|
|
9602
|
+
const [draftAvatarPreview, setDraftAvatarPreview] = (0, import_react21.useState)();
|
|
9603
|
+
const [isSaving, setIsSaving] = (0, import_react21.useState)(false);
|
|
9604
|
+
const [avatarTypeError, setAvatarTypeError] = (0, import_react21.useState)(null);
|
|
9605
|
+
const [isConnectKalshiModalOpen, setIsConnectKalshiModalOpen] = (0, import_react21.useState)(false);
|
|
9606
|
+
const { data: kalshiStatus, refetch: refetchKalshiStatus } = (0, import_hooks42.useVenueKeyStatus)(
|
|
9094
9607
|
import_sdk12.Venue.kalshi,
|
|
9095
9608
|
open
|
|
9096
9609
|
);
|
|
9097
|
-
(0,
|
|
9610
|
+
(0, import_react21.useEffect)(() => {
|
|
9098
9611
|
var _a2;
|
|
9099
9612
|
setDraftUsername((_a2 = username != null ? username : user == null ? void 0 : user.username) != null ? _a2 : "");
|
|
9100
9613
|
}, [username, user == null ? void 0 : user.username]);
|
|
9101
|
-
(0,
|
|
9614
|
+
(0, import_react21.useEffect)(() => {
|
|
9102
9615
|
if (open) return;
|
|
9103
9616
|
setIsConnectKalshiModalOpen(false);
|
|
9104
9617
|
}, [open]);
|
|
9105
|
-
const handleOpenChange = (0,
|
|
9618
|
+
const handleOpenChange = (0, import_react21.useCallback)(
|
|
9106
9619
|
(isOpen) => {
|
|
9107
9620
|
var _a2;
|
|
9108
9621
|
if (!isOpen) {
|
|
@@ -9126,7 +9639,7 @@ var ProfileModal = ({
|
|
|
9126
9639
|
setDraftAvatarPreview
|
|
9127
9640
|
]
|
|
9128
9641
|
);
|
|
9129
|
-
const handleDraftAvatarChange = (0,
|
|
9642
|
+
const handleDraftAvatarChange = (0, import_react21.useCallback)(
|
|
9130
9643
|
(file, preview) => {
|
|
9131
9644
|
const ACCEPTED_AVATAR_TYPES = ["image/jpeg", "image/png", "image/gif", "image/webp"];
|
|
9132
9645
|
if (file && !ACCEPTED_AVATAR_TYPES.includes(file.type)) {
|
|
@@ -9141,7 +9654,7 @@ var ProfileModal = ({
|
|
|
9141
9654
|
);
|
|
9142
9655
|
const originalUsername = (_b = username != null ? username : user == null ? void 0 : user.username) != null ? _b : "";
|
|
9143
9656
|
const hasChanges = draftUsername !== originalUsername || draftAvatarFile !== void 0;
|
|
9144
|
-
const handleSave = (0,
|
|
9657
|
+
const handleSave = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9145
9658
|
var _a2, _b2, _c2;
|
|
9146
9659
|
setIsSaving(true);
|
|
9147
9660
|
try {
|
|
@@ -9196,10 +9709,10 @@ var ProfileModal = ({
|
|
|
9196
9709
|
originalUsername,
|
|
9197
9710
|
toastCtx
|
|
9198
9711
|
]);
|
|
9199
|
-
const handleCancel = (0,
|
|
9712
|
+
const handleCancel = (0, import_react21.useCallback)(() => {
|
|
9200
9713
|
handleOpenChange(false);
|
|
9201
9714
|
}, [handleOpenChange]);
|
|
9202
|
-
const handleVerifyKalshi = (0,
|
|
9715
|
+
const handleVerifyKalshi = (0, import_react21.useCallback)(
|
|
9203
9716
|
(credentials) => __async(null, null, function* () {
|
|
9204
9717
|
if (onConnectKalshi) {
|
|
9205
9718
|
yield onConnectKalshi(credentials);
|
|
@@ -9217,12 +9730,12 @@ var ProfileModal = ({
|
|
|
9217
9730
|
}),
|
|
9218
9731
|
[client, onConnectKalshi, refetchKalshiStatus]
|
|
9219
9732
|
);
|
|
9220
|
-
const handleDisconnectKalshi = (0,
|
|
9733
|
+
const handleDisconnectKalshi = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9221
9734
|
yield client.deleteVenueKey(import_sdk12.Venue.kalshi);
|
|
9222
9735
|
yield refetchKalshiStatus();
|
|
9223
9736
|
onDisconnectExchange == null ? void 0 : onDisconnectExchange(import_sdk12.Venue.kalshi);
|
|
9224
9737
|
}), [client, onDisconnectExchange, refetchKalshiStatus]);
|
|
9225
|
-
const resolvedVenueAccounts = (0,
|
|
9738
|
+
const resolvedVenueAccounts = (0, import_react21.useMemo)(() => {
|
|
9226
9739
|
var _a2;
|
|
9227
9740
|
const nonKalshiAccounts = (_a2 = user == null ? void 0 : user.venueAccounts) == null ? void 0 : _a2.filter((account) => account.venue !== "kalshi");
|
|
9228
9741
|
if (!kalshiStatus) return user == null ? void 0 : user.venueAccounts;
|
|
@@ -9278,7 +9791,7 @@ var ProfileModal = ({
|
|
|
9278
9791
|
if (typeof window === "undefined") return;
|
|
9279
9792
|
((_a2 = window.top) != null ? _a2 : window).location.assign(url);
|
|
9280
9793
|
};
|
|
9281
|
-
const surfaceError = (0,
|
|
9794
|
+
const surfaceError = (0, import_react21.useCallback)(
|
|
9282
9795
|
(err, title) => {
|
|
9283
9796
|
const message = (err == null ? void 0 : err.message) || "Something went wrong. Please try again.";
|
|
9284
9797
|
if (toastCtx) {
|
|
@@ -9289,7 +9802,7 @@ var ProfileModal = ({
|
|
|
9289
9802
|
},
|
|
9290
9803
|
[toastCtx]
|
|
9291
9804
|
);
|
|
9292
|
-
const handleConnectTwitter = (0,
|
|
9805
|
+
const handleConnectTwitter = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9293
9806
|
try {
|
|
9294
9807
|
const result = yield client.linkAccount({
|
|
9295
9808
|
provider: "twitter",
|
|
@@ -9303,7 +9816,7 @@ var ProfileModal = ({
|
|
|
9303
9816
|
surfaceError(err, "Could not connect X (Twitter)");
|
|
9304
9817
|
}
|
|
9305
9818
|
}), [client, onConnectTwitter, surfaceError]);
|
|
9306
|
-
const handleConnectGoogle = (0,
|
|
9819
|
+
const handleConnectGoogle = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9307
9820
|
try {
|
|
9308
9821
|
const result = yield client.linkAccount({
|
|
9309
9822
|
provider: "google",
|
|
@@ -9317,7 +9830,7 @@ var ProfileModal = ({
|
|
|
9317
9830
|
surfaceError(err, "Could not connect Google");
|
|
9318
9831
|
}
|
|
9319
9832
|
}), [client, onConnectGoogle, surfaceError]);
|
|
9320
|
-
const handleConnectApple = (0,
|
|
9833
|
+
const handleConnectApple = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9321
9834
|
try {
|
|
9322
9835
|
const result = yield client.linkAccount({
|
|
9323
9836
|
provider: "apple",
|
|
@@ -9331,7 +9844,7 @@ var ProfileModal = ({
|
|
|
9331
9844
|
surfaceError(err, "Could not connect Apple");
|
|
9332
9845
|
}
|
|
9333
9846
|
}), [client, onConnectApple, surfaceError]);
|
|
9334
|
-
const handleDisconnectTwitter = (0,
|
|
9847
|
+
const handleDisconnectTwitter = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9335
9848
|
try {
|
|
9336
9849
|
yield client.disconnectAccount("twitter");
|
|
9337
9850
|
yield client.getCurrentUser();
|
|
@@ -9340,7 +9853,7 @@ var ProfileModal = ({
|
|
|
9340
9853
|
surfaceError(err, "Could not disconnect X (Twitter)");
|
|
9341
9854
|
}
|
|
9342
9855
|
}), [client, onDisconnectTwitter, surfaceError]);
|
|
9343
|
-
const handleDisconnectGoogle = (0,
|
|
9856
|
+
const handleDisconnectGoogle = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9344
9857
|
try {
|
|
9345
9858
|
yield client.disconnectAccount("google");
|
|
9346
9859
|
yield client.getCurrentUser();
|
|
@@ -9349,7 +9862,7 @@ var ProfileModal = ({
|
|
|
9349
9862
|
surfaceError(err, "Could not disconnect Google");
|
|
9350
9863
|
}
|
|
9351
9864
|
}), [client, onDisconnectGoogle, surfaceError]);
|
|
9352
|
-
const handleDisconnectApple = (0,
|
|
9865
|
+
const handleDisconnectApple = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9353
9866
|
try {
|
|
9354
9867
|
yield client.disconnectAccount("apple");
|
|
9355
9868
|
yield client.getCurrentUser();
|
|
@@ -9358,7 +9871,7 @@ var ProfileModal = ({
|
|
|
9358
9871
|
surfaceError(err, "Could not disconnect Apple");
|
|
9359
9872
|
}
|
|
9360
9873
|
}), [client, onDisconnectApple, surfaceError]);
|
|
9361
|
-
const handleConnectEmail = (0,
|
|
9874
|
+
const handleConnectEmail = (0, import_react21.useCallback)(() => __async(null, null, function* () {
|
|
9362
9875
|
var _a2;
|
|
9363
9876
|
const typedEmail = typeof window !== "undefined" ? (_a2 = window.prompt("Enter your email to receive a magic link")) == null ? void 0 : _a2.trim() : void 0;
|
|
9364
9877
|
if (!typedEmail) return;
|
|
@@ -9377,7 +9890,7 @@ var ProfileModal = ({
|
|
|
9377
9890
|
surfaceError(err, "Could not connect email");
|
|
9378
9891
|
}
|
|
9379
9892
|
}), [client, onConnectEmail, surfaceError, toastCtx]);
|
|
9380
|
-
const handleDisconnectWallet = (0,
|
|
9893
|
+
const handleDisconnectWallet = (0, import_react21.useCallback)(
|
|
9381
9894
|
(wallet) => __async(null, null, function* () {
|
|
9382
9895
|
const normalizedChain = wallet.chain.toLowerCase();
|
|
9383
9896
|
const provider = normalizedChain === "solana" || normalizedChain === "svm" ? "solana_wallet" : "wallet";
|
|
@@ -9391,7 +9904,7 @@ var ProfileModal = ({
|
|
|
9391
9904
|
}),
|
|
9392
9905
|
[client, onDisconnectWallet, surfaceError]
|
|
9393
9906
|
);
|
|
9394
|
-
const providerActionMap = (0,
|
|
9907
|
+
const providerActionMap = (0, import_react21.useMemo)(
|
|
9395
9908
|
() => ({
|
|
9396
9909
|
twitter: {
|
|
9397
9910
|
connect: () => {
|
|
@@ -9433,7 +9946,7 @@ var ProfileModal = ({
|
|
|
9433
9946
|
handleDisconnectTwitter
|
|
9434
9947
|
]
|
|
9435
9948
|
);
|
|
9436
|
-
const resolvedWallets = (0,
|
|
9949
|
+
const resolvedWallets = (0, import_react21.useMemo)(() => {
|
|
9437
9950
|
var _a2, _b2;
|
|
9438
9951
|
if (wallets) return wallets;
|
|
9439
9952
|
const walletAccounts = (_b2 = (_a2 = user == null ? void 0 : user.accounts) == null ? void 0 : _a2.filter((account) => {
|
|
@@ -9452,8 +9965,8 @@ var ProfileModal = ({
|
|
|
9452
9965
|
};
|
|
9453
9966
|
});
|
|
9454
9967
|
}, [user == null ? void 0 : user.accounts, wallets]);
|
|
9455
|
-
return /* @__PURE__ */ (0,
|
|
9456
|
-
/* @__PURE__ */ (0,
|
|
9968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(Modal, { open: open && !isConnectKalshiModalOpen, onOpenChange: handleOpenChange, children: [
|
|
9969
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
9457
9970
|
Modal.Container,
|
|
9458
9971
|
{
|
|
9459
9972
|
maxWidth: "800px",
|
|
@@ -9462,24 +9975,24 @@ var ProfileModal = ({
|
|
|
9462
9975
|
container: cn("agg-profile-modal", "min-h-[37.5rem]")
|
|
9463
9976
|
},
|
|
9464
9977
|
children: [
|
|
9465
|
-
/* @__PURE__ */ (0,
|
|
9466
|
-
/* @__PURE__ */ (0,
|
|
9978
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Modal.Header, { title: "Edit Profile", classNames: { root: "agg-profile-modal-header" } }),
|
|
9979
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "agg-profile-tabs sm:hidden w-full", children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9467
9980
|
Tabs,
|
|
9468
9981
|
{
|
|
9469
9982
|
className: "w-full [&>div]:w-full",
|
|
9470
9983
|
variant: "underline",
|
|
9471
9984
|
classNames: { tabList: "w-full" },
|
|
9472
|
-
items:
|
|
9985
|
+
items: profileTabItems.map((tab) => ({
|
|
9473
9986
|
value: tab.value,
|
|
9474
9987
|
label: tab.label,
|
|
9475
|
-
icon: /* @__PURE__ */ (0,
|
|
9988
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Icon, { name: tab.icon, size: "small" })
|
|
9476
9989
|
})),
|
|
9477
9990
|
value: activeTab,
|
|
9478
9991
|
onChange: (val) => setActiveTab(val)
|
|
9479
9992
|
}
|
|
9480
9993
|
) }),
|
|
9481
|
-
/* @__PURE__ */ (0,
|
|
9482
|
-
/* @__PURE__ */ (0,
|
|
9994
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Modal.Body, { classNames: { root: cn("agg-profile-modal-body", "overflow-x-visible") }, children: /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-profile-layout flex flex-col sm:flex-row sm:gap-10", children: [
|
|
9995
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9483
9996
|
"nav",
|
|
9484
9997
|
{
|
|
9485
9998
|
className: cn(
|
|
@@ -9493,9 +10006,9 @@ var ProfileModal = ({
|
|
|
9493
10006
|
),
|
|
9494
10007
|
role: "tablist",
|
|
9495
10008
|
"aria-label": "Profile sections",
|
|
9496
|
-
children:
|
|
10009
|
+
children: profileTabItems.map((tab) => {
|
|
9497
10010
|
const isActive = activeTab === tab.value;
|
|
9498
|
-
return /* @__PURE__ */ (0,
|
|
10011
|
+
return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(
|
|
9499
10012
|
"button",
|
|
9500
10013
|
{
|
|
9501
10014
|
type: "button",
|
|
@@ -9511,9 +10024,9 @@ var ProfileModal = ({
|
|
|
9511
10024
|
isActive ? "font-agg-normal text-agg-foreground bg-agg-secondary-hover" : "font-agg-normal text-agg-foreground"
|
|
9512
10025
|
),
|
|
9513
10026
|
children: [
|
|
9514
|
-
isActive ? /* @__PURE__ */ (0,
|
|
9515
|
-
/* @__PURE__ */ (0,
|
|
9516
|
-
/* @__PURE__ */ (0,
|
|
10027
|
+
isActive ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "absolute left-0 top-0 bottom-0 w-1 bg-agg-primary" }) : null,
|
|
10028
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Icon, { name: tab.icon, size: "small", color: "currentColor" }),
|
|
10029
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "shrink-0 whitespace-nowrap", children: tab.label })
|
|
9517
10030
|
]
|
|
9518
10031
|
},
|
|
9519
10032
|
tab.value
|
|
@@ -9521,9 +10034,9 @@ var ProfileModal = ({
|
|
|
9521
10034
|
})
|
|
9522
10035
|
}
|
|
9523
10036
|
) }),
|
|
9524
|
-
/* @__PURE__ */ (0,
|
|
9525
|
-
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0,
|
|
9526
|
-
/* @__PURE__ */ (0,
|
|
10037
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-profile-content min-w-0 flex-1", children: [
|
|
10038
|
+
activeTab === PROFILE_TAB_KEYS.PROFILE_ACCOUNTS ? /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)("div", { className: "agg-profile-accounts-tab flex flex-col gap-8", children: [
|
|
10039
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9527
10040
|
AboutTab,
|
|
9528
10041
|
{
|
|
9529
10042
|
username: username != null ? username : user == null ? void 0 : user.username,
|
|
@@ -9537,7 +10050,7 @@ var ProfileModal = ({
|
|
|
9537
10050
|
avatarError: avatarTypeError
|
|
9538
10051
|
}
|
|
9539
10052
|
),
|
|
9540
|
-
/* @__PURE__ */ (0,
|
|
10053
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9541
10054
|
AccountsWalletsTab,
|
|
9542
10055
|
{
|
|
9543
10056
|
socialAccounts: resolvedSocialAccounts,
|
|
@@ -9556,7 +10069,7 @@ var ProfileModal = ({
|
|
|
9556
10069
|
}
|
|
9557
10070
|
)
|
|
9558
10071
|
] }) : null,
|
|
9559
|
-
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0,
|
|
10072
|
+
activeTab === PROFILE_TAB_KEYS.TRADING_ACCESS ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9560
10073
|
TradingAccessTab,
|
|
9561
10074
|
{
|
|
9562
10075
|
venueAccounts: resolvedVenueAccounts,
|
|
@@ -9564,12 +10077,22 @@ var ProfileModal = ({
|
|
|
9564
10077
|
onDisconnectKalshi: handleDisconnectKalshi,
|
|
9565
10078
|
onKycError
|
|
9566
10079
|
}
|
|
9567
|
-
) : null
|
|
10080
|
+
) : null,
|
|
10081
|
+
activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(BalanceManagementTab, { enabled: open }) : null
|
|
9568
10082
|
] })
|
|
9569
10083
|
] }) }),
|
|
9570
|
-
/* @__PURE__ */ (0,
|
|
9571
|
-
/* @__PURE__ */ (0,
|
|
9572
|
-
|
|
10084
|
+
activeTab === PROFILE_TAB_KEYS.BALANCE_MANAGEMENT ? null : /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(Modal.Footer, { classNames: { root: "agg-profile-modal-footer" }, children: [
|
|
10085
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
10086
|
+
Button,
|
|
10087
|
+
{
|
|
10088
|
+
variant: "secondary",
|
|
10089
|
+
size: "large",
|
|
10090
|
+
onClick: handleCancel,
|
|
10091
|
+
className: "min-w-[120px]",
|
|
10092
|
+
children: "Cancel"
|
|
10093
|
+
}
|
|
10094
|
+
),
|
|
10095
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9573
10096
|
Button,
|
|
9574
10097
|
{
|
|
9575
10098
|
variant: "primary",
|
|
@@ -9584,7 +10107,7 @@ var ProfileModal = ({
|
|
|
9584
10107
|
]
|
|
9585
10108
|
}
|
|
9586
10109
|
),
|
|
9587
|
-
/* @__PURE__ */ (0,
|
|
10110
|
+
/* @__PURE__ */ (0, import_jsx_runtime135.jsx)(
|
|
9588
10111
|
ConnectKalshiModal,
|
|
9589
10112
|
{
|
|
9590
10113
|
open: open && isConnectKalshiModalOpen,
|
|
@@ -9597,33 +10120,33 @@ var ProfileModal = ({
|
|
|
9597
10120
|
ProfileModal.displayName = "ProfileModal";
|
|
9598
10121
|
|
|
9599
10122
|
// src/geo-block-modal/index.tsx
|
|
9600
|
-
var
|
|
9601
|
-
var
|
|
9602
|
-
var
|
|
10123
|
+
var import_hooks43 = require("@agg-build/hooks");
|
|
10124
|
+
var import_react22 = require("react");
|
|
10125
|
+
var import_jsx_runtime136 = require("react/jsx-runtime");
|
|
9603
10126
|
var GeoBlockModal = ({
|
|
9604
10127
|
open,
|
|
9605
10128
|
onOpenChange,
|
|
9606
10129
|
onConfirm,
|
|
9607
10130
|
classNames
|
|
9608
10131
|
}) => {
|
|
9609
|
-
const labels = (0,
|
|
9610
|
-
const handleConfirm = (0,
|
|
10132
|
+
const labels = (0, import_hooks43.useLabels)();
|
|
10133
|
+
const handleConfirm = (0, import_react22.useCallback)(() => {
|
|
9611
10134
|
onConfirm == null ? void 0 : onConfirm();
|
|
9612
10135
|
onOpenChange(false);
|
|
9613
10136
|
}, [onConfirm, onOpenChange]);
|
|
9614
|
-
return /* @__PURE__ */ (0,
|
|
10137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
9615
10138
|
Modal,
|
|
9616
10139
|
{
|
|
9617
10140
|
open,
|
|
9618
10141
|
onOpenChange,
|
|
9619
10142
|
"aria-label": labels.trading.geoBlockModalAriaLabel,
|
|
9620
|
-
children: /* @__PURE__ */ (0,
|
|
10143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(
|
|
9621
10144
|
Modal.Container,
|
|
9622
10145
|
{
|
|
9623
10146
|
maxWidth: "480px",
|
|
9624
10147
|
classNames: { container: cn("!rounded-agg-2xl", classNames == null ? void 0 : classNames.container) },
|
|
9625
10148
|
children: [
|
|
9626
|
-
/* @__PURE__ */ (0,
|
|
10149
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
9627
10150
|
Modal.Header,
|
|
9628
10151
|
{
|
|
9629
10152
|
title: "",
|
|
@@ -9635,19 +10158,19 @@ var GeoBlockModal = ({
|
|
|
9635
10158
|
}
|
|
9636
10159
|
}
|
|
9637
10160
|
),
|
|
9638
|
-
/* @__PURE__ */ (0,
|
|
9639
|
-
/* @__PURE__ */ (0,
|
|
10161
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Modal.Body, { classNames: { root: cn("!px-10 !pt-0 !pb-12", classNames == null ? void 0 : classNames.body) }, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "flex flex-col items-center gap-8", children: [
|
|
10162
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
9640
10163
|
Icon,
|
|
9641
10164
|
{
|
|
9642
10165
|
name: "internet-security",
|
|
9643
10166
|
className: "h-[60px] w-[60px] text-agg-muted-foreground"
|
|
9644
10167
|
}
|
|
9645
10168
|
),
|
|
9646
|
-
/* @__PURE__ */ (0,
|
|
9647
|
-
/* @__PURE__ */ (0,
|
|
9648
|
-
/* @__PURE__ */ (0,
|
|
10169
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsxs)("div", { className: "flex flex-col items-center gap-3 text-center", children: [
|
|
10170
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("h2", { className: "text-agg-2xl font-agg-bold leading-agg-8 text-agg-foreground", children: labels.trading.geoBlockModalTitle }),
|
|
10171
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "text-agg-base font-agg-normal leading-agg-6 text-agg-foreground", children: labels.trading.geoBlockModalDescription })
|
|
9649
10172
|
] }),
|
|
9650
|
-
/* @__PURE__ */ (0,
|
|
10173
|
+
/* @__PURE__ */ (0, import_jsx_runtime136.jsx)(
|
|
9651
10174
|
Button,
|
|
9652
10175
|
{
|
|
9653
10176
|
variant: "secondary",
|
|
@@ -9667,27 +10190,27 @@ var GeoBlockModal = ({
|
|
|
9667
10190
|
GeoBlockModal.displayName = "GeoBlockModal";
|
|
9668
10191
|
|
|
9669
10192
|
// src/geo-block-banner/index.tsx
|
|
9670
|
-
var
|
|
9671
|
-
var
|
|
10193
|
+
var import_hooks44 = require("@agg-build/hooks");
|
|
10194
|
+
var import_jsx_runtime137 = require("react/jsx-runtime");
|
|
9672
10195
|
var GeoBlockBanner = ({
|
|
9673
10196
|
venue,
|
|
9674
10197
|
termsUrl = AGG_TERMS_OF_SERVICE_URL,
|
|
9675
10198
|
className
|
|
9676
10199
|
}) => {
|
|
9677
|
-
const labels = (0,
|
|
10200
|
+
const labels = (0, import_hooks44.useLabels)();
|
|
9678
10201
|
const message = venue ? labels.trading.geoBlockVenueMessage(venue) : labels.trading.geoBlockGenericMessage;
|
|
9679
|
-
return /* @__PURE__ */ (0,
|
|
10202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(
|
|
9680
10203
|
"div",
|
|
9681
10204
|
{
|
|
9682
10205
|
className: cn("flex items-center gap-5 rounded-agg-lg bg-agg-secondary-hover p-3", className),
|
|
9683
10206
|
role: "status",
|
|
9684
10207
|
children: [
|
|
9685
|
-
/* @__PURE__ */ (0,
|
|
10208
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsxs)("p", { className: "min-w-0 flex-1 text-agg-xs leading-agg-4 text-agg-foreground", children: [
|
|
9686
10209
|
message,
|
|
9687
|
-
/* @__PURE__ */ (0,
|
|
10210
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)("a", { href: termsUrl, className: "underline", target: "_blank", rel: "noreferrer noopener", children: labels.trading.geoBlockTermsLink }),
|
|
9688
10211
|
labels.trading.geoBlockMessageSuffix
|
|
9689
10212
|
] }),
|
|
9690
|
-
/* @__PURE__ */ (0,
|
|
10213
|
+
/* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Icon, { name: "internet-security", className: "h-6 w-6 shrink-0 text-agg-muted-foreground" })
|
|
9691
10214
|
]
|
|
9692
10215
|
}
|
|
9693
10216
|
);
|