@opexa/portal-components 0.0.448 → 0.0.450

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 (106) hide show
  1. package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.d.ts +4 -0
  2. package/dist/client/hooks/useCreateGCashStandardCashInWithdrawal.js +28 -0
  3. package/dist/client/hooks/useCreateGCashWithdrawalMutation.d.ts +4 -4
  4. package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +8 -8
  5. package/dist/components/DepositWithdrawal/Withdrawal/GCashWithdrawal/GCashWithdrawal.js +79 -63
  6. package/dist/components/Quests/JourneyQuest.js +21 -5
  7. package/dist/components/SignIn/FacebookSignInTrigger.d.ts +6 -1
  8. package/dist/components/SignIn/FacebookSignInTrigger.js +2 -2
  9. package/dist/components/SignIn/GoogleSignInTrigger.d.ts +2 -0
  10. package/dist/components/SignIn/GoogleSignInTrigger.js +2 -2
  11. package/dist/constants/EnvVar.d.ts +1 -1
  12. package/dist/types/index.d.ts +2 -1
  13. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  14. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  15. package/dist/ui/Badge/Badge.d.ts +12 -12
  16. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  17. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  18. package/dist/ui/Carousel/Carousel.d.ts +99 -99
  19. package/dist/ui/Carousel/carousel.recipe.d.ts +11 -11
  20. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  21. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  22. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  23. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  24. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  25. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  26. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  27. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  28. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  29. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  30. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  31. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  32. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  33. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  34. package/dist/ui/Field/Field.d.ts +21 -21
  35. package/dist/ui/Field/field.recipe.d.ts +3 -3
  36. package/dist/ui/Menu/Menu.d.ts +144 -144
  37. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  38. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  39. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  40. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  41. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  42. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  43. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  44. package/dist/ui/Popover/Popover.d.ts +55 -55
  45. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  46. package/dist/ui/Progress/Progress.d.ts +27 -27
  47. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  48. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  49. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  50. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  51. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  52. package/dist/ui/Select/Select.d.ts +45 -45
  53. package/dist/ui/Select/select.recipe.d.ts +3 -3
  54. package/dist/ui/Table/Table.d.ts +21 -21
  55. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  56. package/dist/ui/Table/table.recipe.d.ts +3 -3
  57. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  58. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  59. package/dist/utils/mutationKeys.d.ts +2 -1
  60. package/dist/utils/mutationKeys.js +44 -43
  61. package/package.json +1 -1
  62. package/dist/components/Banner/Banner.client.d.ts +0 -12
  63. package/dist/components/Banner/Banner.client.js +0 -49
  64. package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
  65. package/dist/components/DigitainLauncher/Loading.js +0 -5
  66. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +0 -184
  67. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +0 -184
  68. package/dist/components/KYC/BasicInformation.d.ts +0 -1
  69. package/dist/components/KYC/BasicInformation.js +0 -101
  70. package/dist/components/KYC/IdentityVerification.d.ts +0 -1
  71. package/dist/components/KYC/IdentityVerification.js +0 -120
  72. package/dist/components/KYC/Indicator.d.ts +0 -1
  73. package/dist/components/KYC/Indicator.js +0 -8
  74. package/dist/components/KYC/KYC.lazy.d.ts +0 -6
  75. package/dist/components/KYC/KYC.lazy.js +0 -45
  76. package/dist/components/KYC/KYCContext.d.ts +0 -6
  77. package/dist/components/KYC/KYCContext.js +0 -2
  78. package/dist/components/KYC/PersonalInformation.d.ts +0 -1
  79. package/dist/components/KYC/PersonalInformation.js +0 -122
  80. package/dist/components/KYC/useKYC.d.ts +0 -25
  81. package/dist/components/KYC/useKYC.js +0 -38
  82. package/dist/components/PortalProvider/LinkGoogleAccountObserver.d.ts +0 -1
  83. package/dist/components/PortalProvider/LinkGoogleAccountObserver.js +0 -29
  84. package/dist/components/SessionWatcher/SessionWatcher.d.ts +0 -1
  85. package/dist/components/SessionWatcher/SessionWatcher.js +0 -20
  86. package/dist/components/SessionWatcher/index.d.ts +0 -1
  87. package/dist/components/SessionWatcher/index.js +0 -1
  88. package/dist/components/SignIn/utils.d.ts +0 -8
  89. package/dist/components/SignIn/utils.js +0 -26
  90. package/dist/constants/Branches.d.ts +0 -2
  91. package/dist/constants/Branches.js +0 -42
  92. package/dist/images/responsible-gaming-yellow.png +0 -0
  93. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
  94. package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
  95. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  96. package/dist/third-parties/FacebookPixel/api.js +0 -1
  97. package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
  98. package/dist/third-parties/FacebookPixel/index.js +0 -1
  99. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
  100. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
  101. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  102. package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
  103. package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
  104. package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
  105. package/dist/third-parties/index.d.ts +0 -2
  106. package/dist/third-parties/index.js +0 -2
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from "type-fest";
2
+ import { type CreateGCashWithdrawalInput } from "../../services/wallet";
3
+ import type { Mutation } from "../../types";
4
+ export declare const useCreateGCashStandardCashInWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput, "id">>;
@@ -0,0 +1,28 @@
1
+ import { ObjectId } from "@opexa/object-id";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import invariant from "tiny-invariant";
4
+ import { ObjectType } from "../../services/ObjectType.js";
5
+ import { createGCashWithdrawal, } from "../../services/wallet.js";
6
+ import { getCreateGCashStandardCashInWithdrawalMutationKey } from "../../utils/mutationKeys.js";
7
+ import { getSession } from "../services/getSession.js";
8
+ export const useCreateGCashStandardCashInWithdrawalMutation = (config) => {
9
+ const mutation = useMutation({
10
+ ...config,
11
+ mutationKey: getCreateGCashStandardCashInWithdrawalMutationKey(),
12
+ mutationFn: async (input) => {
13
+ const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
14
+ const session = await getSession();
15
+ invariant(session.status === "authenticated");
16
+ await createGCashWithdrawal({ ...input, id }, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ ...(session.domain && {
20
+ Domain: session.domain,
21
+ }),
22
+ },
23
+ });
24
+ return id;
25
+ },
26
+ });
27
+ return mutation;
28
+ };
@@ -1,4 +1,4 @@
1
- import type { SetOptional } from 'type-fest';
2
- import { type CreateGCashWithdrawalInput } from '../../services/wallet';
3
- import type { Mutation } from '../../types';
4
- export declare const useCreateGCashWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput, 'id'>>;
1
+ import type { SetOptional } from "type-fest";
2
+ import { type CreateGCashWithdrawalInput } from "../../services/wallet";
3
+ import type { Mutation } from "../../types";
4
+ export declare const useCreateGCashWithdrawalMutation: Mutation<string, SetOptional<CreateGCashWithdrawalInput, "id">>;
@@ -1,10 +1,10 @@
1
- import { ObjectId } from '@opexa/object-id';
2
- import { useMutation } from '@tanstack/react-query';
3
- import invariant from 'tiny-invariant';
4
- import { ObjectType } from '../../services/ObjectType.js';
5
- import { createGCashWithdrawal, } from '../../services/wallet.js';
6
- import { getCreateGCashWithdrawalMutationKey } from '../../utils/mutationKeys.js';
7
- import { getSession } from '../services/getSession.js';
1
+ import { ObjectId } from "@opexa/object-id";
2
+ import { useMutation } from "@tanstack/react-query";
3
+ import invariant from "tiny-invariant";
4
+ import { ObjectType } from "../../services/ObjectType.js";
5
+ import { createGCashWithdrawal, } from "../../services/wallet.js";
6
+ import { getCreateGCashWithdrawalMutationKey } from "../../utils/mutationKeys.js";
7
+ import { getSession } from "../services/getSession.js";
8
8
  export const useCreateGCashWithdrawalMutation = (config) => {
9
9
  const mutation = useMutation({
10
10
  ...config,
@@ -12,7 +12,7 @@ export const useCreateGCashWithdrawalMutation = (config) => {
12
12
  mutationFn: async (input) => {
13
13
  const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
14
14
  const session = await getSession();
15
- invariant(session.status === 'authenticated');
15
+ invariant(session.status === "authenticated");
16
16
  await createGCashWithdrawal({ ...input, id }, {
17
17
  headers: {
18
18
  Authorization: `Bearer ${session.token}`,
@@ -1,54 +1,70 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { zodResolver } from '@hookform/resolvers/zod';
3
- import Link from 'next/link';
4
- import { useEffect, useState } from 'react';
5
- import { Controller, useForm } from 'react-hook-form';
6
- import { z } from 'zod';
7
- import { useShallow } from 'zustand/shallow';
8
- import { useCreateGCashWithdrawalMutation } from '../../../../client/hooks/useCreateGCashWithdrawalMutation.js';
9
- import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
10
- import { useLocaleInfo } from '../../../../client/hooks/useLocaleInfo.js';
11
- import { useMobileNumberParser } from '../../../../client/hooks/useMobileNumberParser.js';
12
- import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
13
- import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
14
- import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
15
- import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
16
- import { EyeIcon } from '../../../../icons/EyeIcon.js';
17
- import { EyeOffIcon } from '../../../../icons/EyeOffIcon.js';
18
- import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
19
- import { XIcon } from '../../../../icons/XIcon.js';
20
- import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
21
- import { Button } from '../../../../ui/Button/index.js';
22
- import { Field } from '../../../../ui/Field/index.js';
23
- import { NumberInput } from '../../../../ui/NumberInput/index.js';
24
- import { PasswordInput } from '../../../../ui/PasswordInput/index.js';
25
- import { Portal } from '../../../../ui/Portal/index.js';
26
- import { parseDecimal } from '../../../../utils/parseDecimal.js';
27
- import { AmountChoices } from '../../AmountChoices.js';
28
- import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
29
- import { explainError } from '../../utils.js';
30
- import { TransactionPasswordNotSet } from '../TransactionPasswordNotSet.js';
2
+ import { zodResolver } from "@hookform/resolvers/zod";
3
+ import Link from "next/link";
4
+ import { useEffect, useState } from "react";
5
+ import { Controller, useForm } from "react-hook-form";
6
+ import { z } from "zod";
7
+ import { useShallow } from "zustand/shallow";
8
+ import { useCreateGCashWithdrawalMutation } from "../../../../client/hooks/useCreateGCashWithdrawalMutation.js";
9
+ import { useCreateGCashStandardCashInWithdrawalMutation } from "../../../../client/hooks/useCreateGCashStandardCashInWithdrawal.js";
10
+ import { useGlobalStore } from "../../../../client/hooks/useGlobalStore.js";
11
+ import { useLocaleInfo } from "../../../../client/hooks/useLocaleInfo.js";
12
+ import { useMobileNumberParser } from "../../../../client/hooks/useMobileNumberParser.js";
13
+ import { usePaymentSettingsQuery } from "../../../../client/hooks/usePaymentSettingsQuery.js";
14
+ import { AlertCircleIcon } from "../../../../icons/AlertCircleIcon.js";
15
+ import { ChevronDownIcon } from "../../../../icons/ChevronDownIcon.js";
16
+ import { ChevronUpIcon } from "../../../../icons/ChevronUpIcon.js";
17
+ import { EyeIcon } from "../../../../icons/EyeIcon.js";
18
+ import { EyeOffIcon } from "../../../../icons/EyeOffIcon.js";
19
+ import { SpinnerIcon } from "../../../../icons/SpinnerIcon.js";
20
+ import { XIcon } from "../../../../icons/XIcon.js";
21
+ import { AlertDialog } from "../../../../ui/AlertDialog/index.js";
22
+ import { Button } from "../../../../ui/Button/index.js";
23
+ import { Field } from "../../../../ui/Field/index.js";
24
+ import { NumberInput } from "../../../../ui/NumberInput/index.js";
25
+ import { PasswordInput } from "../../../../ui/PasswordInput/index.js";
26
+ import { Portal } from "../../../../ui/Portal/index.js";
27
+ import { parseDecimal } from "../../../../utils/parseDecimal.js";
28
+ import { AmountChoices } from "../../AmountChoices.js";
29
+ import { useDepositWithdrawalPropsContext } from "../../DepositWithdrawalContext.js";
30
+ import { explainError } from "../../utils.js";
31
+ import { TransactionPasswordNotSet } from "../TransactionPasswordNotSet.js";
32
+ import { useFeatureFlag } from "../../../../client/hooks/useFeatureFlag.js";
31
33
  export function GCashWithdrawal() {
32
34
  const depositWithdrawalProps = useDepositWithdrawalPropsContext();
35
+ const featureFlag = useFeatureFlag();
33
36
  const globalStore = useGlobalStore(useShallow((ctx) => ({
34
37
  depositWithdrawal: ctx.depositWithdrawal,
35
38
  hasPendingBonus: ctx.pendingBonus,
36
39
  })));
37
- const [status, setStatus] = useState('waiting');
40
+ const [status, setStatus] = useState("waiting");
38
41
  const localeInfo = useLocaleInfo();
39
42
  const mobileNumberParser = useMobileNumberParser();
40
- const createWithdrawalMutation = useCreateGCashWithdrawalMutation({
41
- onMutate() {
42
- setStatus('processing');
43
- },
44
- onSuccess() {
45
- setStatus('success');
46
- form.reset();
47
- },
48
- onError() {
49
- setStatus('failed');
50
- },
51
- });
43
+ const createWithdrawalMutation = featureFlag.enabled
44
+ ? useCreateGCashStandardCashInWithdrawalMutation({
45
+ onMutate() {
46
+ setStatus("processing");
47
+ },
48
+ onSuccess() {
49
+ setStatus("success");
50
+ form.reset();
51
+ },
52
+ onError() {
53
+ setStatus("failed");
54
+ },
55
+ })
56
+ : useCreateGCashWithdrawalMutation({
57
+ onMutate() {
58
+ setStatus("processing");
59
+ },
60
+ onSuccess() {
61
+ setStatus("success");
62
+ form.reset();
63
+ },
64
+ onError() {
65
+ setStatus("failed");
66
+ },
67
+ });
52
68
  const paymentSettingsQuery = usePaymentSettingsQuery();
53
69
  const paymentSettings = paymentSettingsQuery.data;
54
70
  const gatewaySettings = paymentSettings?.gcashWithdrawalGatewaySettings;
@@ -59,7 +75,7 @@ export function GCashWithdrawal() {
59
75
  const n = parseDecimal(val, 0);
60
76
  if (n < minimumAmount) {
61
77
  ctx.addIssue({
62
- type: 'number',
78
+ type: "number",
63
79
  code: z.ZodIssueCode.too_small,
64
80
  inclusive: true,
65
81
  minimum: minimumAmount,
@@ -68,7 +84,7 @@ export function GCashWithdrawal() {
68
84
  }
69
85
  if (n > maximumAmount) {
70
86
  ctx.addIssue({
71
- type: 'number',
87
+ type: "number",
72
88
  code: z.ZodIssueCode.too_big,
73
89
  inclusive: true,
74
90
  maximum: maximumAmount,
@@ -78,27 +94,27 @@ export function GCashWithdrawal() {
78
94
  }),
79
95
  password: z
80
96
  .string()
81
- .min(8, 'Password must be 8 or more characters')
82
- .max(64, 'Password must be not be more than 64 characters'),
97
+ .min(8, "Password must be 8 or more characters")
98
+ .max(64, "Password must be not be more than 64 characters"),
83
99
  mobileNumber: z
84
100
  .string()
85
- .regex(localeInfo.mobileNumber.pattern, 'Invalid mobile number'),
101
+ .regex(localeInfo.mobileNumber.pattern, "Invalid mobile number"),
86
102
  });
87
103
  const form = useForm({
88
- mode: 'all',
104
+ mode: "all",
89
105
  resolver: zodResolver(definition),
90
106
  defaultValues: {
91
- amount: '0',
92
- password: '',
93
- mobileNumber: '',
107
+ amount: "0",
108
+ password: "",
109
+ mobileNumber: "",
94
110
  },
95
111
  });
96
112
  useEffect(() => {
97
113
  if (minimumAmount) {
98
114
  form.reset({
99
115
  amount: minimumAmount.toString(),
100
- password: '',
101
- mobileNumber: '',
116
+ password: "",
117
+ mobileNumber: "",
102
118
  });
103
119
  }
104
120
  }, [form, minimumAmount]);
@@ -113,25 +129,25 @@ export function GCashWithdrawal() {
113
129
  transactionPassword: data.password,
114
130
  });
115
131
  });
116
- return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", ...form.register('mobileNumber') })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
132
+ return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.mobileNumber, children: [_jsx(Field.Label, { children: "Mobile Number" }), _jsxs("div", { className: "relative", children: [_jsx(localeInfo.country.flag, { className: "-translate-y-1/2 pointer-events-none absolute top-1/2 left-3.5 size-5" }), _jsx(Field.Input, { className: "pl-10.5", ...form.register("mobileNumber") })] }), _jsx(Field.ErrorText, { children: form.formState.errors.mobileNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
117
133
  o.field.onChange(details.value);
118
134
  }, formatOptions: {
119
135
  maximumFractionDigits: 2,
120
136
  minimumFractionDigits: 0,
121
- }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
122
- form.setValue('amount', value.toString(), {
137
+ }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch("amount"), 0), onChange: (value) => {
138
+ form.setValue("amount", value.toString(), {
123
139
  shouldTouch: true,
124
140
  shouldDirty: true,
125
141
  shouldValidate: true,
126
142
  });
127
- }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsx(TransactionPasswordNotSet, {}), _jsx(Button, { type: "submit", className: "mt-6", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["Upon withdrawing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
143
+ }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Transaction Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { placeholder: "Enter password", ...form.register("password") }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsx(TransactionPasswordNotSet, {}), _jsx(Button, { type: "submit", className: "mt-6", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 text-xs", children: ["Upon withdrawing, you agree to our", " ", _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? "/terms-of-use", onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), " ", "and", " ", _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? "/privacy-policy", onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: status !== "waiting", onOpenChange: (details) => {
128
144
  if (!details.open) {
129
- setStatus('waiting');
145
+ setStatus("waiting");
130
146
  }
131
- }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
132
- "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
133
- 'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
134
- explainError(createWithdrawalMutation.error?.name)] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
147
+ }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === "processing", children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === "processing" && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === "success" && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === "failed" && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === "processing" && "Processing Withdraw", status === "success" && "Withdrawal Submitted", status === "failed" && "Withdraw Failed"] }), _jsxs(AlertDialog.Description, { children: [status === "processing" &&
148
+ "We're verifying your account and amount. Please hold a moment.", status === "success" &&
149
+ "Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.", status === "failed" &&
150
+ explainError(createWithdrawalMutation.error?.name)] })] }), (status === "failed" || status === "success") && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
135
151
  api.setOpen(false);
136
- }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
152
+ }, children: status === "failed" ? "Try Again" : "Ok" })) }) }))] }) })] }) })] }));
137
153
  }
@@ -20,9 +20,17 @@ import { formatNumber } from '../../utils/formatNumber.js';
20
20
  import { getPercentage } from '../../utils/getPercentage.js';
21
21
  import { useQuestContext } from './QuestsContext.js';
22
22
  import { RemainingTime } from './RemainingTime.js';
23
+ import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
24
+ import { FacebookSignInTrigger } from '../SignIn/FacebookSignInTrigger.js';
25
+ import dynamic from 'next/dynamic';
26
+ const GoogleSignInButton = dynamic(() => import('../SignIn/GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
27
+ ssr: false,
28
+ loading: () => null,
29
+ });
23
30
  export function JourneyQuest() {
24
31
  const disclosure = useDisclosure();
25
32
  const quest = useQuestContext();
33
+ const featureFlag = useFeatureFlag();
26
34
  const { milestones, totalMilestones, currentMilestone, progressPercentage } = useMemo(() => {
27
35
  if (!quest?.milestones) {
28
36
  return {
@@ -32,7 +40,13 @@ export function JourneyQuest() {
32
40
  progressPercentage: 0,
33
41
  };
34
42
  }
35
- const transformedMilestones = quest.milestones.map((milestone) => ({
43
+ const filteredMilestones = quest.milestones.filter((milestone) => {
44
+ if (!featureFlag.enabled) {
45
+ return milestone.type !== 'LINK_FACEBOOK_ACCOUNT' && milestone.type !== 'LINK_GOOGLE_ACCOUNT';
46
+ }
47
+ return true;
48
+ });
49
+ const transformedMilestones = filteredMilestones.map((milestone) => ({
36
50
  key: milestone.type,
37
51
  label: milestone.name,
38
52
  bonus: milestone.bonusAmount
@@ -42,8 +56,8 @@ export function JourneyQuest() {
42
56
  id: milestone.id,
43
57
  description: milestone.description,
44
58
  }));
45
- const completedCount = quest.milestones.filter((m) => m.cleared).length;
46
- const total = quest.milestones.length;
59
+ const completedCount = filteredMilestones.filter((m) => m.cleared).length;
60
+ const total = filteredMilestones.length;
47
61
  return {
48
62
  milestones: transformedMilestones,
49
63
  totalMilestones: total,
@@ -85,7 +99,7 @@ function Rules(props) {
85
99
  return false;
86
100
  return milestones.every((milestone) => milestone.isCompleted);
87
101
  }, [milestones]);
88
- 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 min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-5", 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' }), _jsx("p", { children: quest?.description ||
102
+ 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 min-w-[21.438rem] max-w-[400px] overflow-y-auto rounded-xl px-4 py-5 mt-40", 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' }), _jsx("p", { children: quest?.description ||
89
103
  'Ready for a challenge? Complete them all and get amazing rewards!' }), milestones.map((milestone) => (_jsxs("div", { className: "flex flex-col space-y-2.5 rounded-xl bg-bg-tertiary p-3", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("p", { className: "font-medium text-base text-white", children: milestone.label }), milestone.isCompleted && (_jsx("div", { className: "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", children: "Complete" }))] }), milestone.description ? (_jsx(Prose, { dangerouslySetInnerHTML: {
90
104
  __html: milestone.description,
91
105
  } })) : milestone.bonus ? (_jsxs("p", { className: "ml-1", children: [milestone.key === 'REGISTRATION' &&
@@ -107,7 +121,9 @@ function Rules(props) {
107
121
  }
108
122
  }, "aria-label": `Complete ${milestone.label}`, children: [milestone.key === 'ACCOUNT_VERIFICATION' ? (_jsx(FileCheck02Icon, { className: "size-5" })) : (_jsx(CoinsHandIcon, { className: "size-5" })), milestone.key === 'FIRST_DEPOSIT'
109
123
  ? 'Deposit'
110
- : '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: "w-full rounded-md border border-bg-primary-hover bg-button-secondary-bg 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!"] }) })) }))] })] }) })] }) }));
124
+ : 'Verify Account'] })), !milestone.isCompleted &&
125
+ milestone.key === 'LINK_FACEBOOK_ACCOUNT' && (_jsx(FacebookSignInTrigger, { text: 'Link Facebook Account', className: 'items-center justify-center rounded-md font-semibold shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none h-10 gap-md px-3 text-sm flex w-full bg-button-primary-bg text-button-primary-fg' })), !milestone.isCompleted &&
126
+ milestone.key === 'LINK_GOOGLE_ACCOUNT' && (_jsx(GoogleSignInButton, { text: 'Link Google Account', className: 'items-center justify-center rounded-md font-semibold shadow-xs disabled:opacity-60 disabled:shadow-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60 aria-disabled:shadow-none h-10 gap-md px-3 text-sm flex w-full bg-button-primary-bg text-button-primary-fg' }))] }, 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: "w-full rounded-md border border-bg-primary-hover bg-button-secondary-bg 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!"] }) })) }))] })] }) })] }) }));
111
127
  }
112
128
  function QuestMilestone({ label, bonus, isCompleted = false, }) {
113
129
  const localeInfo = useLocaleInfo();
@@ -1 +1,6 @@
1
- export declare const FacebookSignInTrigger: () => import("react/jsx-runtime").JSX.Element | null;
1
+ interface FacebookSignInTriggerProps {
2
+ text?: string;
3
+ className?: string;
4
+ }
5
+ export declare const FacebookSignInTrigger: (props: FacebookSignInTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -9,7 +9,7 @@ import { AUTH_ENDPOINT, PLATFORM_CODE } from '../../constants/index.js';
9
9
  import { FacebookIcon } from '../../icons/FacebookIcon.js';
10
10
  import { httpRequest } from '../../services/httpRequest.js';
11
11
  import { Button } from '../../ui/Button/index.js';
12
- export const FacebookSignInTrigger = () => {
12
+ export const FacebookSignInTrigger = (props) => {
13
13
  const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
14
14
  const signIn = useSignInMutation({
15
15
  onError: () => {
@@ -46,6 +46,6 @@ export const FacebookSignInTrigger = () => {
46
46
  description: 'Failed to sign in with Facebook. Please try again.',
47
47
  });
48
48
  }, render: ({ onClick }) => {
49
- return (_jsxs(Button, { variant: "outline", onClick: onClick, colorScheme: "gray", className: "mt-lg border-border-primary bg-bg-primary text-text-secondary-700", children: [_jsx(FacebookIcon, { className: "size-6" }), "Continue with Facebook"] }));
49
+ return (_jsxs(Button, { variant: "outline", onClick: onClick, colorScheme: "gray", className: `mt-lg border-border-primary bg-bg-primary text-text-secondary-700 ${props.className}`, children: [_jsx(FacebookIcon, { className: "size-6" }), props.text ?? 'Continue with Facebook'] }));
50
50
  } }));
51
51
  };
@@ -1,5 +1,7 @@
1
1
  import type { ComponentPropsWithRef } from 'react';
2
2
  export interface GoogleSignInTriggerProps extends ComponentPropsWithRef<'button'> {
3
3
  asChild?: boolean;
4
+ text?: string;
5
+ className?: string;
4
6
  }
5
7
  export declare const GoogleSignInTrigger: (props: GoogleSignInTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -18,7 +18,7 @@ export const GoogleSignInTrigger = (props) => {
18
18
  return null;
19
19
  return (_jsx(GoogleOAuthProvider, { clientId: googleClientId, children: _jsx(Trigger, { ...props }) }));
20
20
  };
21
- const Trigger = ({ children, disabled, asChild, onClick, ...props }) => {
21
+ const Trigger = ({ children, disabled, asChild, onClick, text, className, ...props }) => {
22
22
  const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
23
23
  const signIn = useSignInMutation({
24
24
  onError: () => {
@@ -56,5 +56,5 @@ const Trigger = ({ children, disabled, asChild, onClick, ...props }) => {
56
56
  return (_jsx(ark.button, { type: "button", onClick: (e) => {
57
57
  onClick?.(e);
58
58
  signInGoogle();
59
- }, asChild: !children ? true : asChild, disabled: signIn.isPending || disabled, ...props, children: children ?? (_jsxs(Button, { variant: "outline", colorScheme: "gray", className: "bg-bg-primary", children: [_jsx(GoogleIcon, { className: "size-6" }), "Continue with Google"] })) }));
59
+ }, asChild: !children ? true : asChild, disabled: signIn.isPending || disabled, ...props, children: children ?? (_jsxs(Button, { variant: "outline", colorScheme: "gray", className: `bg-bg-primary ${className}`, children: [_jsx(GoogleIcon, { className: "size-6" }), text ?? 'Continue with Google'] })) }));
60
60
  };
@@ -1,5 +1,5 @@
1
1
  export declare const SITE_ID: string;
2
2
  export declare const PLATFORM_ID: string;
3
3
  export declare const PLATFORM_CODE: string;
4
- export declare const ENVIRONMENT: "development" | "production";
4
+ export declare const ENVIRONMENT: "production" | "development";
5
5
  export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
@@ -703,7 +703,7 @@ export interface QuestProgram {
703
703
  description: string;
704
704
  }
705
705
  export type MemberStatus = 'ACTIVE' | 'BLACKLISTED' | 'SUSPENDED';
706
- export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'CUSTOM';
706
+ export type JourneyQuestMilestoneType = 'REGISTRATION' | 'ACCOUNT_VERIFICATION' | 'FIRST_DEPOSIT' | 'IOS_FIRST_LOGIN' | 'ANDROID_FIRST_LOGIN' | 'LINK_FACEBOOK_ACCOUNT' | 'LINK_GOOGLE_ACCOUNT' | 'CUSTOM';
707
707
  export interface JourneyQuestMilestone {
708
708
  id: string;
709
709
  type: JourneyQuestMilestoneType;
@@ -735,6 +735,7 @@ export interface Quest {
735
735
  bonusAmount?: string;
736
736
  firstDepositCompleted?: boolean;
737
737
  accountVerificationCompleted?: boolean;
738
+ milestones?: JourneyQuestMilestone[];
738
739
  }
739
740
  interface TopWinGame {
740
741
  id: string;