@opexa/portal-components 0.0.293 → 0.0.294

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.
@@ -0,0 +1,14 @@
1
+ export interface ReCAPTCHAExecuteOptions {
2
+ action: 'submit' | (string & {});
3
+ }
4
+ export interface ReCAPTCHA {
5
+ ready(callback: () => void): void;
6
+ execute(siteKey: string, options: ReCAPTCHAExecuteOptions): Promise<string>;
7
+ }
8
+ export declare function ReCAPTCHAReady(): Promise<void>;
9
+ export declare function ReCAPTCHAExecute(options: ReCAPTCHAExecuteOptions): Promise<string>;
10
+ declare global {
11
+ interface Window {
12
+ grecaptcha: ReCAPTCHA;
13
+ }
14
+ }
@@ -0,0 +1,18 @@
1
+ import { RECAPTCHA_SITE_KEY } from '../../constants/index.js';
2
+ let loaded = false;
3
+ export function ReCAPTCHAReady() {
4
+ return new Promise((resolve) => {
5
+ if (!loaded) {
6
+ window.grecaptcha.ready(() => {
7
+ loaded = true;
8
+ resolve();
9
+ });
10
+ }
11
+ else {
12
+ resolve();
13
+ }
14
+ });
15
+ }
16
+ export async function ReCAPTCHAExecute(options) {
17
+ return await window.grecaptcha.execute(RECAPTCHA_SITE_KEY, options);
18
+ }
@@ -1,6 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from 'react';
3
+ import { useShallow } from 'zustand/react/shallow';
2
4
  import { useControllableState } from '../../client/hooks/useControllableState.js';
3
5
  import { useDisclosure } from '../../client/hooks/useDisclosure.js';
6
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
4
7
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
5
8
  import { CheckIcon } from '../../icons/CheckIcon.js';
6
9
  import { XIcon } from '../../icons/XIcon.js';
@@ -9,41 +12,51 @@ import { Checkbox } from '../../ui/Checkbox/index.js';
9
12
  import { Dialog } from '../../ui/Dialog/index.js';
10
13
  import { Portal } from '../../ui/Portal/index.js';
11
14
  import { Progress } from '../../ui/Progress/index.js';
15
+ import { Prose } from '../../ui/Prose/index.js';
12
16
  import { formatNumber } from '../../utils/formatNumber.js';
13
17
  import { getPercentage } from '../../utils/getPercentage.js';
18
+ import { useQuestContext } from './QuestsContext.js';
19
+ import { RemainingTime } from './RemainingTime.js';
14
20
  export function JourneyQuest() {
15
21
  const disclosure = useDisclosure();
16
- const localeInfo = useLocaleInfo();
17
- // dummy data
18
- const totalMilestones = 5;
19
- const currentMilestone = 3;
20
- const milestones = [
21
- {
22
- key: 'REGISTRATION',
23
- label: 'Registration',
24
- bonus: 20,
25
- isCompleted: true,
26
- },
27
- {
28
- key: 'ACCOUNT_VERIFICATION',
29
- label: 'Account Verification',
30
- bonus: null,
31
- isCompleted: false,
32
- },
33
- {
34
- key: 'FIRST_DEPOSIT',
35
- label: 'First Deposit',
36
- bonus: 20,
37
- isCompleted: false,
38
- },
39
- {
40
- key: 'IOS_FIRST_LOGIN',
41
- label: 'IOS First Login',
42
- bonus: null,
43
- isCompleted: true,
44
- },
45
- ];
46
- 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: [_jsx("div", { className: "flex max-h-7.5 items-start justify-between" }), _jsx("p", { className: "text-xl font-semibold", children: "Blucky Starter Quest" }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: "bg-bg-primary h-2 rounded-full", value: getPercentage(currentMilestone, totalMilestones), children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) }), _jsxs("p", { className: "text-text-quarterary-brand text-xs", children: [currentMilestone, "/", totalMilestones] })] }), _jsxs("div", { className: "flex w-full flex-col space-y-2", children: [milestones.map((milestone) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted }, milestone.key))), _jsx(QuestMilestone, { label: "Watch our Live event" }, "CUSTOM")] })] }), _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 })] }));
22
+ const quest = useQuestContext();
23
+ const { milestones, totalMilestones, currentMilestone, progressPercentage } = useMemo(() => {
24
+ if (!quest?.milestones) {
25
+ return {
26
+ milestones: [],
27
+ totalMilestones: 0,
28
+ currentMilestone: 0,
29
+ progressPercentage: 0,
30
+ };
31
+ }
32
+ const transformedMilestones = quest.milestones.map((milestone) => ({
33
+ key: milestone.type,
34
+ label: milestone.name,
35
+ bonus: milestone.bonusAmount
36
+ ? parseFloat(milestone.bonusAmount)
37
+ : null,
38
+ isCompleted: milestone.cleared,
39
+ id: milestone.id,
40
+ description: milestone.description,
41
+ }));
42
+ const completedCount = quest.milestones.filter((m) => m.cleared).length;
43
+ const total = quest.milestones.length;
44
+ return {
45
+ milestones: transformedMilestones,
46
+ totalMilestones: total,
47
+ currentMilestone: completedCount,
48
+ progressPercentage: quest.progressPercentage
49
+ ? parseFloat(quest.progressPercentage)
50
+ : getPercentage(completedCount, total),
51
+ };
52
+ }, [quest]);
53
+ const progressValue = useMemo(() => {
54
+ return (progressPercentage || getPercentage(currentMilestone, totalMilestones));
55
+ }, [progressPercentage, currentMilestone, totalMilestones]);
56
+ const handleViewDetails = useCallback(() => {
57
+ disclosure.setOpen(true);
58
+ }, [disclosure]);
59
+ 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: [_jsx("div", { className: "flex max-h-7.5 items-start justify-between", children: _jsx(RemainingTime, {}) }), _jsx("p", { className: "text-xl font-semibold", children: quest?.name || 'Journey Quest' }), _jsxs("div", { className: "flex w-full items-center space-x-2", children: [_jsx(Progress.Root, { max: 100, className: "bg-bg-primary h-2 rounded-full", value: progressValue, children: _jsx(Progress.Track, { children: _jsx(Progress.Range, { className: "bg-utility-brand-600" }) }) }), _jsxs("p", { className: "text-text-quarterary-brand text-xs", children: [currentMilestone, "/", totalMilestones] })] }), _jsx("div", { className: "flex w-full flex-col space-y-3", children: milestones.map((milestone) => (_jsx(QuestMilestone, { label: milestone.label, bonus: milestone.bonus, isCompleted: milestone.isCompleted }, milestone.key))) })] }), _jsx("div", { className: "flex h-full items-end", children: _jsx(Button, { size: "sm", onClick: handleViewDetails, "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, quest: quest, milestones: milestones })] }));
47
60
  }
48
61
  function Rules(props) {
49
62
  const [open, setOpen] = useControllableState({
@@ -51,7 +64,44 @@ function Rules(props) {
51
64
  defaultValue: props.defaultOpen ?? false,
52
65
  onChange: props.onOpenChange,
53
66
  });
54
- 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-[400px] overflow-y-auto rounded-xl px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "text-text-quarterary-brand group flex flex-col space-y-5 text-sm", children: [_jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: "Blucky Starter Quest" }), _jsx("p", { children: "Ready for a challenge? Complete them all and get amazing rewards!" }), _jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-base font-medium text-white", children: "Registration" }), _jsx("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: "Complete" })] }), _jsx("p", { className: "ml-1", children: "Register and win Php 50 Bonus" })] }), _jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-base font-medium text-white", children: "Account Verification" }) }), _jsx("p", { className: "ml-1", children: "Verify your account and get Php 50 Bonus" }), _jsx(Button, { size: "sm", onClick: () => { }, "aria-label": "Verify Account", children: "Verify Account" })] }), _jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "text-base font-medium text-white", children: "First Deposit" }) }), _jsx("p", { className: "ml-1", children: "Make your first deposit and get Php 50 Bonus" }), _jsx(Button, { size: "sm", onClick: () => { }, "aria-label": "Deposit", children: "Deposit" })] }), _jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-base font-medium text-white", children: "IOS First Login" }), _jsx("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: "Complete" })] }), _jsx("p", { className: "ml-1", children: "Login using iOS and get Php 50 Bonus" })] }), _jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsx("div", { className: "flex items-center justify-between", children: _jsx("p", { className: "whitespace-nowrap text-base font-medium text-white", children: "Like and Share our Official Facebook Page" }) }), _jsx("p", { className: "ml-1", children: "Win amazing prizes and bonus if you share and like our Official Facebook Page BLucky." })] }), _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", { children: ["Complete target to", ' ', _jsx("span", { className: "text-brand-400", children: "\u20B150" }), " bonus!"] }) }) })] })] }) })] }) }));
67
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
68
+ kyc: ctx.kyc,
69
+ depositWithdrawal: ctx.depositWithdrawal,
70
+ })));
71
+ const { quest, milestones } = useMemo(() => {
72
+ return {
73
+ quest: props.quest,
74
+ milestones: props.milestones || [],
75
+ };
76
+ }, [props.quest, props.milestones]);
77
+ const allMilestonesCompleted = useMemo(() => {
78
+ if (!milestones.length)
79
+ return false;
80
+ return milestones.every((milestone) => milestone.isCompleted);
81
+ }, [milestones]);
82
+ 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-[400px] overflow-y-auto rounded-xl px-4 py-5", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "text-text-quarterary-brand group flex flex-col space-y-5 text-sm", children: [_jsx("h2", { className: "text-text-primary-900 text-lg font-semibold", children: quest?.name || 'Quest' }), _jsx("p", { children: quest?.description ||
83
+ 'Ready for a challenge? Complete them all and get amazing rewards!' }), milestones.map((milestone) => (_jsxs("div", { className: "bg-bg-tertiary flex flex-col space-y-2.5 rounded-xl p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "text-base font-medium text-white", children: milestone.label }), milestone.isCompleted && (_jsx("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: "Complete" }))] }), milestone.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
84
+ __html: milestone.description,
85
+ } })) : (_jsxs("p", { className: "ml-1", children: [milestone.key === 'REGISTRATION' &&
86
+ `Register and win Php ${milestone.bonus} Bonus`, milestone.key === 'ACCOUNT_VERIFICATION' &&
87
+ `Verify your account and get Php ${milestone.bonus} Bonus`, milestone.key === 'FIRST_DEPOSIT' &&
88
+ `Make your first deposit and get Php ${milestone.bonus} Bonus`, milestone.key === 'IOS_FIRST_LOGIN' &&
89
+ `Login using iOS and get Php ${milestone.bonus} Bonus`, milestone.key === 'ANDROID_FIRST_LOGIN' &&
90
+ `Login using Android and get Php ${milestone.bonus} Bonus`] })), !milestone.isCompleted &&
91
+ (milestone.key === 'ACCOUNT_VERIFICATION' ||
92
+ milestone.key === 'FIRST_DEPOSIT') && (_jsx(Button, { size: "sm", onClick: () => {
93
+ if (milestone.key === 'ACCOUNT_VERIFICATION') {
94
+ setOpen(false);
95
+ globalStore.kyc.setOpen(true);
96
+ }
97
+ if (milestone.key === 'FIRST_DEPOSIT') {
98
+ setOpen(false);
99
+ globalStore.depositWithdrawal.setOpen(true);
100
+ globalStore.depositWithdrawal.setTab('DEPOSIT');
101
+ }
102
+ }, "aria-label": `Complete ${milestone.label}`, children: milestone.key === 'FIRST_DEPOSIT'
103
+ ? 'Deposit'
104
+ : 'Verify Account' }))] }, milestone.key))), quest?.bonus && (_jsx("div", { className: "flex h-full items-end", children: allMilestonesCompleted ? (_jsx(Button, { size: "sm", onClick: () => setOpen(false), "aria-label": "Close", className: "w-full", children: "Close" })) : (_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", { children: ["Complete target to", ' ', _jsxs("span", { className: "text-brand-400", children: ["\u20B1", quest?.bonus] }), ' ', "bonus!"] }) })) }))] })] }) })] }) }));
55
105
  }
56
106
  function QuestMilestone({ label, bonus, isCompleted = false, }) {
57
107
  const localeInfo = useLocaleInfo();
@@ -8,7 +8,7 @@ import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
8
8
  import closeChest from '../../images/close-chest.png';
9
9
  import { SegmentGroup } from '../../ui/SegmentGroup/index.js';
10
10
  import { DailyCheckInQuest } from './DailyCheckInQuest.js';
11
- // import { JourneyQuest } from './JourneyQuest.js';
11
+ import { JourneyQuest } from './JourneyQuest.js';
12
12
  import { OnboardingQuest } from './OnboardingQuest.js';
13
13
  import { QuestContext } from './QuestsContext.js';
14
14
  import { WageringQuest } from './WageringQuest.js';
@@ -16,7 +16,7 @@ const QUEST_COMPONENT_MAP = {
16
16
  DAILY_CHECKIN: DailyCheckInQuest,
17
17
  ONBOARDING: OnboardingQuest,
18
18
  WAGERING: WageringQuest,
19
- // JOURNEY: JourneyQuest,
19
+ JOURNEY: JourneyQuest,
20
20
  };
21
21
  const TabDefinition = z.enum(['AVAILABLE', 'COMPLETED']);
22
22
  export function Quests__client(props) {
@@ -109,8 +109,9 @@ export declare const SKIP_ONBOARDING = "\n mutation SkipOnboarding {\n skipO
109
109
  export declare const QUEST_PROGRAM_FRAGMENT = "\n fragment QuestProgramFragment on QuestProgram {\n status\n type\n name\n description\n }\n";
110
110
  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";
111
111
  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 }\n\n status\n progressPercentage\n turnover\n targetTurnover\n endDateTime\n dateTimeCreated\n }\n";
112
+ 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";
112
113
  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";
113
- 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 }\n\n status\n progressPercentage\n turnover\n targetTurnover\n endDateTime\n dateTimeCreated\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 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 }\n }\n }\n";
114
+ 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 }\n\n status\n progressPercentage\n turnover\n targetTurnover\n endDateTime\n dateTimeCreated\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";
114
115
  export declare const AVAILABLE_QUEST_IDS = "\n query AvailableQuestIds {\n availableQuests {\n ... on Node {\n id\n }\n }\n }\n";
115
116
  export declare const CHECK_IN_DAILY_QUEST = "\n mutation checkInDailyCheckInQuest($input: CheckInDailyCheckInQuestInput!) {\n checkInDailyCheckInQuest(input: $input)\n }\n";
116
117
  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";
@@ -2301,6 +2301,31 @@ export const WAGERING_FRAGMENT = /* GraphQL */ `
2301
2301
  dateTimeCreated
2302
2302
  }
2303
2303
  `;
2304
+ export const JOURNEY_FRAGMENT = /* GraphQL */ `
2305
+ fragment JourneyQuestFragment on JourneyQuest {
2306
+ id
2307
+ name
2308
+ description
2309
+ program {
2310
+ ...QuestProgramFragment
2311
+ }
2312
+ status
2313
+ type
2314
+ progressPercentage
2315
+ bonus
2316
+ bonusAwarded
2317
+ dateTimeCreated
2318
+ endDateTime
2319
+ milestones {
2320
+ id
2321
+ type
2322
+ name
2323
+ bonusAmount
2324
+ cleared
2325
+ description
2326
+ }
2327
+ }
2328
+ `;
2304
2329
  export const ONBOARDING_QUEST_FRAGMENT = /* GraphQL */ `
2305
2330
  fragment OnboardingQuestFragment on OnboardingQuest {
2306
2331
  id
@@ -2324,6 +2349,7 @@ export const AVAILABLE_QUESTS = /* GraphQL */ `
2324
2349
  ${WAGERING_FRAGMENT}
2325
2350
  ${DAILY_CHECKIN_FRAGMENT}
2326
2351
  ${ONBOARDING_QUEST_FRAGMENT}
2352
+ ${JOURNEY_FRAGMENT}
2327
2353
 
2328
2354
  query AvailableQuests {
2329
2355
  availableQuests {
@@ -2337,6 +2363,9 @@ export const AVAILABLE_QUESTS = /* GraphQL */ `
2337
2363
  ... on OnboardingQuest {
2338
2364
  ...OnboardingQuestFragment
2339
2365
  }
2366
+ ... on JourneyQuest {
2367
+ ...JourneyQuestFragment
2368
+ }
2340
2369
  }
2341
2370
  }
2342
2371
  }
@@ -684,7 +684,7 @@ export interface Message {
684
684
  }
685
685
  export type OnboardingStatus = 'PENDING' | 'SKIPPED' | 'COMPLETED';
686
686
  export type OnboardingPlayerExperience = 'ROOKIE' | 'VETERAN';
687
- export type QuestType = 'WAGERING' | 'DAILY_CHECKIN' | 'ONBOARDING';
687
+ export type QuestType = 'WAGERING' | 'DAILY_CHECKIN' | 'ONBOARDING' | 'JOURNEY';
688
688
  export type QuestStatus = 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
689
689
  export type QuestProgramStatus = 'ACTIVE' | 'INACTIVE' | 'DELETED';
690
690
  export interface QuestProgram {
@@ -694,6 +694,15 @@ export interface QuestProgram {
694
694
  description: string;
695
695
  }
696
696
  export type MemberStatus = 'ACTIVE' | 'BLACKLISTED' | 'SUSPENDED';
697
+ export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'CUSTOM';
698
+ export interface JourneyQuestMilestone {
699
+ id: string;
700
+ type: JourneyQuestMilestoneType;
701
+ name: string;
702
+ bonusAmount: string;
703
+ cleared: boolean;
704
+ description: string;
705
+ }
697
706
  export interface Quest {
698
707
  id: string;
699
708
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.293",
3
+ "version": "0.0.294",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",
@@ -1,12 +0,0 @@
1
- import type { ImageProps } from 'next/image';
2
- export interface BannerEntry {
3
- src: ImageProps['src'];
4
- redirectUrl?: string;
5
- }
6
- export interface BannerProps {
7
- banners: BannerEntry[];
8
- imageWidth?: number | [mobile: number, desktop: number];
9
- imageHeight?: number | [mobile: number, desktop: number];
10
- className?: string;
11
- }
12
- export declare function Banner__client(props: BannerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,49 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import emblaCarouselAutoplay from 'embla-carousel-autoplay';
4
- import useEmblaCarousel, {} from 'embla-carousel-react';
5
- import isMobile from 'is-mobile';
6
- import Image from 'next/image';
7
- import Link from 'next/link';
8
- import { Fragment, useEffect, useState } from 'react';
9
- import { twMerge } from 'tailwind-merge';
10
- import { dataAttr } from '../../utils/dataAttr.js';
11
- export function Banner__client(props) {
12
- const [emblaRef, emblaApi] = useEmblaCarousel({
13
- loop: true,
14
- align: 'start',
15
- }, [
16
- emblaCarouselAutoplay({
17
- playOnInit: true,
18
- delay: 5000,
19
- }),
20
- ]);
21
- const [currentIndex, setCurrentIndex] = useState(0);
22
- useEffect(() => {
23
- function handler(detail) {
24
- setCurrentIndex(detail?.selectedScrollSnap() ?? 0);
25
- }
26
- emblaApi?.on('scroll', handler);
27
- emblaApi?.on('init', handler);
28
- return () => {
29
- emblaApi?.on('init', handler);
30
- emblaApi?.off('scroll', handler);
31
- };
32
- }, [emblaApi]);
33
- const imageWidth = !props.imageWidth
34
- ? [400, 1200]
35
- : Array.isArray(props.imageWidth)
36
- ? props.imageWidth
37
- : [props.imageWidth, props.imageWidth];
38
- const imageHeight = !props.imageHeight
39
- ? [225, 300]
40
- : Array.isArray(props.imageHeight)
41
- ? props.imageHeight
42
- : [props.imageHeight, props.imageHeight];
43
- return (_jsxs("div", { className: twMerge('relative', props.className), children: [_jsx("div", { ref: emblaRef, className: "overflow-hidden", children: _jsx("div", { className: "flex gap-2", children: props.banners.map((banner, index) => {
44
- const img = (_jsx(Image, { src: banner.src, alt: "", width: isMobile() ? imageWidth[0] : imageWidth[1], height: isMobile() ? imageHeight[0] : imageHeight[1], className: "block h-auto w-full", priority: index === 0 }));
45
- return (_jsx(Fragment, { children: !banner.redirectUrl ? (_jsx("div", { className: "w-full shrink-0", children: img })) : (_jsx(Link, { href: banner.redirectUrl, className: "block w-full shrink-0", "aria-label": `Open ${banner.redirectUrl}`, children: img })) }, index));
46
- }) }) }), _jsx("div", { className: "absolute bottom-lg left-1/2 flex w-fit -translate-x-1/2 gap-2", children: props.banners.map((_, index) => (_jsx("button", { type: "button", className: "ui-active:bg-brand-500 bg-gray-300 size-3 shrink-0 rounded-full border border-white transition-all duration-300 ui-active:w-9", onClick: () => {
47
- emblaApi?.scrollTo(index);
48
- }, "aria-label": `Go to slide ${index + 1}`, "data-active": dataAttr(index === currentIndex) }, index))) })] }));
49
- }
@@ -1,4 +0,0 @@
1
- export interface FacebookPixelProps {
2
- fbId: string;
3
- }
4
- export declare function FacebookPixel(props: FacebookPixelProps): null;
@@ -1,4 +0,0 @@
1
- export function FacebookPixel(props) {
2
- console.log(props);
3
- return null;
4
- }
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- export * from './FacebookPixel';
@@ -1 +0,0 @@
1
- export * from './FacebookPixel.js';
@@ -1,4 +0,0 @@
1
- export interface GoogleRecaptchaProps {
2
- siteKey: string;
3
- }
4
- export declare function GoogleRecaptcha(props: GoogleRecaptchaProps): null;
@@ -1,4 +0,0 @@
1
- export function GoogleRecaptcha(props) {
2
- console.log(props);
3
- return null;
4
- }
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- export * from './GoogleRecaptcha';
@@ -1 +0,0 @@
1
- export * from './GoogleRecaptcha.js';
@@ -1,2 +0,0 @@
1
- export * from './FacebookPixel';
2
- export * from './GoogleRecaptcha';
@@ -1,2 +0,0 @@
1
- export * from './FacebookPixel/index.js';
2
- export * from './GoogleRecaptcha/index.js';