@opexa/portal-components 0.0.359 → 0.0.361

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 (55) hide show
  1. package/dist/client/hooks/useFacebookClientQuery.d.ts +2 -0
  2. package/dist/client/hooks/useFacebookClientQuery.js +13 -0
  3. package/dist/client/hooks/useUnlinkFacebookMutation.d.ts +2 -0
  4. package/dist/client/hooks/useUnlinkFacebookMutation.js +31 -0
  5. package/dist/components/AccountInfo/AccountInfo.js +53 -2
  6. package/dist/components/AccountSecurity/AccountSecurity.js +2 -2
  7. package/dist/components/DepositWithdrawal/DepositWithdrawal.lazy.js +8 -3
  8. package/dist/components/SignIn/FacebookSignInTrigger.d.ts +1 -0
  9. package/dist/components/SignIn/FacebookSignInTrigger.js +51 -0
  10. package/dist/components/SignIn/MobileNumberSignIn.js +2 -1
  11. package/dist/components/SignIn/SignIn.lazy.d.ts +1 -0
  12. package/dist/services/account.d.ts +14 -0
  13. package/dist/services/account.js +8 -1
  14. package/dist/services/queries.d.ts +3 -1
  15. package/dist/services/queries.js +11 -0
  16. package/dist/types/index.d.ts +1 -0
  17. package/dist/ui/AlertDialog/AlertDialog.d.ts +88 -88
  18. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +8 -8
  19. package/dist/ui/Badge/Badge.d.ts +12 -12
  20. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  21. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  22. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  23. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  24. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  25. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  26. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  27. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  28. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  29. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  30. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  31. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  32. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  33. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  34. package/dist/ui/Dialog/Dialog.d.ts +88 -88
  35. package/dist/ui/Dialog/dialog.recipe.d.ts +8 -8
  36. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  37. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  38. package/dist/ui/Menu/Menu.d.ts +252 -252
  39. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  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/Popover/Popover.d.ts +55 -55
  43. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  44. package/dist/ui/Select/Select.d.ts +45 -45
  45. package/dist/ui/Select/select.recipe.d.ts +3 -3
  46. package/dist/ui/Table/Table.d.ts +21 -21
  47. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  48. package/dist/ui/Table/table.recipe.d.ts +3 -3
  49. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  50. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  51. package/dist/utils/mutationKeys.d.ts +1 -0
  52. package/dist/utils/mutationKeys.js +4 -0
  53. package/dist/utils/queryKeys.d.ts +1 -0
  54. package/dist/utils/queryKeys.js +1 -0
  55. package/package.json +2 -1
@@ -0,0 +1,2 @@
1
+ import type { Query } from '../../types';
2
+ export declare const useFacebookClientQuery: Query<string | null>;
@@ -0,0 +1,13 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { getFacebookClientId } from '../../services/account.js';
3
+ import { getFacebookClientIdQueryKey } from '../../utils/queryKeys.js';
4
+ export const useFacebookClientQuery = (options) => {
5
+ const query = useQuery({
6
+ ...options,
7
+ queryKey: getFacebookClientIdQueryKey(),
8
+ queryFn: async ({ signal }) => {
9
+ return await getFacebookClientId({ signal });
10
+ },
11
+ });
12
+ return query;
13
+ };
@@ -0,0 +1,2 @@
1
+ import type { Mutation } from '../../types';
2
+ export declare const useUnlinkFacebookMutation: Mutation<void, string>;
@@ -0,0 +1,31 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import invariant from 'tiny-invariant';
3
+ import { unlinkFacebook } from '../../services/account.js';
4
+ import { getQueryClient } from '../../utils/getQueryClient.js';
5
+ import { getUnlinkFacebookMutationKey } from '../../utils/mutationKeys.js';
6
+ import { getAccountQueryKey } from '../../utils/queryKeys.js';
7
+ import { getSession } from '../services/getSession.js';
8
+ export const useUnlinkFacebookMutation = (config) => {
9
+ const queryClient = getQueryClient();
10
+ return useMutation({
11
+ ...config,
12
+ mutationKey: getUnlinkFacebookMutationKey(),
13
+ mutationFn: async (id) => {
14
+ const session = await getSession();
15
+ invariant(session.status === 'authenticated');
16
+ await unlinkFacebook(id, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ },
20
+ });
21
+ queryClient.setQueryData(getAccountQueryKey(), (prev) => {
22
+ if (!prev)
23
+ return prev;
24
+ return {
25
+ ...prev,
26
+ facebookId: null,
27
+ };
28
+ });
29
+ },
30
+ });
31
+ };
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import FacebookLogin from '@greatsumini/react-facebook-login';
3
4
  import { zodResolver } from '@hookform/resolvers/zod';
4
5
  import { GoogleOAuthProvider, useGoogleLogin } from '@react-oauth/google';
5
6
  import { differenceInYears, format } from 'date-fns';
@@ -10,10 +11,12 @@ import { twMerge } from 'tailwind-merge';
10
11
  import { z } from 'zod';
11
12
  import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
12
13
  import { useDisclosure } from '../../client/hooks/useDisclosure.js';
14
+ import { useFacebookClientQuery } from '../../client/hooks/useFacebookClientQuery.js';
13
15
  import { useGoogleClientIdQuery } from '../../client/hooks/useGoogleClientIdQuery.js';
14
16
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
15
17
  import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
16
18
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
19
+ import { useUnlinkFacebookMutation } from '../../client/hooks/useUnlinkFacebookMutation.js';
17
20
  import { useUnlinkGoogleMutation } from '../../client/hooks/useUnlinkGoogleMutation.js';
18
21
  import { useUpdateAccountMutation } from '../../client/hooks/useUpdateAccountMutation.js';
19
22
  import { toaster } from '../../client/utils/toaster.js';
@@ -159,7 +162,55 @@ function SSO({ google, facebook }) {
159
162
  const googleClientId = googleClientIdQuery.data;
160
163
  if (!facebook && !google)
161
164
  return null;
162
- return (_jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Account Connections" }), _jsxs("div", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt px-4 py-5 shadow-xs", children: [googleClientId && (_jsx(GoogleOAuthProvider, { clientId: googleClientId, children: _jsx(LinkGoogleAccount, {}) })), facebook /* FIXME: replace with facebookClientId or something */ && (_jsxs("div", { className: "mt-6 flex items-center", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(FacebookIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "font-medium text-sm leading-tight", children: "Facebook" }), _jsx("p", { className: "mt-xs text-text-success-primary-600 text-xs leading-tight", children: "Connected" })] })] }), _jsx("button", { type: "button", className: "font-semibold text-button-tertiary-error-fg text-sm", children: "Disconnect" })] }))] })] }));
165
+ return (_jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Account Connections" }), _jsxs("div", { className: "mt-5 flex flex-col gap-2 rounded-xl border border-border-secondary bg-bg-primary-alt px-4 py-5 shadow-xs", children: [googleClientId && google && (_jsx(GoogleOAuthProvider, { clientId: googleClientId, children: _jsx(LinkGoogleAccount, {}) })), facebook && _jsx(LinkFacebookAccount, {})] })] }));
166
+ }
167
+ const LinkFacebookAccount = () => {
168
+ const accountQuery = useAccountQuery();
169
+ const account = accountQuery.data;
170
+ const sessionQuery = useSessionQuery();
171
+ const session = sessionQuery.data;
172
+ const facebookClientIdQuery = useFacebookClientQuery();
173
+ const facebookClientId = facebookClientIdQuery.data;
174
+ if (!account || !facebookClientId)
175
+ return null;
176
+ return (_jsxs("div", { className: "flex items-center gap-sm", children: [_jsxs("div", { className: "flex grow items-center gap-sm", children: [_jsx(IconButton, { variant: "outline", colorScheme: "gray", children: _jsx(FacebookIcon, { className: "size-6" }) }), _jsxs("div", { children: [_jsx("p", { className: "font-medium text-sm leading-tight", children: "Facebook" }), _jsx("p", { className: twMerge('mt-xs text-xs leading-tight', account.facebookId
177
+ ? 'text-text-success-primary-600'
178
+ : 'text-text-secondary-700'), children: account.facebookId ? 'Connected' : 'Not Connected' })] })] }), account.facebookId ? (_jsx(UnlinkFacebookAccount, {})) : (_jsx(FacebookLogin, { appId: facebookClientId, useRedirect: true, dialogParams: {
179
+ state: encodeURIComponent(`${window.location.origin},${PLATFORM_CODE},${session?.token}`),
180
+ redirect_uri: `${AUTH_ENDPOINT}/facebook/link`,
181
+ }, onFail: () => {
182
+ toaster.error({
183
+ title: 'Facebook Sign In Failed',
184
+ description: 'Failed to sign in with Facebook. Please try again.',
185
+ });
186
+ }, render: ({ onClick }) => {
187
+ return (_jsx(Button, { onClick: onClick, fullWidth: false, children: "Connect" }));
188
+ } }))] }));
189
+ };
190
+ function UnlinkFacebookAccount() {
191
+ const accountQuery = useAccountQuery();
192
+ const account = accountQuery.data;
193
+ const disclosure = useDisclosure();
194
+ const unlinkFacebookMutation = useUnlinkFacebookMutation({
195
+ onSuccess() {
196
+ toaster.success({
197
+ title: 'Successfully Disconnected Facebook Account',
198
+ description: 'Your Facebook account has been disconnected. You can reconnect anytime from your account settings.',
199
+ });
200
+ disclosure.setOpen(false);
201
+ },
202
+ onError() {
203
+ toaster.error({
204
+ title: 'Error',
205
+ description: 'An error occurred while disconnecting your Facebook account. Please try again later.',
206
+ });
207
+ },
208
+ });
209
+ if (!account)
210
+ return null;
211
+ return (_jsxs(Dialog.Root, { open: disclosure.open, onOpenChange: (details) => disclosure.setOpen(details.open), lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { className: "font-semibold text-button-tertiary-error-fg text-sm", children: "Disconnect" }), _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-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBroken02Icon, {}) }), _jsx(Dialog.Title, { className: "mt-4 mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Facebook Account" }), _jsx(Dialog.Description, { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Facebook account? This may affect your ability to log in or sync data." })] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex justify-between gap-2 pt-6", children: [_jsx(Button, { variant: "outline", disabled: unlinkFacebookMutation.isPending, onClick: () => api.setOpen(false), children: "Cancel" }), _jsx(Button, { variant: "solid", disabled: unlinkFacebookMutation.isPending, onClick: () => {
212
+ unlinkFacebookMutation.mutate(account.id);
213
+ }, children: "Disconnect" })] })) })] }) })] })] }));
163
214
  }
164
215
  const LinkGoogleAccount = () => {
165
216
  const accountQuery = useAccountQuery();
@@ -200,7 +251,7 @@ function UnlinkGoogleAccount() {
200
251
  });
201
252
  if (!account)
202
253
  return null;
203
- return (_jsxs(Dialog.Root, { open: disclosure.open, onOpenChange: (details) => disclosure.setOpen(details.open), lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { className: "font-semibold text-button-tertiary-error-fg text-sm", children: "Disconnect" }), _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-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBroken02Icon, {}) }), _jsx(Dialog.Title, { className: "mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx(Dialog.Description, { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex justify-between gap-2 pt-6", children: [_jsx(Button, { variant: "outline", disabled: unlinkGoogleMutation.isPending, onClick: () => api.setOpen(false), children: "Cancel" }), _jsx(Button, { variant: "solid", disabled: unlinkGoogleMutation.isPending, onClick: () => {
254
+ return (_jsxs(Dialog.Root, { open: disclosure.open, onOpenChange: (details) => disclosure.setOpen(details.open), lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: [_jsx(Dialog.Trigger, { className: "font-semibold text-button-tertiary-error-fg text-sm", children: "Disconnect" }), _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-[25rem] overflow-y-auto rounded-xl p-6", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs("div", { className: "flex flex-col ", children: [_jsx("div", { className: "mx-auto flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-brand", children: _jsx(LinkBroken02Icon, {}) }), _jsx(Dialog.Title, { className: "mt-4 mb-1 text-center font-semibold text-lg xl:mt-xl", children: "Disconnect Google Account" }), _jsx(Dialog.Description, { className: "text-center text-sm text-text-tertiary-600 leading-2xl", children: "Are you sure you want to disconnect your Google account? This may affect your ability to log in or sync data." })] }), _jsx(Dialog.Context, { children: (api) => (_jsxs("div", { className: "flex justify-between gap-2 pt-6", children: [_jsx(Button, { variant: "outline", disabled: unlinkGoogleMutation.isPending, onClick: () => api.setOpen(false), children: "Cancel" }), _jsx(Button, { variant: "solid", disabled: unlinkGoogleMutation.isPending, onClick: () => {
204
255
  unlinkGoogleMutation.mutate(account.id);
205
256
  }, children: "Disconnect" })] })) })] }) })] })] }));
206
257
  }
@@ -144,9 +144,9 @@ function TransactionPassword() {
144
144
  confirmPassword: '',
145
145
  },
146
146
  });
147
- return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Transaction password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The transaction password secures and confirms your wallet withdrawals." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.accountPassword
147
+ return (_jsxs("div", { children: [_jsxs("div", { className: "flex items-start gap-8", children: [_jsxs("div", { className: "grow", children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Transaction password" }), _jsx("p", { className: "text-sm text-text-tertiary-600", children: "The transaction password secures and confirms your wallet withdrawals." })] }), _jsx(ark.svg, { asChild: true, className: twMerge('size-6', profileCompletion?.transactionPassword
148
148
  ? 'text-text-success-primary'
149
- : 'text-text-warning-primary'), children: profileCompletion?.accountPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
149
+ : 'text-text-warning-primary'), children: profileCompletion?.transactionPassword ? (_jsx(CheckVerified02Icon, {})) : (_jsx(AlertCircleIcon, {})) })] }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
150
150
  updateAccountMutation.mutate({
151
151
  transactionPassword: data.password ? data.password : undefined,
152
152
  });
@@ -31,12 +31,17 @@ export function DepositWithdrawal(props) {
31
31
  const walletQuery = useWalletQuery({
32
32
  refetchInterval: 5000,
33
33
  });
34
- //check if the user has pending/ongoing bonuses
34
+ // biome-ignore lint/correctness/useExhaustiveDependencies: globalStore is stable and doesn't need to be in dependencies
35
35
  useEffect(() => {
36
- if (hasPendingBonus && !globalStore.pendingBonus.shouldShowWarning) {
36
+ if (hasPendingBonus) {
37
37
  globalStore.pendingBonus.setShouldShowWarning(hasPendingBonus);
38
38
  }
39
- }, [hasPendingBonus, globalStore.pendingBonus]);
39
+ return () => {
40
+ if (!hasPendingBonus) {
41
+ globalStore.pendingBonus.setShouldShowWarning(false);
42
+ }
43
+ };
44
+ }, [hasPendingBonus]);
40
45
  return (_jsxs(_Fragment, { children: [_jsx(DepositWithdrawalPropsProvider, { value: props, children: _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, open: globalStore.depositWithdrawal.open, onOpenChange: (details) => {
41
46
  globalStore.depositWithdrawal.setOpen(details.open);
42
47
  if (!details.open) {
@@ -0,0 +1 @@
1
+ export declare const FacebookSignInTrigger: () => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import FacebookLogin from '@greatsumini/react-facebook-login';
3
+ import { useShallow } from 'zustand/shallow';
4
+ import { useFacebookClientQuery } from '../../client/hooks/useFacebookClientQuery.js';
5
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
6
+ import { useSignInMutation } from '../../client/hooks/useSignInMutation.js';
7
+ import { toaster } from '../../client/utils/toaster.js';
8
+ import { AUTH_ENDPOINT, PLATFORM_CODE } from '../../constants/index.js';
9
+ import { FacebookIcon } from '../../icons/FacebookIcon.js';
10
+ import { httpRequest } from '../../services/httpRequest.js';
11
+ import { Button } from '../../ui/Button/index.js';
12
+ export const FacebookSignInTrigger = () => {
13
+ const signInStore = useGlobalStore(useShallow((ctx) => ctx.signIn));
14
+ const signIn = useSignInMutation({
15
+ onError: () => {
16
+ toaster.error({
17
+ title: 'Account Not Found',
18
+ description: 'Account not found. Please try again or contact support.',
19
+ });
20
+ },
21
+ onSuccess: () => {
22
+ signInStore.setOpen(false);
23
+ },
24
+ });
25
+ const facebookClientIdQuery = useFacebookClientQuery();
26
+ const facebookClientId = facebookClientIdQuery.data;
27
+ if (!facebookClientId)
28
+ return null;
29
+ return (_jsx(FacebookLogin, { appId: facebookClientId, onSuccess: async (res) => {
30
+ try {
31
+ const { token } = await httpRequest.json(`${AUTH_ENDPOINT}/facebook/auth?state=${encodeURIComponent(`${window.location.origin},${PLATFORM_CODE}`)}&code=${res.accessToken}`);
32
+ signIn.mutate({
33
+ type: 'SOCIALS',
34
+ token,
35
+ });
36
+ }
37
+ catch {
38
+ toaster.error({
39
+ title: 'Account Not Found',
40
+ description: 'The Facebook account you used isn’t connected to any existing account in our system. Please connect it to continue.',
41
+ });
42
+ }
43
+ }, onFail: () => {
44
+ toaster.error({
45
+ title: 'Facebook Sign In Failed',
46
+ description: 'Failed to sign in with Facebook. Please try again.',
47
+ });
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"] }));
50
+ } }));
51
+ };
@@ -22,6 +22,7 @@ import { Button } from '../../ui/Button/index.js';
22
22
  import { Checkbox } from '../../ui/Checkbox/index.js';
23
23
  import { Field } from '../../ui/Field/index.js';
24
24
  import { PinInput } from '../../ui/PinInput/index.js';
25
+ import { FacebookSignInTrigger } from './FacebookSignInTrigger.js';
25
26
  import { useSignInContext, useSignInPropsContext } from './SignInContext.js';
26
27
  const GoogleSignInButton = dynamic(() => import('./GoogleSignInTrigger.js').then((m) => m.GoogleSignInTrigger), {
27
28
  ssr: false,
@@ -153,7 +154,7 @@ export function MobileNumberSignIn() {
153
154
  globalStore.responsibleGaming.setNext('SIGN_IN');
154
155
  globalStore.signIn.setOpen(false);
155
156
  }
156
- }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: "mt-3xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2", children: [_jsx("div", { className: "flex size-5xl items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), _jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] }), _jsx("div", { className: "mt-6", children: signInProps.googleSso && _jsx(GoogleSignInButton, {}) }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Don't have an account?" }), _jsx("button", { type: "submit", className: "font-semibold text-button-tertiary-fg", onClick: () => {
157
+ }, children: "Responsible Gaming" }), ' ', "guidelines."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsx(Field.ErrorText, { className: "ml-6 text-xs", children: o.fieldState.error?.message })] })) })] }), signInProps.showPublicPlayProhibition && (_jsxs("div", { className: "mt-3xl text-center text-sm", children: ["Prohibition to play in open and public places", _jsxs("div", { className: "mx-auto mt-5 flex h-13 w-fit items-center justify-center gap-3xl rounded-[60px] bg-[#1D0201] px-5 py-2", children: [_jsx("div", { className: "flex size-5xl items-center justify-center overflow-hidden rounded-full bg-white", children: _jsx(Image, { src: pagcorLogo, alt: "", draggable: false, height: 62, width: 186, className: "h-9.5 w-auto object-contain" }) }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-10 w-auto", draggable: false })] })] })), _jsxs("div", { className: "mt-6 flex items-center gap-2", children: [_jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" }), _jsx("span", { className: "font-semibold text-sm text-text-tertiary-600", children: "Log in directly with" }), _jsx("div", { className: "h-px flex-grow bg-text-tertiary-600/50" })] }), _jsxs("div", { className: "mt-6", children: [signInProps.googleSso && _jsx(GoogleSignInButton, {}), signInProps.facebookSso && _jsx(FacebookSignInTrigger, {})] }), _jsxs("div", { className: "mt-6 flex w-full items-center justify-center gap-xs text-sm", children: [_jsx("span", { className: "text-text-tertiary-600", children: "Don't have an account?" }), _jsx("button", { type: "submit", className: "font-semibold text-button-tertiary-fg", onClick: () => {
157
158
  globalStore.signIn.setOpen(false);
158
159
  globalStore.signUp.setOpen(true);
159
160
  }, children: "Sign up" })] })] })), context.step === 2 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Check your Phone" }), _jsxs("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: ["We\u2019ve sent a verification code to your mobile number", ' ', _jsx("span", { className: "font-semibold", children: mobileNumberParser.format(step1Form.getValues('mobileNumber')) }), ' ', "via text"] }), _jsxs("form", { ref: form2Ref, className: "mt-5", onSubmit: step2Form.handleSubmit(async ({ verificationCode }) => {
@@ -7,6 +7,7 @@ export interface SignInProps {
7
7
  responsibleGamingUrl?: string;
8
8
  className?: string;
9
9
  googleSso?: boolean;
10
+ facebookSso?: boolean;
10
11
  showPublicPlayProhibition?: boolean;
11
12
  children?: ReactNode;
12
13
  }
@@ -364,7 +364,11 @@ export declare const getPointsClubSettings: (options?: GraphQLRequestOptions) =>
364
364
  export interface GoogleClientIdQuery {
365
365
  googleClientId?: string | null;
366
366
  }
367
+ export interface FacebookClientIdQuery {
368
+ facebookClientId?: string | null;
369
+ }
367
370
  export declare const getGoogleClientId: (options?: GraphQLRequestOptions) => Promise<string | null>;
371
+ export declare const getFacebookClientId: (options?: GraphQLRequestOptions) => Promise<string | null>;
368
372
  export interface UnlinkGoogleMutation {
369
373
  unlinkGoogle: boolean;
370
374
  }
@@ -375,6 +379,16 @@ export interface UnlinkGoogleMutationVariables {
375
379
  input: UnlinkGoogleInput;
376
380
  }
377
381
  export declare const unlinkGoogle: (id: string, options?: GraphQLRequestOptions) => Promise<void>;
382
+ export interface UnlinkFacebookMutation {
383
+ unlinkFacebook: boolean;
384
+ }
385
+ export interface UnlinkFacebookInput {
386
+ id: string;
387
+ }
388
+ export interface UnlinkFacebookMutationVariables {
389
+ input: UnlinkFacebookInput;
390
+ }
391
+ export declare const unlinkFacebook: (id: string, options?: GraphQLRequestOptions) => Promise<void>;
378
392
  export interface GenerateSumsubVerificationTokenMutation {
379
393
  generateSumsubVerificationToken: string;
380
394
  }
@@ -1,7 +1,7 @@
1
1
  import { cache } from 'react';
2
2
  import { ACCOUNT_GRAPHQL_ENDPOINT } from '../constants/index.js';
3
3
  import { graphqlRequest } from './graphqlRequest.js';
4
- import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, RESET_PASSWORD, UNLINK_GOOGLE, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
4
+ import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, FACEBOOK_CLIENT_ID, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, RESET_PASSWORD, UNLINK_FACEBOOK, UNLINK_GOOGLE, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
5
5
  import { sha256 } from './sha256.js';
6
6
  export const getMemberAccount = cache(async (options) => {
7
7
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, MEMBER_ACCOUNT, undefined, options);
@@ -257,9 +257,16 @@ export const getGoogleClientId = cache(async (options) => {
257
257
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, GOOGLE_CLIENT_ID, undefined, options);
258
258
  return res.googleClientId ?? null;
259
259
  });
260
+ export const getFacebookClientId = cache(async (options) => {
261
+ const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, FACEBOOK_CLIENT_ID, undefined, options);
262
+ return res.facebookClientId ?? null;
263
+ });
260
264
  export const unlinkGoogle = async (id, options) => {
261
265
  await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, UNLINK_GOOGLE, { input: { id } }, options);
262
266
  };
267
+ export const unlinkFacebook = async (id, options) => {
268
+ await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, UNLINK_FACEBOOK, { input: { id } }, options);
269
+ };
263
270
  export const generateSumsubVerificationToken = async (options) => {
264
271
  const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, GENERATE_SUMSUB_VERIFICATION_TOKEN, undefined, options);
265
272
  return res.generateSumsubVerificationToken;
@@ -67,7 +67,7 @@ export declare const MEMBER = "\n query Member {\n member {\n dateTimeL
67
67
  /**
68
68
  * _aka_ `Query.self`
69
69
  */
70
- export declare const MEMBER_ACCOUNT = "\n query MemberAccount {\n memberAccount: self {\n ... on MemberAccount {\n id\n name\n status\n realName\n emailAddress\n mobileNumber\n birthDay\n verified\n verificationStatus\n nickName\n validId\n mobileNumberVerified\n mobileNumberVerificationRequired\n transactionPassword\n secretAnswerSubmitted\n dateTimeCreated\n dateTimeLastUpdated\n googleId\n }\n }\n }\n";
70
+ export declare const MEMBER_ACCOUNT = "\n query MemberAccount {\n memberAccount: self {\n ... on MemberAccount {\n id\n name\n status\n realName\n emailAddress\n mobileNumber\n birthDay\n verified\n verificationStatus\n nickName\n validId\n mobileNumberVerified\n mobileNumberVerificationRequired\n transactionPassword\n secretAnswerSubmitted\n dateTimeCreated\n dateTimeLastUpdated\n googleId\n facebookId\n }\n }\n }\n";
71
71
  export declare const MEMBER_VERIFICATION = "\n \n fragment FileFragment on File {\n id\n url\n status\n }\n\n\n query MemberVerification {\n memberAccount: self {\n ... on MemberAccount {\n verification {\n id\n status\n address\n permanentAddress\n sourceOfIncome\n natureOfWork\n nationality\n placeOfBirth\n idFrontImage {\n ...FileFragment\n }\n selfieImage {\n ...FileFragment\n }\n }\n }\n }\n }\n";
72
72
  export declare const REGISTER_MEMBER_ACCOUNT = "\n mutation RegisterMemberAccount(\n $input: RegisterMemberAccountInput!\n $referralCode: String\n $verificationCode: String\n $reCAPTCHAResponse: String\n ) {\n registerMemberAccount(\n input: $input\n referralCode: $referralCode\n verificationCode: $verificationCode\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on MinimumAgeRequirementError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n }\n }\n";
73
73
  export declare const REGISTER_MEMBER_ACCOUNT_BY_NAME = "\n mutation RegisterMemberAccountByName(\n $input: RegisterMemberAccountByNameInput!\n $reCAPTCHAResponse: String!\n ) {\n registerMemberAccountByName(\n input: $input\n reCAPTCHAResponse: $reCAPTCHAResponse\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on InvalidReCAPTCHAResponseError {\n name: __typename\n message\n }\n }\n }\n";
@@ -125,7 +125,9 @@ export declare const MARK_GAME_AS_FAVORITE = "\n mutation MarkGameAsFavorite($i
125
125
  export declare const UNMARK_GAME_AS_FAVORITE = "\n mutation UnmarkGameAsFavorite($input: UnmarkGameAsFavoriteInput!) {\n unmarkGameAsFavorite(input: $input)\n }\n";
126
126
  export declare const FAVORITE_GAMES = "\n query FavoriteGames {\n favoriteGames {\n ... on Game {\n id\n name\n type\n provider\n }\n }\n }\n";
127
127
  export declare const GOOGLE_CLIENT_ID = "\n query GoogleClientId {\n googleClientId\n }\n";
128
+ export declare const FACEBOOK_CLIENT_ID = "\n query FacebookClientId {\n facebookClientId\n }\n";
128
129
  export declare const UNLINK_GOOGLE = "\n mutation UnlinkGoogle($input: UnlinkGoogleInput!) {\n unlinkGoogle(input: $input)\n }\n";
130
+ export declare const UNLINK_FACEBOOK = "\n mutation UnlinkFacebook($input: UnlinkFacebookInput!) {\n unlinkFacebook(input: $input)\n }\n";
129
131
  export declare const TOURNAMENTS = "\n query Tournaments(\n $first: Int\n $after: Cursor\n $filter: TournamentFilterInput\n ) {\n tournaments(first: $first, after: $after, filter: $filter) {\n totalCount\n pageInfo {\n hasNextPage\n endCursor\n }\n edges {\n node {\n ... on MultiplierTournament {\n id\n type\n name\n winnersCount\n status\n description\n activationStartDateTime\n activationEndDateTime\n topPayouts {\n id\n multiplier\n amount\n member {\n id\n name\n }\n }\n currentLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n }\n }\n }\n }\n previousLeaderboard {\n totalCount\n edges {\n node {\n ... on TournamentLeaderboard {\n id\n username\n multiplier\n dateTimeCreated\n }\n }\n }\n }\n enabledGameProviders\n frequency\n mode\n mobileBanner {\n id\n url\n mimeType\n }\n webBanner {\n id\n url\n mimeType\n }\n rewardSettings\n }\n }\n }\n }\n }\n";
130
132
  export declare const TOURNAMENTS_COUNT = "\n query TournamentsCount($filter: TournamentFilterInput) {\n tournaments(filter: $filter) {\n totalCount\n }\n }\n";
131
133
  export declare const GENERATE_SUMSUB_VERIFICATION_TOKEN = "\n mutation GenerateSumsubVerificationToken {\n generateSumsubVerificationToken\n }\n";
@@ -1531,6 +1531,7 @@ export const MEMBER_ACCOUNT = /* GraphQL */ `
1531
1531
  dateTimeCreated
1532
1532
  dateTimeLastUpdated
1533
1533
  googleId
1534
+ facebookId
1534
1535
  }
1535
1536
  }
1536
1537
  }
@@ -2559,11 +2560,21 @@ export const GOOGLE_CLIENT_ID = /* GraphQL */ `
2559
2560
  googleClientId
2560
2561
  }
2561
2562
  `;
2563
+ export const FACEBOOK_CLIENT_ID = /* GraphQL */ `
2564
+ query FacebookClientId {
2565
+ facebookClientId
2566
+ }
2567
+ `;
2562
2568
  export const UNLINK_GOOGLE = /* GraphQL */ `
2563
2569
  mutation UnlinkGoogle($input: UnlinkGoogleInput!) {
2564
2570
  unlinkGoogle(input: $input)
2565
2571
  }
2566
2572
  `;
2573
+ export const UNLINK_FACEBOOK = /* GraphQL */ `
2574
+ mutation UnlinkFacebook($input: UnlinkFacebookInput!) {
2575
+ unlinkFacebook(input: $input)
2576
+ }
2577
+ `;
2567
2578
  export const TOURNAMENTS = /* GraphQL */ `
2568
2579
  query Tournaments(
2569
2580
  $first: Int
@@ -460,6 +460,7 @@ export interface MemberAccount {
460
460
  dateTimeCreated: string;
461
461
  dateTimeLastUpdated: string;
462
462
  googleId?: string | null;
463
+ facebookId?: string | null;
463
464
  }
464
465
  export interface MemberVerification {
465
466
  id: string;