@opexa/portal-components 0.0.133 → 0.0.134

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.
Files changed (43) hide show
  1. package/dist/services/account.js +39 -13
  2. package/dist/services/file.js +6 -1
  3. package/dist/services/game.d.ts +2 -2
  4. package/dist/services/game.js +8 -2
  5. package/dist/services/portal.d.ts +1 -5
  6. package/dist/services/portal.js +1 -5
  7. package/dist/services/queries.d.ts +0 -1
  8. package/dist/services/queries.js +0 -21
  9. package/dist/services/trigger.js +5 -1
  10. package/dist/services/wallet.js +48 -19
  11. package/dist/ui/AlertDialog/AlertDialog.d.ts +55 -55
  12. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +5 -5
  13. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  14. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  15. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  16. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  17. package/dist/ui/Dialog/Dialog.d.ts +55 -55
  18. package/dist/ui/Dialog/dialog.recipe.d.ts +5 -5
  19. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  20. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  21. package/dist/ui/Field/Field.d.ts +21 -21
  22. package/dist/ui/Field/field.recipe.d.ts +3 -3
  23. package/package.json +1 -1
  24. package/dist/components/Quests/CountdownTimer.d.ts +0 -15
  25. package/dist/components/Quests/CountdownTimer.js +0 -33
  26. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +0 -1
  27. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +0 -81
  28. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestRules.d.ts +0 -6
  29. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestRules.js +0 -15
  30. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +0 -1
  31. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +0 -28
  32. package/dist/components/Quests/OnboardingQuest/OnboardingQuestRules.d.ts +0 -6
  33. package/dist/components/Quests/OnboardingQuest/OnboardingQuestRules.js +0 -15
  34. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +0 -1
  35. package/dist/components/Quests/WageringQuest/WageringQuest.js +0 -23
  36. package/dist/components/Quests/WageringQuest/WageringQuestRules.d.ts +0 -7
  37. package/dist/components/Quests/WageringQuest/WageringQuestRules.js +0 -17
  38. package/dist/utils/createErrorFromCode.d.ts +0 -2
  39. package/dist/utils/createErrorFromCode.js +0 -11
  40. package/dist/utils/dataUrlToBlob.d.ts +0 -1
  41. package/dist/utils/dataUrlToBlob.js +0 -11
  42. package/dist/utils/resizeImageSize.d.ts +0 -1
  43. package/dist/utils/resizeImageSize.js +0 -6
@@ -1,81 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { addDays, isEqual, startOfDay } from 'date-fns';
4
- import { useState } from 'react';
5
- import { twMerge } from 'tailwind-merge';
6
- import { useCheckInDailyCheckInQuestMutation } from '../../../client/hooks/useCheckInDailyCheckInQuestMutation.js';
7
- import { useDisclosure } from '../../../client/hooks/useDisclosure.js';
8
- import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
9
- import { toaster } from '../../../client/utils/toaster.js';
10
- import { CalendarIcon } from '../../../icons/CalendarIcon.js';
11
- import { CheckIcon } from '../../../icons/CheckIcon.js';
12
- import { ClockStopWatchIcon } from '../../../icons/ClockStopWatchIcon.js';
13
- import { InfoCircleIcon } from '../../../icons/InfoCircleIcon.js';
14
- import { Badge } from '../../../ui/Badge/index.js';
15
- import { Button } from '../../../ui/Button/index.js';
16
- import { dataAttr } from '../../../utils/dataAttr.js';
17
- import { formatNumber } from '../../../utils/formatNumber.js';
18
- import { getQueryClient } from '../../../utils/getQueryClient.js';
19
- import { parseDecimal } from '../../../utils/parseDecimal.js';
20
- import { getAvailableQuestsQueryKey } from '../../../utils/queryKeys.js';
21
- import CountdownTimer from '../CountdownTimer.js';
22
- import { useQuestContext } from '../QuestsContext.js';
23
- import { DailyCheckInQuestRules } from './DailyCheckInQuestRules.js';
24
- export function DailyCheckInQuest() {
25
- const quest = useQuestContext();
26
- const queryClient = getQueryClient();
27
- const disclosure = useDisclosure();
28
- const localeInfo = useLocaleInfo();
29
- const [isExpired, setIsExpired] = useState(false);
30
- const { name, description, status, lastCheckInDate, progressPercentage, checkInStreak, thirdDayBonusAmount, sixthDayBonusAmount, seventhDayBonusAmount, endDateTime, id, } = quest;
31
- const today = startOfDay(new Date());
32
- const hasCheckedInToday = lastCheckInDate
33
- ? isEqual(today, startOfDay(new Date(lastCheckInDate)))
34
- : false;
35
- const checkedInRewards = {
36
- 3: parseDecimal(thirdDayBonusAmount, 0),
37
- 6: parseDecimal(sixthDayBonusAmount, 0),
38
- 7: parseDecimal(seventhDayBonusAmount, 0),
39
- };
40
- const dailyCheckedInData = Array.from({ length: 7 }, (_, i) => {
41
- const day = i + 1;
42
- return {
43
- day,
44
- reward: checkedInRewards[day] ? checkedInRewards[day] : null,
45
- };
46
- });
47
- const checkInDailyQuestMutation = useCheckInDailyCheckInQuestMutation({
48
- onSuccess() {
49
- toaster.success({
50
- title: 'Check-in successful 🎉',
51
- description: 'You’ve successfully checked in for today! Keep it up to maintain your streak!',
52
- });
53
- },
54
- onError(e) {
55
- toaster.error({
56
- title: 'Check-in successful 🎉',
57
- description: e.message ?? 'Check-In Failed',
58
- });
59
- },
60
- });
61
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex h-full w-full flex-col space-y-6 rounded-2xl border px-4 pb-6 pt-5", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsx(CountdownTimer, { endDateTime: endDateTime, renderAction: (timeLeft) => (_jsxs(Badge.Root, { size: "lg", colorScheme: "brand", round: false, children: [_jsx(Badge.Icon, { children: _jsx(ClockStopWatchIcon, {}) }), _jsxs(Badge.Label, { children: [timeLeft.days, "d:", timeLeft.hours, "h:", timeLeft.minutes, "m:", timeLeft.seconds, "s"] })] })), onEnd: () => setIsExpired(true) }), _jsx("div", { role: "button", className: "bg-bg-primary border-border-secondary flex size-9 cursor-pointer items-center justify-center rounded-md border", onClick: () => disclosure.setOpen(true), children: _jsx(InfoCircleIcon, { className: "text-text-disabled size-5" }) })] }), _jsx("p", { className: "text-xl font-semibold", children: name }), _jsx("p", { className: "text-text-secondary-700 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: description } })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [_jsx("div", { className: "grid grid-cols-7", children: dailyCheckedInData.map((item) => {
62
- const reward = item.reward
63
- ? `+${formatNumber(item.reward, {
64
- currency: localeInfo.currency.code,
65
- minDecimalPlaces: 0,
66
- maxDecimalPlaces: 0,
67
- })}`
68
- : '-';
69
- return (_jsx("div", { className: twMerge('flex items-center justify-center', item.day <= (checkInStreak || 0)
70
- ? 'text-brand-400'
71
- : 'text-text-secondary-700'), children: _jsx("p", { children: reward }) }, item.day));
72
- }) }), _jsx("div", { className: "bg-bg-primary h-2 w-full overflow-hidden rounded-full", children: _jsx("div", { className: "bg-utility-brand-600 h-full rounded-full transition-all duration-300", style: { width: `${progressPercentage}%` } }) }), _jsx("div", { className: "grid grid-cols-7 place-items-center", children: dailyCheckedInData.map((item) => (_jsxs("div", { className: "text-text-secondary-700 ui-active:text-brand-400 group relative size-fit", "data-active": dataAttr(item.day <= (checkInStreak ?? 0)), children: [_jsx(CalendarIcon, { className: "h-4.5 w-auto" }), _jsx("p", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-2xs leading-none", children: item.day })] }, item.day))) })] }), _jsx(Button, { onClick: () => checkInDailyQuestMutation.mutate(id), className: "disabled:bg-bg-primary disabled:text-text-disabled", disabled: isExpired ||
73
- status === 'COMPLETED' ||
74
- status === 'FAILED' ||
75
- hasCheckedInToday ||
76
- checkInDailyQuestMutation.isPending, children: hasCheckedInToday && status === 'IN_PROGRESS' ? (_jsx(CountdownTimer, { endDateTime: startOfDay(addDays(new Date(), 1)).toISOString(), renderAction: (timeLeft) => (_jsxs("div", { className: "flex items-center space-x-0.5", children: [_jsx(CheckIcon, { className: "size-5" }), _jsxs("p", { children: [timeLeft.hours, "h:", timeLeft.minutes, "m:", timeLeft.seconds, "s"] })] })), onEnd: () => {
77
- queryClient.invalidateQueries({
78
- queryKey: getAvailableQuestsQueryKey(),
79
- });
80
- } })) : ('Check-In') })] }), _jsx(DailyCheckInQuestRules, { open: disclosure.open, onOpenChange: disclosure.setOpen })] }));
81
- }
@@ -1,6 +0,0 @@
1
- export interface DailyCheckInQuestRulesProps {
2
- open?: boolean;
3
- onOpenChange?: (open: boolean) => void;
4
- defaultOpen?: boolean;
5
- }
6
- export declare function DailyCheckInQuestRules(props: DailyCheckInQuestRulesProps): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useControllableState } from '../../../client/hooks/useControllableState.js';
4
- import { XIcon } from '../../../icons/XIcon.js';
5
- import { Button } from '../../../ui/Button/index.js';
6
- import { Dialog } from '../../../ui/Dialog/index.js';
7
- import { Portal } from '../../../ui/Portal/index.js';
8
- export function DailyCheckInQuestRules(props) {
9
- const [open, setOpen] = useControllableState({
10
- value: props.open,
11
- defaultValue: props.defaultOpen ?? false,
12
- onChange: props.onOpenChange,
13
- });
14
- return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: "Daily Check-In Rules" }), _jsxs("ol", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn rewards just for checking in each day!" }), _jsx("li", { children: "Stay consistent to unlock special rewards on the 3rd, 5th, and 7th day." }), _jsx("li", { children: "Missing a day will reset your streak, starting again from Day 1." }), _jsx("li", { children: "Each check-in unlocks the next one on the following day." }), _jsx("li", { children: "Successfully check in for 7 consecutive days to complete the quest and reset the cycle." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => setOpen(false), children: "Ok" }) })] }) })] }) }));
15
- }
@@ -1 +0,0 @@
1
- export declare function OnboardingQuest(): import("react/jsx-runtime").JSX.Element;
@@ -1,28 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useShallow } from 'zustand/shallow';
3
- import { useDisclosure } from '../../../client/hooks/useDisclosure.js';
4
- import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
5
- import { CheckIcon } from '../../../icons/CheckIcon.js';
6
- import { ClockStopWatchIcon } from '../../../icons/ClockStopWatchIcon.js';
7
- import { CoinsHandIcon } from '../../../icons/CoinsHandIcon.js';
8
- import { FileCheck02Icon } from '../../../icons/FileCheck02Icon.js';
9
- import { InfoCircleIcon } from '../../../icons/InfoCircleIcon.js';
10
- import { Badge } from '../../../ui/Badge/index.js';
11
- import { Button } from '../../../ui/Button/index.js';
12
- import { Checkbox } from '../../../ui/Checkbox/index.js';
13
- import { useQuestContext } from '../QuestsContext.js';
14
- import { OnboardingQuestRules } from './OnboardingQuestRules.js';
15
- export function OnboardingQuest() {
16
- const quest = useQuestContext();
17
- const disclosure = useDisclosure();
18
- const globalStore = useGlobalStore(useShallow((ctx) => ({
19
- kyc: ctx.kyc,
20
- depositWithdrawal: ctx.depositWithdrawal,
21
- })));
22
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex h-full w-full flex-col space-y-6 rounded-2xl border px-4 pb-6 pt-5", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsxs(Badge.Root, { size: "lg", colorScheme: "brand", round: false, children: [_jsx(Badge.Icon, { children: _jsx(ClockStopWatchIcon, {}) }), _jsx(Badge.Label, { children: "123" })] }), _jsx("div", { role: "button", className: "bg-bg-primary border-border-secondary flex size-9 cursor-pointer items-center justify-center rounded-md border", children: _jsx(InfoCircleIcon, { className: "text-text-disabled size-5" }) })] }), _jsx("h2", { className: "text-xl font-semibold", children: quest.name }), _jsx("p", { className: "text-text-secondary-700 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: quest.description } })] }), _jsxs("div", { className: "w-full grow space-y-2", children: [_jsxs(Checkbox.Root, { children: [_jsx(Checkbox.Control, { className: "bg-transparent", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { className: "text-sm font-medium leading-tight", children: "Complete personal verification" }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Checkbox.Root, { children: [_jsx(Checkbox.Control, { className: "bg-transparent", children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { className: "text-sm font-medium leading-tight", children: "Make your first deposit" }), _jsx(Checkbox.HiddenInput, {})] })] }), _jsxs("div", { className: "flex gap-lg", children: [_jsxs(Button, { size: "sm", onClick: () => {
23
- globalStore.kyc.setOpen(true);
24
- }, children: [_jsx(FileCheck02Icon, { className: "size-5" }), "Verify"] }), _jsxs(Button, { size: "sm", onClick: () => {
25
- globalStore.depositWithdrawal.setTab('DEPOSIT');
26
- globalStore.depositWithdrawal.setOpen(true);
27
- }, children: [_jsx(CoinsHandIcon, { className: "size-5" }), "Deposit"] })] })] }), _jsx(OnboardingQuestRules, { open: disclosure.open, onOpenChange: disclosure.setOpen })] }));
28
- }
@@ -1,6 +0,0 @@
1
- export interface OnboardingQuestRulesProps {
2
- open?: boolean;
3
- onOpenChange?: (open: boolean) => void;
4
- defaultOpen?: boolean;
5
- }
6
- export declare function OnboardingQuestRules(props: OnboardingQuestRulesProps): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useControllableState } from '../../../client/hooks/useControllableState.js';
4
- import { XIcon } from '../../../icons/XIcon.js';
5
- import { Button } from '../../../ui/Button/index.js';
6
- import { Dialog } from '../../../ui/Dialog/index.js';
7
- import { Portal } from '../../../ui/Portal/index.js';
8
- export function OnboardingQuestRules(props) {
9
- const [open, setOpen] = useControllableState({
10
- value: props.open,
11
- defaultValue: props.defaultOpen ?? false,
12
- onChange: props.onOpenChange,
13
- });
14
- return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: "Welcome Quest Rules" }), _jsxs("ol", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Begin your quest whenever you're ready" }), _jsx("li", { children: "Tackle the tasks in any order you like" }), _jsx("li", { children: "Finish all tasks and we'll credit your reward automatically!" })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => setOpen(false), children: "Ok" }) })] }) })] }) }));
15
- }
@@ -1 +0,0 @@
1
- export declare function WageringQuest(): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { useState } from 'react';
4
- import { twMerge } from 'tailwind-merge';
5
- import { useDisclosure } from '../../../client/hooks/useDisclosure.js';
6
- import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
7
- import { ClockStopWatchIcon } from '../../../icons/ClockStopWatchIcon.js';
8
- import { InfoCircleIcon } from '../../../icons/InfoCircleIcon.js';
9
- import { Badge } from '../../../ui/Badge/index.js';
10
- import { parseDecimal } from '../../../utils/parseDecimal.js';
11
- import CountdownTimer from '../CountdownTimer.js';
12
- import { useQuestContext } from '../QuestsContext.js';
13
- import { WageringQuestModal } from './WageringQuestRules.js';
14
- export function WageringQuest() {
15
- const quest = useQuestContext();
16
- const disclosure = useDisclosure();
17
- const localeInfo = useLocaleInfo();
18
- const [isExpired, setIsExpired] = useState(false);
19
- const { progressPercentage, turnover, targetTurnover, name, description, endDateTime, bonus, status, } = quest;
20
- return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "border-border-primary bg-bg-tertiary flex h-full w-full flex-col space-y-6 rounded-2xl border px-4 pb-6 pt-5", children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start justify-between", children: [_jsx(CountdownTimer, { endDateTime: endDateTime, renderAction: (timeLeft) => (_jsxs(Badge.Root, { size: "lg", colorScheme: "brand", round: false, children: [_jsx(Badge.Icon, { children: _jsx(ClockStopWatchIcon, {}) }), _jsxs(Badge.Label, { children: [timeLeft.days, "d:", timeLeft.hours, "h:", timeLeft.minutes, "m:", timeLeft.seconds, "s"] })] })), onEnd: () => setIsExpired(true) }), _jsx("div", { role: "button", className: "bg-bg-primary border-border-secondary flex size-9 cursor-pointer items-center justify-center rounded-md border", onClick: () => disclosure.setOpen(true), children: _jsx(InfoCircleIcon, { className: "text-text-disabled size-5" }) })] }), _jsx("p", { className: "text-xl font-semibold", children: name }), _jsx("p", { className: "text-text-secondary-700 text-wrap text-sm font-normal", dangerouslySetInnerHTML: { __html: description } })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [_jsxs("div", { className: "text-text-primary-brand group flex items-center justify-between", children: [_jsxs("p", { children: ["Progress ", parseDecimal(progressPercentage, 0).toFixed(2), "%"] }), _jsxs("p", { children: [turnover, _jsxs("span", { className: "text-text-quarterary-brand", children: ["/", targetTurnover, " ", localeInfo.currency.code] })] })] }), _jsx("div", { className: "bg-bg-primary h-2 w-full overflow-hidden rounded-full", children: _jsx("div", { className: "bg-utility-brand-600 h-full rounded-full transition-all duration-300", style: { width: `${progressPercentage}%` } }) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx("div", { className: "bg-button-secondary-bg border-bg-primary-hover w-full rounded-md border px-3.5 py-2.5 text-center text-white", children: _jsxs("p", { className: twMerge(isExpired || status === 'COMPLETED' || status === 'FAILED'
21
- ? 'opacity-50 grayscale'
22
- : ''), children: ["Complete to get ", _jsxs("span", { className: "text-brand-400", children: ["\u20B1", bonus] }), ' ', "bonus!"] }) }) })] }), _jsx(WageringQuestModal, { open: disclosure.open, onOpenChange: disclosure.setOpen })] }));
23
- }
@@ -1,7 +0,0 @@
1
- interface WageringQuestModalProps {
2
- open?: boolean;
3
- onOpenChange?: (open: boolean) => void;
4
- defaultOpen?: boolean;
5
- }
6
- export declare function WageringQuestModal(props: WageringQuestModalProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,17 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useControllableState } from '../../../client/hooks/useControllableState.js';
4
- import { XIcon } from '../../../icons/XIcon.js';
5
- import { Button } from '../../../ui/Button/index.js';
6
- import { Dialog } from '../../../ui/Dialog/index.js';
7
- import { Portal } from '../../../ui/Portal/index.js';
8
- import { useQuestContext } from '../QuestsContext.js';
9
- export function WageringQuestModal(props) {
10
- const quest = useQuestContext();
11
- const [open, setOpen] = useControllableState({
12
- value: props.open,
13
- defaultValue: props.defaultOpen ?? false,
14
- onChange: props.onOpenChange,
15
- });
16
- return (_jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: open, onOpenChange: (details) => setOpen(details.open), closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)] flex items-center justify-center", children: _jsxs(Dialog.Content, { className: "min-h-auto mx-auto max-w-[343px] rounded-xl px-4 pb-0 pt-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: quest.name }), _jsxs("ol", { className: "text-text-tertiary-600 group list-disc text-wrap pl-4 text-sm font-normal", children: [_jsx("li", { children: "Earn extra rewards just by playing Slots, every bet counts, win or lose!" }), _jsx("li", { children: "Reach the wagering requirement in bets to complete the quest and claim your reward." })] })] }), _jsx("div", { className: "pb-4 pt-6", children: _jsx(Button, { onClick: () => setOpen(false), children: "Ok" }) })] }) })] }) }));
17
- }
@@ -1,2 +0,0 @@
1
- export type KnownErrorName = '' | (string & {});
2
- export declare function createErrorFromCode(name: KnownErrorName | (string & {}), message?: string): Error;
@@ -1,11 +0,0 @@
1
- // ✏️ TODO
2
- const ERROR_CODES_MAP = {
3
- '': '',
4
- };
5
- export function createErrorFromCode(name, message) {
6
- const error = new Error();
7
- error.name = name;
8
- error.message = ERROR_CODES_MAP[name] ?? message ?? 'Something went wrong';
9
- Error.captureStackTrace?.(error, createErrorFromCode);
10
- return error;
11
- }
@@ -1 +0,0 @@
1
- export declare function dataURLtoBlob(dataURL: string): Blob;
@@ -1,11 +0,0 @@
1
- export function dataURLtoBlob(dataURL) {
2
- const parts = dataURL.split(';base64,');
3
- const contentType = parts[0].split(':')[1];
4
- const raw = window.atob(parts[1]);
5
- const rawLength = raw.length;
6
- const uInt8Array = new Uint8Array(rawLength);
7
- for (let i = 0; i < rawLength; ++i) {
8
- uInt8Array[i] = raw.charCodeAt(i);
9
- }
10
- return new Blob([uInt8Array], { type: contentType });
11
- }
@@ -1 +0,0 @@
1
- export declare const resizeFile: (file: File) => Promise<unknown>;
@@ -1,6 +0,0 @@
1
- import Resizer from 'react-image-file-resizer';
2
- export const resizeFile = (file) => new Promise((resolve) => {
3
- Resizer.imageFileResizer(file, 300, 300, 'jpeg', 100, 0, (uri) => {
4
- resolve(uri);
5
- }, 'file');
6
- });