@opexa/portal-components 0.0.776 → 0.0.778
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/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
- package/dist/components/Quests/JourneyQuest.js +26 -14
- package/dist/components/Quests/Quests.client.js +9 -6
- package/dist/components/Quests/WageringQuest__next.d.ts +27 -0
- package/dist/components/Quests/WageringQuest__next.js +125 -0
- package/dist/services/queries.d.ts +2 -2
- package/dist/services/queries.js +7 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +187 -187
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +17 -17
- package/dist/ui/Carousel/Carousel.d.ts +72 -72
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +306 -306
- package/dist/ui/Menu/menu.recipe.d.ts +17 -17
- package/dist/ui/Popover/Popover.d.ts +121 -121
- package/dist/ui/Popover/popover.recipe.d.ts +11 -11
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
- package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const QRPHDepositContext: (props: {
|
|
2
2
|
value: {
|
|
3
|
-
view: "
|
|
3
|
+
view: "form" | "qrCode";
|
|
4
4
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
5
5
|
verify: () => void;
|
|
6
6
|
reset: () => void;
|
|
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
|
|
|
13
13
|
} & {
|
|
14
14
|
children?: import("react").ReactNode | undefined;
|
|
15
15
|
}) => React.ReactNode, useQRPHDepositContext: () => {
|
|
16
|
-
view: "
|
|
16
|
+
view: "form" | "qrCode";
|
|
17
17
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
18
18
|
verify: () => void;
|
|
19
19
|
reset: () => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Deposit } from '../../../../types';
|
|
2
2
|
export type UseQRPHDepositReturn = ReturnType<typeof useQRPHDeposit>;
|
|
3
3
|
export declare function useQRPHDeposit(): {
|
|
4
|
-
view: "
|
|
4
|
+
view: "form" | "qrCode";
|
|
5
5
|
status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
|
|
6
6
|
verify: () => void;
|
|
7
7
|
reset: () => void;
|
|
@@ -122,17 +122,24 @@ function Rules(props) {
|
|
|
122
122
|
const session = sessionQuery.data;
|
|
123
123
|
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 p-4", children: _jsxs(Dialog.Content, { className: twMerge('mx-auto max-h-[80vh] min-h-auto min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-10 md:scrollbar:h-2 md:scrollbar:w-2 md:scrollbar-thumb:rounded-full md:scrollbar-thumb:bg-bg-quaternary md:scrollbar-track:bg-transparent', props.className?.root), children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "group flex flex-col space-y-5 text-sm text-text-quarterary-brand", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: quest?.name || 'Quest' }), _jsxs("div", { className: "relative", children: [_jsx("div", { className: "max-h-[30vh] overflow-y-auto", children: quest?.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
|
|
124
124
|
__html: quest.description,
|
|
125
|
-
}, className:
|
|
125
|
+
}, className: "mb-3" })) : (_jsx("p", { children: "Ready for a challenge? Complete them all and get amazing rewards!" })) }), _jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-safe-area-inset-bottom h-8 bg-gradient-to-t from-bg-primary to-transparent" })] }), milestones.map((milestone) => (_jsxs("div", { className: twMerge('flex flex-col space-y-2.5 rounded-xl bg-bg-tertiary p-3', props.className?.milestone), children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: twMerge('font-medium text-base text-text-primary-900', props.className?.milestoneName), children: milestone.label }), milestone.isCompleted && (_jsx("div", { className: twMerge('flex w-fit items-center gap-1 rounded-full border border-utility-success-200 bg-utility-success-50 px-2 py-0.5 font-medium text-utility-success-700 text-xs', props.className?.completeBadge), children: "Complete" }))] }), milestone.description ? (_jsx(Prose, { className: props.className?.milestoneDescription, dangerouslySetInnerHTML: {
|
|
126
126
|
__html: milestone.description,
|
|
127
|
-
} })) : milestone.bonus ? (_jsxs("p", { className: twMerge('ml-1', props.className?.milestoneDescription), children: [quest?.milestones?.find(m => m.id === milestone.id)
|
|
128
|
-
|
|
129
|
-
`
|
|
130
|
-
|
|
131
|
-
`
|
|
127
|
+
} })) : milestone.bonus ? (_jsxs("p", { className: twMerge('ml-1', props.className?.milestoneDescription), children: [quest?.milestones?.find((m) => m.id === milestone.id)
|
|
128
|
+
?.type === 'REGISTRATION' &&
|
|
129
|
+
`Register and win Php ${milestone.bonus} Bonus`, quest?.milestones?.find((m) => m.id === milestone.id)
|
|
130
|
+
?.type === 'ACCOUNT_VERIFICATION' &&
|
|
131
|
+
`Verify your account and get Php ${milestone.bonus} Bonus`, quest?.milestones?.find((m) => m.id === milestone.id)
|
|
132
|
+
?.type === 'FIRST_DEPOSIT' &&
|
|
133
|
+
`Make your first deposit and get Php ${milestone.bonus} Bonus`, quest?.milestones?.find((m) => m.id === milestone.id)
|
|
134
|
+
?.type === 'IOS_FIRST_LOGIN' &&
|
|
135
|
+
`Login using iOS and get Php ${milestone.bonus} Bonus`, quest?.milestones?.find((m) => m.id === milestone.id)
|
|
136
|
+
?.type === 'ANDROID_FIRST_LOGIN' &&
|
|
132
137
|
`Login using Android and get Php ${milestone.bonus} Bonus`] })) : null, !milestone.isCompleted &&
|
|
133
|
-
(quest?.milestones?.find(m => m.id === milestone.id)
|
|
134
|
-
|
|
135
|
-
|
|
138
|
+
(quest?.milestones?.find((m) => m.id === milestone.id)
|
|
139
|
+
?.type === 'ACCOUNT_VERIFICATION' ||
|
|
140
|
+
quest?.milestones?.find((m) => m.id === milestone.id)
|
|
141
|
+
?.type === 'FIRST_DEPOSIT') && (_jsxs(Button, { size: "sm", onClick: () => {
|
|
142
|
+
const milestoneType = quest?.milestones?.find((m) => m.id === milestone.id)?.type;
|
|
136
143
|
if (milestoneType === 'ACCOUNT_VERIFICATION') {
|
|
137
144
|
setOpen(false);
|
|
138
145
|
globalStore.kyc.setOpen(true);
|
|
@@ -142,12 +149,17 @@ function Rules(props) {
|
|
|
142
149
|
globalStore.depositWithdrawal.setOpen(true);
|
|
143
150
|
globalStore.depositWithdrawal.setTab('DEPOSIT');
|
|
144
151
|
}
|
|
145
|
-
}, "aria-label": `Complete ${milestone.label}`, children: [quest?.milestones?.find(m
|
|
152
|
+
}, "aria-label": `Complete ${milestone.label}`, children: [quest?.milestones?.find((m) => m.id === milestone.id)
|
|
153
|
+
?.type === 'ACCOUNT_VERIFICATION' ? (_jsx(FileCheck02Icon, { className: "size-5" })) : (_jsx(CoinsHandIcon, { className: "size-5" })), quest?.milestones?.find((m) => m.id === milestone.id)
|
|
154
|
+
?.type === 'FIRST_DEPOSIT'
|
|
146
155
|
? 'Deposit'
|
|
147
156
|
: 'Verify Account'] })), !milestone.isCompleted &&
|
|
148
|
-
quest?.milestones?.find(m => m.id === milestone.id)
|
|
149
|
-
|
|
150
|
-
quest?.milestones?.find(m => m.id === milestone.id)
|
|
157
|
+
quest?.milestones?.find((m) => m.id === milestone.id)
|
|
158
|
+
?.type === 'LINK_FACEBOOK_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Facebook Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(FacebookSignInTrigger, { text: "Link Facebook Account", className: "!mt-0 flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] })), !milestone.isCompleted &&
|
|
159
|
+
quest?.milestones?.find((m) => m.id === milestone.id)
|
|
160
|
+
?.type === 'LINK_GOOGLE_ACCOUNT' && (_jsxs(_Fragment, { children: [milestone.bonus && (_jsxs("p", { className: "text-[#94969C] text-sm", children: ["Link your Google Account and get Php", ' ', milestone.bonus, " Bonus"] })), _jsx(GoogleSignInButton, { text: "Link Google Account", className: "flex h-10 w-full items-center justify-center gap-md rounded-md bg-button-primary-bg px-3 font-semibold text-button-primary-fg text-sm shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none" })] })), !milestone.isCompleted &&
|
|
161
|
+
quest?.milestones?.find((m) => m.id === milestone.id)
|
|
162
|
+
?.type === 'CUSTOM_LINK' &&
|
|
151
163
|
(() => {
|
|
152
164
|
const baseUrl = process.env.NEXT_PUBLIC_ENVIRONMENT === 'development'
|
|
153
165
|
? 'https://api.trigger.development.opexa.io'
|
|
@@ -158,7 +170,7 @@ function Rules(props) {
|
|
|
158
170
|
}
|
|
159
171
|
function QuestMilestone({ label, bonus, isCompleted = false, checkboxControlStyle, className, }) {
|
|
160
172
|
const localeInfo = useLocaleInfo();
|
|
161
|
-
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs(Checkbox.Root, { checked: isCompleted, children: [_jsx(Checkbox.Control, { className: "bg-transparent", style: checkboxControlStyle, children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { className: twMerge('font-medium text-sm leading-tight', className?.name), children: label }), _jsx(Checkbox.HiddenInput, {})] }), bonus && (_jsxs("div", { className: twMerge('rounded-[6px] border border-
|
|
173
|
+
return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs(Checkbox.Root, { checked: isCompleted, children: [_jsx(Checkbox.Control, { className: "bg-transparent", style: checkboxControlStyle, children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { className: twMerge('font-medium text-sm leading-tight', className?.name), children: label }), _jsx(Checkbox.HiddenInput, {})] }), bonus && (_jsxs("div", { className: twMerge('rounded-[6px] border border-utility-brand-200 bg-utility-brand-50 px-1.5 py-0.5 font-medium text-utility-brand-700 text-xs leading-tight', className?.bonus), children: ["+", formatNumber(bonus, {
|
|
162
174
|
currency: localeInfo.currency.code,
|
|
163
175
|
}), ' ', "Bonus"] }))] }));
|
|
164
176
|
}
|
|
@@ -6,6 +6,7 @@ import { Suspense, useState, } from 'react';
|
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import { useAvailableQuestsQuery } from '../../client/hooks/useAvailableQuestsQuery.js';
|
|
9
|
+
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
9
10
|
import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
|
|
10
11
|
import closeChest from '../../images/close-chest.png';
|
|
11
12
|
import { SegmentGroup } from '../../ui/SegmentGroup/index.js';
|
|
@@ -15,14 +16,16 @@ import { NoQuests } from './NoQuests.js';
|
|
|
15
16
|
import { OnboardingQuest } from './OnboardingQuest.js';
|
|
16
17
|
import { QuestContext } from './QuestsContext.js';
|
|
17
18
|
import { WageringQuest, } from './WageringQuest.js';
|
|
18
|
-
|
|
19
|
-
DAILY_CHECKIN: DailyCheckInQuest,
|
|
20
|
-
ONBOARDING: OnboardingQuest,
|
|
21
|
-
WAGERING: WageringQuest,
|
|
22
|
-
JOURNEY: JourneyQuest,
|
|
23
|
-
};
|
|
19
|
+
import { WageringQuestNext } from './WageringQuest__next.js';
|
|
24
20
|
const TabDefinition = z.enum(['AVAILABLE', 'COMPLETED', 'FAILED']);
|
|
25
21
|
export function Quests__client(props) {
|
|
22
|
+
const featureFlag = useFeatureFlag();
|
|
23
|
+
const QUEST_COMPONENT_MAP = {
|
|
24
|
+
DAILY_CHECKIN: DailyCheckInQuest,
|
|
25
|
+
ONBOARDING: OnboardingQuest,
|
|
26
|
+
WAGERING: featureFlag.enabled ? WageringQuestNext : WageringQuest,
|
|
27
|
+
JOURNEY: JourneyQuest,
|
|
28
|
+
};
|
|
26
29
|
const { className, style, heading } = props;
|
|
27
30
|
const classNames = isString(className) ? { root: className } : className;
|
|
28
31
|
const [tab, setTab] = useState('AVAILABLE');
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { GameProvider } from '../../types';
|
|
3
|
+
export interface ClassNameEntries {
|
|
4
|
+
root?: string;
|
|
5
|
+
progressBarContainer?: string;
|
|
6
|
+
progressBar?: string;
|
|
7
|
+
bonusText?: string;
|
|
8
|
+
bonusAmount?: string;
|
|
9
|
+
bonusContainer?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function WageringQuestNext(props: {
|
|
12
|
+
className?: string | ClassNameEntries;
|
|
13
|
+
customComplete?: ReactNode;
|
|
14
|
+
showTurnoverDecimals?: boolean;
|
|
15
|
+
gameProviderCarousel?: ReactNode;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export interface WageringClassNameEntries {
|
|
18
|
+
root?: string;
|
|
19
|
+
thumbnailRoot?: string;
|
|
20
|
+
thumbnailImage?: string;
|
|
21
|
+
thumbnailContainer?: string;
|
|
22
|
+
thumbnailRootContainer?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface GameProvidersCarouselProps {
|
|
25
|
+
gameProviders: GameProvider[];
|
|
26
|
+
}
|
|
27
|
+
export declare function GameProvidersCarousel({ ...props }: GameProvidersCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
4
|
+
import { isString } from 'lodash-es';
|
|
5
|
+
import Image from 'next/image';
|
|
6
|
+
import Link from 'next/link';
|
|
7
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import { useControllableState } from '../../client/hooks/useControllableState.js';
|
|
10
|
+
import { useDisclosure } from '../../client/hooks/useDisclosure.js';
|
|
11
|
+
import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
|
|
12
|
+
import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
|
|
13
|
+
import { GAME_PROVIDER_DATA } from '../../constants/index.js';
|
|
14
|
+
import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
|
|
15
|
+
import { ArrowRightIcon } from '../../icons/ArrowRightIcon.js';
|
|
16
|
+
import { Flag05Icon } from '../../icons/Flag05Icon.js';
|
|
17
|
+
import { Lock01Icon } from '../../icons/Lock01Icon.js';
|
|
18
|
+
import { XIcon } from '../../icons/XIcon.js';
|
|
19
|
+
import { Button } from '../../ui/Button/index.js';
|
|
20
|
+
import { Dialog } from '../../ui/Dialog/index.js';
|
|
21
|
+
import { Portal } from '../../ui/Portal/index.js';
|
|
22
|
+
import { Prose } from '../../ui/Prose/index.js';
|
|
23
|
+
import { formatNumber } from '../../utils/formatNumber.js';
|
|
24
|
+
import { parseDecimal } from '../../utils/parseDecimal.js';
|
|
25
|
+
import { useQuestContext } from './QuestsContext.js';
|
|
26
|
+
import { RemainingTime } from './RemainingTime.js';
|
|
27
|
+
export function WageringQuestNext(props) {
|
|
28
|
+
const { className, showTurnoverDecimals = true } = props;
|
|
29
|
+
const classNames = isString(className) ? { root: className } : className;
|
|
30
|
+
const quest = useQuestContext();
|
|
31
|
+
const disclosure = useDisclosure();
|
|
32
|
+
const localeInfo = useLocaleInfo();
|
|
33
|
+
const { progressPercentage, turnover, targetTurnover, name, description, bonus, status, } = quest;
|
|
34
|
+
const currentStage = useMemo(() => {
|
|
35
|
+
return quest.stage === null ||
|
|
36
|
+
quest.stage === undefined ||
|
|
37
|
+
quest.stage === 0
|
|
38
|
+
? (quest?.stage ?? 0) + 1
|
|
39
|
+
: quest.stage;
|
|
40
|
+
}, [quest.stage]);
|
|
41
|
+
const formatTurnover = (value) => {
|
|
42
|
+
if (showTurnoverDecimals) {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
// Remove decimals and format as whole number
|
|
46
|
+
const numericValue = parseFloat(value);
|
|
47
|
+
return Math.floor(numericValue).toString();
|
|
48
|
+
};
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: twMerge('flex h-full w-full flex-col space-y-6 rounded-2xl border border-border-primary bg-bg-tertiary px-4 pt-5 pb-6', classNames?.root), children: [_jsxs("div", { className: "flex flex-col space-y-2", children: [_jsxs("div", { className: "flex max-h-7.5 items-start gap-2", children: [_jsxs("div", { className: "flex w-fit items-center gap-1 rounded-md border border-[#9E165F] bg-[#4E0D30] px-2 py-1", children: [_jsx(Flag05Icon, { className: "size-4 text-[#EE46BC]" }), _jsxs("p", { className: "font-medium text-[#FAA7E0] text-sm", children: ["Stage ", currentStage] })] }), _jsx(RemainingTime, {})] }), _jsx("p", { className: "font-semibold text-xl", children: name }), _jsx(Prose, { className: "text-wrap font-normal text-sm text-text-secondary-700", dangerouslySetInnerHTML: { __html: description } })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [_jsxs("div", { className: "group flex items-center justify-between text-text-primary-brand", children: [_jsxs("p", { children: ["Progress ", parseDecimal(progressPercentage, 0).toFixed(0), "%"] }), _jsxs("p", { children: [formatTurnover(turnover), _jsxs("span", { className: "text-text-quarterary-brand", children: ["/", targetTurnover, " ", localeInfo.currency.code] })] })] }), _jsx("div", { className: twMerge('h-2 w-full overflow-hidden rounded-full bg-bg-primary', classNames?.progressBarContainer), children: _jsx("div", { className: twMerge('h-full rounded-full bg-utility-brand-600 transition-all duration-300', classNames?.progressBar), style: { width: `${progressPercentage}%` } }) }), _jsxs("div", { className: "group flex items-center justify-between text-text-primary-brand", children: [_jsxs("p", { children: ["Stage ", currentStage, " of ", quest?.program.stages?.length] }), _jsxs("div", { className: twMerge('rounded-[6px] border border-utility-brand-200 bg-utility-brand-50 px-1.5 py-0.5 font-medium text-utility-brand-700 text-xs leading-tight'), children: ["+", formatNumber(bonus, {
|
|
50
|
+
currency: localeInfo.currency.code,
|
|
51
|
+
}), ' ', "Bonus"] })] })] }), status === 'IN_PROGRESS' && (_jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: () => disclosure.setOpen(true), "aria-label": "View Details", disabled: false, className: "disabled:bg-bg-primary disabled:text-text-disabled", children: "View Details" }) }))] }), _jsx(Rules, { open: disclosure.open, onOpenChange: disclosure.setOpen, gameProviderCarousel: props.gameProviderCarousel, gameProviders: Object.entries(quest.turnoverRequirementContributionPercentagePerGameProvider ?? [])
|
|
52
|
+
.filter(([_, value]) => +value > 0)
|
|
53
|
+
.map(([key]) => key) })] }));
|
|
54
|
+
}
|
|
55
|
+
function Rules(props) {
|
|
56
|
+
const quest = useQuestContext();
|
|
57
|
+
const featureFlag = useFeatureFlag();
|
|
58
|
+
const [open, setOpen] = useControllableState({
|
|
59
|
+
value: props.open,
|
|
60
|
+
defaultValue: props.defaultOpen ?? false,
|
|
61
|
+
onChange: props.onOpenChange,
|
|
62
|
+
});
|
|
63
|
+
const currentStage = useMemo(() => {
|
|
64
|
+
return quest.stage === null ||
|
|
65
|
+
quest.stage === undefined ||
|
|
66
|
+
quest.stage === 0
|
|
67
|
+
? (quest?.stage ?? 0) + 1
|
|
68
|
+
: quest.stage;
|
|
69
|
+
}, [quest.stage]);
|
|
70
|
+
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: "mx-auto min-h-auto max-w-[400px] overflow-y-auto rounded-xl px-4 pt-5 pb-0", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col space-y-5", children: [_jsx("h2", { className: "font-semibold text-lg text-text-primary-900", children: quest.name }), _jsx("p", { className: "mb-4 font-normal text-sm text-text-tertiary-600", children: "Play and roll your way to rewards! Ready for a challenge? Complete them all and get amazing rewards!" })] }), (quest?.program.stages ?? []).map((stage, index) => currentStage >= index + 1 ? (_jsx(StageItemUnlocked, { stageDetails: stage, stageLevel: currentStage, index: index, writableBonus: quest.bonus, questCompleted: quest.status === 'COMPLETED' }, index)) : (_jsx(StageItemLocked, { index: index }, index))), ((!featureFlag.enabled &&
|
|
71
|
+
(window.location.href.includes('blucky') ||
|
|
72
|
+
window.location.href.includes('powerplay') ||
|
|
73
|
+
window.location.href.includes('inplay'))) ||
|
|
74
|
+
featureFlag.enabled) && (_jsx(GameProvidersCarousel, { gameProviders: props.gameProviders ?? [] })), _jsx("div", { className: "pt-6 pb-4", children: _jsx(Button, { onClick: () => setOpen(false), children: "Close" }) })] }) })] }) }));
|
|
75
|
+
}
|
|
76
|
+
export function GameProvidersCarousel({ ...props }) {
|
|
77
|
+
const context = useQuestContext();
|
|
78
|
+
const [emblaRef, emblaApi] = useEmblaCarousel({
|
|
79
|
+
align: 'start',
|
|
80
|
+
slidesToScroll: 2,
|
|
81
|
+
});
|
|
82
|
+
const [prevBtnDisabled, setPrevBtnDisabled] = useState(true);
|
|
83
|
+
const [nextBtnDisabled, setNextBtnDisabled] = useState(true);
|
|
84
|
+
const onPrevButtonClick = useCallback(() => emblaApi?.scrollPrev(), [emblaApi]);
|
|
85
|
+
const onNextButtonClick = useCallback(async () => {
|
|
86
|
+
emblaApi?.scrollNext();
|
|
87
|
+
}, [emblaApi]);
|
|
88
|
+
const onSelect = useCallback((emblaApi) => {
|
|
89
|
+
setPrevBtnDisabled(!emblaApi?.canScrollPrev());
|
|
90
|
+
setNextBtnDisabled(!emblaApi?.canScrollNext());
|
|
91
|
+
}, []);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!emblaApi)
|
|
94
|
+
return;
|
|
95
|
+
onSelect(emblaApi);
|
|
96
|
+
emblaApi.on('reInit', onSelect).on('select', onSelect);
|
|
97
|
+
}, [emblaApi, onSelect]);
|
|
98
|
+
const gameProviders = props.gameProviders.map((provider) => GAME_PROVIDER_DATA[provider]);
|
|
99
|
+
const classNames = isString(context.className)
|
|
100
|
+
? { root: context.className }
|
|
101
|
+
: (context.className ?? {});
|
|
102
|
+
return (_jsxs("div", { className: twMerge(classNames.root, gameProviders.length === 0 && 'hidden'), children: [_jsxs("div", { className: "flex items-center", children: [_jsx("h2", { className: "font-semibold text-lg", children: context.heading ?? 'Game Providers' }), _jsx("div", { className: "grow" }), _jsx("div", { className: "flex items-center justify-center gap-xl", children: _jsxs("div", { className: "hidden lg:flex", children: [_jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-r-none border-r-0", onClick: onPrevButtonClick, disabled: prevBtnDisabled, "aria-label": "Previous", children: _jsx(ArrowLeftIcon, { className: "size-5" }) }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "rounded-l-none", onClick: onNextButtonClick, disabled: nextBtnDisabled, "aria-label": "Next", children: _jsx(ArrowRightIcon, { className: "size-5" }) })] }) })] }), _jsx("div", { ref: emblaRef, className: twMerge('relative mt-lg overflow-hidden', classNames.thumbnailRootContainer), children: _jsx("div", { className: twMerge('flex gap-1.5', classNames.thumbnailContainer), children: gameProviders.map((provider) => {
|
|
103
|
+
const url = context.settings
|
|
104
|
+
? (context.settings
|
|
105
|
+
.find(({ providers }) => providers.includes(provider.id))
|
|
106
|
+
?.url.replace(':slug', provider.slug)
|
|
107
|
+
.replace(':id', provider?.id) ??
|
|
108
|
+
`/providers/${provider.slug}`)
|
|
109
|
+
: `/providers/${provider.slug}`;
|
|
110
|
+
return (_jsx(Link, { href: url, className: twMerge('flex h-16 w-[110px] flex-shrink-0 items-center overflow-hidden rounded-md bg-brand-800', classNames.thumbnailRoot), "aria-label": `View ${provider.name} games`, children: _jsx(Image, { src: context.gameProviderImages?.[provider.id] ?? provider.logo, alt: "", width: 300, height: 150, className: twMerge('mx-auto h-auto w-full object-contain', classNames.thumbnailImage) }) }, provider.id));
|
|
111
|
+
}) }) })] }));
|
|
112
|
+
}
|
|
113
|
+
function StageItemUnlocked({ stageLevel, stageDetails, index, writableBonus, questCompleted, }) {
|
|
114
|
+
const quest = useQuestContext();
|
|
115
|
+
const isCompleted = questCompleted || stageLevel > index + 1;
|
|
116
|
+
const progress = stageLevel > index + 1
|
|
117
|
+
? 100
|
|
118
|
+
: Math.round(Number(quest.progressPercentage ?? 0));
|
|
119
|
+
return (_jsxs("div", { className: "mb-4 flex flex-col justify-between rounded-xl bg-bg-tertiary p-3", children: [_jsxs("div", { className: "flex items-center justify-between space-x-2", children: [_jsxs("p", { className: "font-medium", children: ["Stage ", index + 1] }), isCompleted ? (_jsx("div", { className: "w-fit rounded-full border border-[#085D3A] bg-[#053321] px-2 py-0.5", children: _jsx("p", { className: "font-medium text-[#75E0A7] text-sm", children: "Completed" }) })) : (_jsx("div", { className: "w-fit rounded-full border border-[#065986] bg-[#062C41] px-2 py-0.5", children: _jsx("p", { className: "font-medium text-[#7CD4FD] text-sm", children: "Ongoing" }) }))] }), _jsxs("div", { className: "flex justify-between pt-[11px] pb-2", children: [_jsxs("p", { className: "text-sm", children: ["Progress: ", progress, "%"] }), _jsx("div", { className: twMerge('rounded-[6px] border border-utility-brand-200 bg-utility-brand-50 px-1.5 py-0.5 font-medium text-utility-brand-700 text-xs leading-tight'), children: stageLevel > index + 1
|
|
120
|
+
? `+ ${stageDetails.bonusAmount} Bonus`
|
|
121
|
+
: `+ ${writableBonus} Bonus` })] }), _jsx("div", { className: twMerge('h-2 w-full overflow-hidden rounded-full bg-bg-primary'), children: _jsx("div", { className: twMerge('h-full rounded-full bg-utility-brand-600 transition-all duration-300'), style: { width: `${progress}%` } }) })] }));
|
|
122
|
+
}
|
|
123
|
+
function StageItemLocked({ index }) {
|
|
124
|
+
return (_jsxs("div", { className: "mb-4 flex items-center justify-between rounded-xl bg-bg-tertiary p-3", children: [_jsxs("p", { className: "font-medium", children: ["Stage ", index + 1] }), _jsx("div", { className: "flex size-6 items-center justify-center rounded-full border border-utility-brand-200 bg-utility-brand-50", children: _jsx(Lock01Icon, { className: "size-3 stroke-2 font-medium text-utility-brand-500" }) })] }));
|
|
125
|
+
}
|
|
@@ -114,10 +114,10 @@ export declare const COMPLETE_ONBOARDING = "\n mutation CompleteOnboarding($inp
|
|
|
114
114
|
export declare const SKIP_ONBOARDING = "\n mutation SkipOnboarding {\n skipOnboarding\n }\n";
|
|
115
115
|
export declare const QUEST_PROGRAM_FRAGMENT = "\n fragment QuestProgramFragment on QuestProgram {\n status\n type\n name\n description\n }\n";
|
|
116
116
|
export declare const DAILY_CHECKIN_FRAGMENT = "\n \n fragment QuestProgramFragment on QuestProgram {\n status\n type\n name\n description\n }\n\n fragment DailyCheckinQuestFragment on DailyCheckInQuest {\n id\n name\n description\n type\n program {\n ...QuestProgramFragment\n }\n\n status\n progressPercentage\n turnover\n endDateTime\n dateTimeCreated\n lastCheckInDate\n startDateTime\n checkInStreak\n\n thirdDayBonusAmount\n seventhDayBonusAmount\n sixthDayBonusAmount\n }\n";
|
|
117
|
-
export declare const WAGERING_FRAGMENT = "\n fragment WageringQuestFragment on WageringQuest {\n bonus\n id\n name\n type\n description\n program {\n ...QuestProgramFragment\n
|
|
117
|
+
export declare const WAGERING_FRAGMENT = "\n fragment WageringQuestFragment on WageringQuest {\n bonus\n id\n name\n type\n description\n program {\n ...QuestProgramFragment\n ...on WageringQuestProgram {\n stages {\n targetTurnover\n bonusTurnoverRequirementMultiplier\n bonusAmount\n }\n }\n }\n status\n progressPercentage\n turnover\n targetTurnover\n endDateTime\n dateTimeCreated\n stage\n dateTimeCompleted\n turnoverRequirementContributionPercentagePerGameProvider\n }\n";
|
|
118
118
|
export declare const JOURNEY_FRAGMENT = "\n fragment JourneyQuestFragment on JourneyQuest {\n id\n name\n description\n program {\n ...QuestProgramFragment\n }\n status\n type\n progressPercentage\n bonus\n bonusAwarded\n dateTimeCreated\n endDateTime\n milestones {\n id\n type\n name\n bonusAmount\n cleared\n description\n }\n }\n";
|
|
119
119
|
export declare const ONBOARDING_QUEST_FRAGMENT = "\n fragment OnboardingQuestFragment on OnboardingQuest {\n id\n name\n description\n program {\n ...QuestProgramFragment\n }\n\n status\n type\n progressPercentage\n bonus\n endDateTime\n dateTimeCreated\n firstDepositCompleted\n accountVerificationCompleted\n }\n";
|
|
120
|
-
export declare const AVAILABLE_QUESTS = "\n \n fragment WageringQuestFragment on WageringQuest {\n bonus\n id\n name\n type\n description\n program {\n ...QuestProgramFragment\n
|
|
120
|
+
export declare const AVAILABLE_QUESTS = "\n \n fragment WageringQuestFragment on WageringQuest {\n bonus\n id\n name\n type\n description\n program {\n ...QuestProgramFragment\n ...on WageringQuestProgram {\n stages {\n targetTurnover\n bonusTurnoverRequirementMultiplier\n bonusAmount\n }\n }\n }\n status\n progressPercentage\n turnover\n targetTurnover\n endDateTime\n dateTimeCreated\n stage\n dateTimeCompleted\n turnoverRequirementContributionPercentagePerGameProvider\n }\n\n \n \n fragment QuestProgramFragment on QuestProgram {\n status\n type\n name\n description\n }\n\n fragment DailyCheckinQuestFragment on DailyCheckInQuest {\n id\n name\n description\n type\n program {\n ...QuestProgramFragment\n }\n\n status\n progressPercentage\n turnover\n endDateTime\n dateTimeCreated\n lastCheckInDate\n startDateTime\n checkInStreak\n\n thirdDayBonusAmount\n seventhDayBonusAmount\n sixthDayBonusAmount\n }\n\n \n fragment OnboardingQuestFragment on OnboardingQuest {\n id\n name\n description\n program {\n ...QuestProgramFragment\n }\n\n status\n type\n progressPercentage\n bonus\n endDateTime\n dateTimeCreated\n firstDepositCompleted\n accountVerificationCompleted\n }\n\n \n fragment JourneyQuestFragment on JourneyQuest {\n id\n name\n description\n program {\n ...QuestProgramFragment\n }\n status\n type\n progressPercentage\n bonus\n bonusAwarded\n dateTimeCreated\n endDateTime\n milestones {\n id\n type\n name\n bonusAmount\n cleared\n description\n }\n }\n\n\n query AvailableQuests {\n availableQuests {\n ... on Quest {\n ... on WageringQuest {\n ...WageringQuestFragment\n }\n ... on DailyCheckInQuest {\n ...DailyCheckinQuestFragment\n }\n ... on OnboardingQuest {\n ...OnboardingQuestFragment\n }\n ... on JourneyQuest {\n ...JourneyQuestFragment\n }\n }\n }\n }\n";
|
|
121
121
|
export declare const AVAILABLE_QUEST_IDS = "\n query AvailableQuestIds {\n availableQuests {\n ... on Node {\n id\n }\n }\n }\n";
|
|
122
122
|
export declare const CHECK_IN_DAILY_QUEST = "\n mutation checkInDailyCheckInQuest($input: CheckInDailyCheckInQuestInput!) {\n checkInDailyCheckInQuest(input: $input)\n }\n";
|
|
123
123
|
export declare const TOP_WINS = "\n query TopWins($first: Int) {\n topWins(first: $first) {\n id\n game {\n id\n name\n type\n provider\n }\n member {\n id\n name\n }\n multiplier\n payout\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -2720,8 +2720,14 @@ export const WAGERING_FRAGMENT = /* GraphQL */ `
|
|
|
2720
2720
|
description
|
|
2721
2721
|
program {
|
|
2722
2722
|
...QuestProgramFragment
|
|
2723
|
+
...on WageringQuestProgram {
|
|
2724
|
+
stages {
|
|
2725
|
+
targetTurnover
|
|
2726
|
+
bonusTurnoverRequirementMultiplier
|
|
2727
|
+
bonusAmount
|
|
2728
|
+
}
|
|
2729
|
+
}
|
|
2723
2730
|
}
|
|
2724
|
-
|
|
2725
2731
|
status
|
|
2726
2732
|
progressPercentage
|
|
2727
2733
|
turnover
|
package/dist/types/index.d.ts
CHANGED
|
@@ -716,11 +716,18 @@ export type OnboardingPlayerExperience = 'ROOKIE' | 'VETERAN';
|
|
|
716
716
|
export type QuestType = 'WAGERING' | 'DAILY_CHECKIN' | 'ONBOARDING' | 'JOURNEY';
|
|
717
717
|
export type QuestStatus = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
|
|
718
718
|
export type QuestProgramStatus = 'ACTIVE' | 'INACTIVE' | 'DELETED';
|
|
719
|
+
export interface WageringQuestStageSettings {
|
|
720
|
+
targetTurnover: number;
|
|
721
|
+
bonusTurnoverRequirementMultiplier: number;
|
|
722
|
+
bonusAmount: number;
|
|
723
|
+
stages: WageringQuestStageSettings[];
|
|
724
|
+
}
|
|
719
725
|
export interface QuestProgram {
|
|
720
726
|
type: QuestType;
|
|
721
727
|
name: string;
|
|
722
728
|
status: QuestProgramStatus;
|
|
723
729
|
description: string;
|
|
730
|
+
stages: WageringQuestStageSettings[];
|
|
724
731
|
}
|
|
725
732
|
export type MemberStatus = 'ACTIVE' | 'BLACKLISTED' | 'SUSPENDED';
|
|
726
733
|
export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'LINK_FACEBOOK_ACCOUNT' | 'LINK_GOOGLE_ACCOUNT' | 'CUSTOM_LINK' | 'CUSTOM';
|
|
@@ -763,6 +770,7 @@ export interface Quest {
|
|
|
763
770
|
firstDepositCompleted?: boolean;
|
|
764
771
|
accountVerificationCompleted?: boolean;
|
|
765
772
|
milestones?: JourneyQuestMilestone[];
|
|
773
|
+
stage?: number;
|
|
766
774
|
dateTimeCompleted?: string;
|
|
767
775
|
turnoverRequirementContributionPercentagePerGameProvider?: Partial<Record<GameProvider, string>>;
|
|
768
776
|
stages?: WageringQuestStage[];
|