@opexa/portal-components 0.1.63 → 0.1.65

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 (80) hide show
  1. package/dist/client/hooks/platformGamesFallback.d.ts +1 -1
  2. package/dist/client/hooks/platformGamesFallback.js +6 -4
  3. package/dist/client/hooks/useInplaySignUpMutation.d.ts +5 -0
  4. package/dist/client/hooks/useInplaySignUpMutation.js +27 -0
  5. package/dist/client/hooks/useSignInMutation.d.ts +1 -0
  6. package/dist/client/hooks/useSignInMutation.js +11 -5
  7. package/dist/client/services/signIn.d.ts +1 -1
  8. package/dist/client/services/signIn.js +9 -3
  9. package/dist/components/AccountInfo/AccountInfo.js +2 -2
  10. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  11. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  12. package/dist/components/SignIn/MobileNumberSignInternational.js +1 -0
  13. package/dist/components/SignIn/NameAndPasswordSignIn.js +1 -0
  14. package/dist/components/SignIn/SignIn.lazy.d.ts +1 -0
  15. package/dist/components/SignIn/SignIn.lazy.js +1 -1
  16. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +1 -0
  17. package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +9 -1
  18. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +49 -21
  19. package/dist/constants/Endpoint.js +7 -6
  20. package/dist/constants/EnvVar.d.ts +5 -0
  21. package/dist/constants/EnvVar.js +9 -0
  22. package/dist/constants/HeaderKey.d.ts +1 -0
  23. package/dist/constants/HeaderKey.js +1 -0
  24. package/dist/handlers/postSession.js +3 -2
  25. package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
  26. package/dist/services/account.d.ts +47 -0
  27. package/dist/services/account.js +21 -1
  28. package/dist/services/auth.d.ts +1 -1
  29. package/dist/services/auth.js +6 -4
  30. package/dist/services/queries.d.ts +1 -0
  31. package/dist/services/queries.js +44 -0
  32. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  33. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  34. package/dist/ui/Avatar/Avatar.d.ts +9 -9
  35. package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
  36. package/dist/ui/Badge/Badge.d.ts +12 -12
  37. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  38. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  39. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  40. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  41. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  42. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  43. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  44. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  45. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  46. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  47. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  48. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  49. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  50. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  51. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  52. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  53. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  54. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  55. package/dist/ui/Field/Field.d.ts +21 -21
  56. package/dist/ui/Field/field.recipe.d.ts +3 -3
  57. package/dist/ui/Menu/Menu.d.ts +198 -198
  58. package/dist/ui/Menu/menu.recipe.d.ts +11 -11
  59. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  60. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  61. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  62. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  63. package/dist/ui/PinInput/PinInput.d.ts +12 -12
  64. package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
  65. package/dist/ui/Popover/Popover.d.ts +88 -88
  66. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  67. package/dist/ui/Progress/Progress.d.ts +27 -27
  68. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  69. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  70. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  71. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  72. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  73. package/dist/ui/Select/Select.d.ts +45 -45
  74. package/dist/ui/Select/select.recipe.d.ts +3 -3
  75. package/dist/ui/Table/Table.d.ts +21 -21
  76. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  77. package/dist/ui/Table/table.recipe.d.ts +3 -3
  78. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  79. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  80. package/package.json +1 -1
@@ -2,5 +2,5 @@ import type { GamesInput__Next } from '../../services/cmsPortal';
2
2
  import type { PlatformGamesInput } from '../../services/wallet';
3
3
  import type { Game, PaginatedQueryResult, PlatformGame } from '../../types';
4
4
  export declare const mapGamesInputToPlatformGamesInput: (input?: GamesInput__Next) => PlatformGamesInput;
5
- export declare const getPlatformGameFallbackImage: (provider: string) => string;
5
+ export declare const getPlatformGameFallbackImage: (provider: string, gameId: string) => string;
6
6
  export declare const normalizePlatformGames: (data: PaginatedQueryResult<PlatformGame>) => PaginatedQueryResult<Game>;
@@ -1,3 +1,4 @@
1
+ import { ObjectId } from '@opexa/object-id';
1
2
  import { PLATFORM_ID, SITE_ID, STATIC_ENDPOINT } from '../../constants/index.js';
2
3
  export const mapGamesInputToPlatformGamesInput = (input) => {
3
4
  const filter = input?.filter;
@@ -13,9 +14,9 @@ export const mapGamesInputToPlatformGamesInput = (input) => {
13
14
  },
14
15
  };
15
16
  };
16
- export const getPlatformGameFallbackImage = (provider) => {
17
- const slug = provider.toLocaleLowerCase();
18
- return `${STATIC_ENDPOINT}/images/${slug}/thumbnail-${slug}.webp`;
17
+ export const getPlatformGameFallbackImage = (provider, gameId) => {
18
+ const slug = provider.toLowerCase();
19
+ return `${STATIC_ENDPOINT}/images/${slug}/thumbnail-${gameId}.webp`;
19
20
  };
20
21
  const normalizePlatformGame = (platformGame, cursor) => {
21
22
  const name = platformGame.displayName ?? platformGame.name;
@@ -26,6 +27,7 @@ const normalizePlatformGame = (platformGame, cursor) => {
26
27
  !platformGame.type) {
27
28
  return null;
28
29
  }
30
+ const gameId = ObjectId.from(platformGame.id).toString('hex');
29
31
  return {
30
32
  id: platformGame.id,
31
33
  game: platformGame.id,
@@ -35,7 +37,7 @@ const normalizePlatformGame = (platformGame, cursor) => {
35
37
  tags: [],
36
38
  rank: '0',
37
39
  site: SITE_ID,
38
- image: getPlatformGameFallbackImage(platformGame.provider),
40
+ image: getPlatformGameFallbackImage(platformGame.provider, gameId),
39
41
  cursor,
40
42
  status: 'ACTIVE',
41
43
  platform: PLATFORM_ID,
@@ -0,0 +1,5 @@
1
+ import { type RegisterMemberAccountByMobileNumberInplayInput } from '../../services/account';
2
+ import type { Mutation } from '../../types';
3
+ export interface InplaySignUpMutationInput extends Omit<RegisterMemberAccountByMobileNumberInplayInput, 'cellxpertCxd'> {
4
+ }
5
+ export declare const useInplaySignUpMutation: Mutation<void, InplaySignUpMutationInput>;
@@ -0,0 +1,27 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import { registerMemberAccountByMobileNumberInplay, } from '../../services/account.js';
3
+ import { getSignUpMutationKey } from '../../utils/mutationKeys.js';
4
+ import { getSession } from '../services/getSession.js';
5
+ import { useCellxpertCxd } from './useCellxpertCxd.js';
6
+ export const useInplaySignUpMutation = (config) => {
7
+ const [cellxpertCxd] = useCellxpertCxd();
8
+ return useMutation({
9
+ ...config,
10
+ mutationKey: getSignUpMutationKey(),
11
+ mutationFn: async (input) => {
12
+ const session = await getSession();
13
+ return await registerMemberAccountByMobileNumberInplay({
14
+ ...input,
15
+ ...(cellxpertCxd && {
16
+ cellxpertCxd: cellxpertCxd.value,
17
+ }),
18
+ }, {
19
+ headers: {
20
+ ...(session.domain && {
21
+ Domain: session.domain,
22
+ }),
23
+ },
24
+ });
25
+ },
26
+ });
27
+ };
@@ -4,6 +4,7 @@ import type { Authenticator, MutationConfig } from '../../types';
4
4
  import { type SignInInput } from '../services/signIn';
5
5
  export interface UseSignInMutationOptions extends MutationConfig<Authenticator | null, SignInInput> {
6
6
  versionSession?: VersionSession;
7
+ authApiBaseUrl?: string;
7
8
  version?: ApiVersion;
8
9
  }
9
10
  export declare const useSignInMutation: (options?: UseSignInMutationOptions) => UseMutationResult<Authenticator | null, Error, SignInInput>;
@@ -8,19 +8,25 @@ import { getSignInMutationKey } from '../../utils/mutationKeys.js';
8
8
  import { getSessionQueryKey } from '../../utils/queryKeys.js';
9
9
  import { getSession } from '../services/getSession.js';
10
10
  import { signIn } from '../services/signIn.js';
11
+ import { useFeatureFlag } from './useFeatureFlag.js';
11
12
  import { useRecaptcha } from './useRecaptcha.js';
12
13
  export const useSignInMutation = (options) => {
13
14
  const queryClient = getQueryClient();
14
15
  const { executeRecaptcha, isGoogleFraudDefense } = useRecaptcha();
15
- const { versionSession, version = 1, ...config } = options ?? {};
16
+ const { enabled: featureFlagEnabled } = useFeatureFlag();
17
+ const { versionSession, version = 1, authApiBaseUrl, ...config } = options ?? {};
16
18
  return useMutation({
17
19
  ...config,
18
20
  mutationKey: getSignInMutationKey(),
19
21
  mutationFn: async (input) => {
20
22
  const session = await getSession();
21
23
  const token = await executeRecaptcha('submit');
22
- const isInplayEligible = input.type === 'NAME_AND_PASSWORD' || input.type === 'MOBILE_NUMBER';
23
- const fingerprint = (versionSession === 'Inplay' || version !== 1) && isInplayEligible
24
+ const isInplay = versionSession === 'Inplay' &&
25
+ (input.type === 'NAME_AND_PASSWORD' ||
26
+ (input.type === 'MOBILE_NUMBER' && featureFlagEnabled));
27
+ const fingerprint = (input.type === 'NAME_AND_PASSWORD' &&
28
+ (versionSession === 'Inplay' || version !== 1)) ||
29
+ (input.type === 'MOBILE_NUMBER' && isInplay)
24
30
  ? await getFingerprint()
25
31
  : null;
26
32
  const recaptchaHeaderKey = isGoogleFraudDefense
@@ -41,8 +47,8 @@ export const useSignInMutation = (options) => {
41
47
  ? { Channel: 'ANDROID' }
42
48
  : { Channel: 'IOS' }),
43
49
  },
44
- }, versionSession, version);
45
- const authenticator = versionSession === 'Inplay' && isInplayEligible
50
+ }, versionSession, version, authApiBaseUrl, featureFlagEnabled);
51
+ const authenticator = isInplay
46
52
  ? await pollSignIn(signInOnce)
47
53
  : await signInOnce();
48
54
  if (!authenticator) {
@@ -2,4 +2,4 @@ import type { ApiVersion, CreateSessionInput, VersionSession } from '../../servi
2
2
  import { type HttpRequestOptions } from '../../services/httpRequest';
3
3
  import type { Authenticator } from '../../types';
4
4
  export type SignInInput = CreateSessionInput;
5
- export declare function signIn(input: SignInInput, options?: HttpRequestOptions, versionSession?: VersionSession, version?: ApiVersion): Promise<Authenticator | null>;
5
+ export declare function signIn(input: SignInInput, options?: HttpRequestOptions, versionSession?: VersionSession, version?: ApiVersion, authApiBaseUrl?: string, isInplayMobileEnabled?: boolean): Promise<Authenticator | null>;
@@ -1,14 +1,20 @@
1
1
  import { Capacitor } from '@capacitor/core';
2
- import { API_VERSION_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, SESSION_VERSION_HEADER_KEY, } from '../../constants/index.js';
2
+ import { API_VERSION_HEADER_KEY, AUTH_API_BASE_URL_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, SESSION_VERSION_HEADER_KEY, } from '../../constants/index.js';
3
3
  import { httpRequest, } from '../../services/httpRequest.js';
4
4
  const platform = Capacitor.getPlatform();
5
- export async function signIn(input, options, versionSession = 'default', version = 1) {
5
+ export async function signIn(input, options, versionSession = 'default', version = 1, authApiBaseUrl, isInplayMobileEnabled = false) {
6
6
  const headers = new Headers(options?.headers);
7
- headers.set(SESSION_VERSION_HEADER_KEY, versionSession);
7
+ const effectiveVersionSession = input.type === 'MOBILE_NUMBER' && !isInplayMobileEnabled
8
+ ? 'default'
9
+ : versionSession;
10
+ headers.set(SESSION_VERSION_HEADER_KEY, effectiveVersionSession);
8
11
  headers.set(API_VERSION_HEADER_KEY, String(version));
9
12
  if (version === 4 && platform === 'web') {
10
13
  headers.set(PLATFORM_WEB_HEADER_KEY, 'true');
11
14
  }
15
+ if (authApiBaseUrl) {
16
+ headers.set(AUTH_API_BASE_URL_HEADER_KEY, authApiBaseUrl);
17
+ }
12
18
  const res = await httpRequest.json('/api/sessions', {
13
19
  ...options,
14
20
  headers,
@@ -12,10 +12,9 @@ import { twMerge } from 'tailwind-merge';
12
12
  import { z } from 'zod';
13
13
  import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
14
14
  import { useDisclosure } from '../../client/hooks/useDisclosure.js';
15
- import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
16
- import { getLocale, extractPhoneCode, } from '../../utils/countries/getLocaleInfo.js';
17
15
  import { useFacebookClientQuery } from '../../client/hooks/useFacebookClientQuery.js';
18
16
  import { useGoogleClientIdQuery } from '../../client/hooks/useGoogleClientIdQuery.js';
17
+ import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
19
18
  import { useMemberVerificationQuery } from '../../client/hooks/useMemberVerificationQuery.js';
20
19
  import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
21
20
  import { useProfileCompletionQuery } from '../../client/hooks/useProfileCompletionQuery.js';
@@ -38,6 +37,7 @@ import { Dialog } from '../../ui/Dialog/index.js';
38
37
  import { Field } from '../../ui/Field/index.js';
39
38
  import { IconButton } from '../../ui/IconButton/index.js';
40
39
  import { Portal } from '../../ui/Portal/index.js';
40
+ import { extractPhoneCode, getLocale, } from '../../utils/countries/getLocaleInfo.js';
41
41
  import { getQueryClient } from '../../utils/getQueryClient.js';
42
42
  import { getAccountQueryKey, getProfileCompletionQueryKey, } from '../../utils/queryKeys.js';
43
43
  const accountSchema = z.object({
@@ -1,6 +1,6 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
- view: "vca" | "form";
3
+ view: "form" | "vca";
4
4
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
@@ -13,7 +13,7 @@ export declare const OnlineBankDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
- view: "vca" | "form";
16
+ view: "form" | "vca";
17
17
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
@@ -1,7 +1,7 @@
1
1
  import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
- view: "vca" | "form";
4
+ view: "form" | "vca";
5
5
  status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
@@ -81,6 +81,7 @@ export function MobileNumberSignInInternational() {
81
81
  termsOfUse: ctx.termsOfUse,
82
82
  })));
83
83
  const signInMutation = useSignInMutation({
84
+ authApiBaseUrl: signInProps.authApiBaseUrl,
84
85
  versionSession: signInProps.versionSession,
85
86
  version: signInProps.version,
86
87
  onSuccess: async () => {
@@ -55,6 +55,7 @@ export function NameAndPasswordSignIn() {
55
55
  })));
56
56
  const [formType, setFormType] = useState('NAME_AND_PASSWORD');
57
57
  const signInMutation = useSignInMutation({
58
+ authApiBaseUrl: signInProps.authApiBaseUrl,
58
59
  versionSession: signInProps.versionSession,
59
60
  version: signInProps.version,
60
61
  onSuccess: async (authenticator) => {
@@ -25,6 +25,7 @@ export interface SignInProps extends UseSignInProps {
25
25
  shouldShowResponsibleGamingReminder?: boolean;
26
26
  shouldShowDisclaimer?: boolean;
27
27
  variant?: 'crazywin' | 'happybingo';
28
+ authApiBaseUrl?: string;
28
29
  /**
29
30
  * Selects which auth session endpoint the sign-in flow targets.
30
31
  * - `default` (default): `${AUTH_ENDPOINT}/sessions`
@@ -9,8 +9,8 @@ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
9
9
  import { XIcon } from '../../icons/XIcon.js';
10
10
  import { Dialog } from '../../ui/Dialog/index.js';
11
11
  import { Portal } from '../../ui/Portal/index.js';
12
- import { MigrateLoadingDialog } from '../Migrate/MigrateLoadingDialog.js';
13
12
  import { getSignInMutationKey } from '../../utils/mutationKeys.js';
13
+ import { MigrateLoadingDialog } from '../Migrate/MigrateLoadingDialog.js';
14
14
  import { SignInForm as CWSignInForm } from './CrazyWin/SignInForm.js';
15
15
  import { SignInForm as HBSignInForm } from './HappyBingo/SignInForm.js';
16
16
  import { SignInPropsProvider, SignInProvider } from './SignInContext.js';
@@ -13,6 +13,7 @@ export interface SignUpDefaultProps {
13
13
  logo: ImageProps['src'];
14
14
  basicSignUp?: boolean;
15
15
  branches?: Branch[];
16
+ featureFlagBranches?: Branch[];
16
17
  enabledCountries?: CountryCode[];
17
18
  termsAndConditionsUrl?: string;
18
19
  responsibleGamingUrl?: string;
@@ -4,6 +4,7 @@ import Image, {} from 'next/image';
4
4
  import { Suspense } from 'react';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import { useShallow } from 'zustand/shallow';
7
+ import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
7
8
  import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
8
9
  import { XIcon } from '../../../icons/XIcon.js';
9
10
  import { Dialog } from '../../../ui/Dialog/index.js';
@@ -12,12 +13,19 @@ import { SignUpDefaultPropsProvider } from './SignUpDefaultContext.js';
12
13
  import { SignUpDefaultForm } from './SignUpDefaultForm.js';
13
14
  import { SignUpDefaultFormInternational } from './SignUpDefaultFormInternational.js';
14
15
  export function SignUpDefault(props) {
16
+ const { enabled: featureFlagEnabled } = useFeatureFlag();
15
17
  const signUpStore = useGlobalStore(useShallow((ctx) => ctx.signUp));
16
18
  const globalStore = useGlobalStore(useShallow((ctx) => ({
17
19
  termsAndConditions: ctx.termsAndConditions,
18
20
  responsibleGaming: ctx.responsibleGaming,
19
21
  })));
20
- return (_jsx(SignUpDefaultPropsProvider, { value: props, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
22
+ return (_jsx(SignUpDefaultPropsProvider, { value: {
23
+ ...props,
24
+ branches: [
25
+ ...(props.branches ?? []),
26
+ ...(featureFlagEnabled ? (props.featureFlagBranches ?? []) : []),
27
+ ],
28
+ }, children: _jsx(Dialog.Root, { open: signUpStore.open, onOpenChange: (details) => {
21
29
  signUpStore.setOpen(details.open);
22
30
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
23
31
  // Reset checkbox state when dialog closes
@@ -14,6 +14,7 @@ import { useShallow } from 'zustand/shallow';
14
14
  import { useCooldown } from '../../../client/hooks/useCooldown.js';
15
15
  import { useFeatureFlag } from '../../../client/hooks/useFeatureFlag.js';
16
16
  import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
17
+ import { useInplaySignUpMutation } from '../../../client/hooks/useInplaySignUpMutation.js';
17
18
  import { useLocaleInfo } from '../../../client/hooks/useLocaleInfo.js';
18
19
  import { useMobileNumberParser } from '../../../client/hooks/useMobileNumberParser.js';
19
20
  import { useSendVerificationCodeMutation } from '../../../client/hooks/useSendVerificationCodeMutation.js';
@@ -27,7 +28,6 @@ import { HelpCircleIcon } from '../../../icons/HelpCircleIcon.js';
27
28
  import pagcorLogo from '../../../images/pagcor-round-icon.png';
28
29
  import responsibleGamingLogo from '../../../images/responsible-gaming-gold.png';
29
30
  import { ObjectType } from '../../../services/ObjectType.js';
30
- import { checkInplayMemberExists } from '../../../services/auth.js';
31
31
  import { Button } from '../../../ui/Button/index.js';
32
32
  import { Checkbox } from '../../../ui/Checkbox/index.js';
33
33
  import { Field } from '../../../ui/Field/index.js';
@@ -69,7 +69,10 @@ export function SignUpDefaultForm() {
69
69
  })));
70
70
  const search = useSearchParams();
71
71
  const signUpMutation = useSignUpMutation();
72
- const signInMutation = useSignInMutation();
72
+ const inplaySignUpMutation = useInplaySignUpMutation();
73
+ const signInMutation = useSignInMutation({
74
+ versionSession: signUpProps.versionSession,
75
+ });
73
76
  const sendVerificationCodeMutation = useSendVerificationCodeMutation();
74
77
  const featureFlag = useFeatureFlag();
75
78
  const localeInfo = useLocaleInfo();
@@ -246,21 +249,6 @@ export function SignUpDefaultForm() {
246
249
  }
247
250
  return (_jsxs(_Fragment, { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsx("h2", { className: "mt-xl text-center font-semibold text-lg", children: "Create an account" }), _jsx("p", { className: "mt-xs text-center text-sm text-text-secondary-700", children: "Register instantly and start playing!" }), _jsxs("form", { className: "mt-3xl", autoComplete: "off", onSubmit: step1Form.handleSubmit(async (data) => {
248
251
  try {
249
- if (signUpProps.versionSession === 'Inplay' &&
250
- featureFlag.enabled) {
251
- const exists = await checkInplayMemberExists(mobileNumberParser.format(data.mobileNumber));
252
- if (exists) {
253
- toaster.warning({
254
- description: 'This mobile number is already registered. Please try to log in.',
255
- });
256
- globalStore.setPrefillMobileNumber(data.mobileNumber);
257
- globalStore.setPendingType('MOBILE_NUMBER');
258
- globalStore.signUp.setOpen(false);
259
- globalStore.signIn.setOpen(true);
260
- step1Form.reset();
261
- return;
262
- }
263
- }
264
252
  await sendVerificationCodeMutation.mutateAsync({
265
253
  channel: 'SMS',
266
254
  recipient: mobileNumberParser.format(data.mobileNumber),
@@ -331,10 +319,9 @@ export function SignUpDefaultForm() {
331
319
  const { mobileNumber } = step1Form.getValues();
332
320
  const birthdayValue = step1Form.getValues('birthDay');
333
321
  try {
334
- await signUpMutation.mutateAsync({
322
+ const signUpInput = {
335
323
  id,
336
324
  mobileNumber: mobileNumberParser.format(mobileNumber),
337
- verificationCode: verificationCode.join(''),
338
325
  ...(!signUpProps.basicSignUp && {
339
326
  realName: [
340
327
  step1Form.getValues('firstName'),
@@ -344,7 +331,7 @@ export function SignUpDefaultForm() {
344
331
  .filter(Boolean)
345
332
  .join(' '),
346
333
  ...(!!birthdayValue && {
347
- birthDay: format(birthdayValue, 'yyyy-MM-dd'),
334
+ dateOfBirth: format(birthdayValue, 'yyyy-MM-dd'),
348
335
  }),
349
336
  ...(signUpProps?.branches &&
350
337
  signUpProps.branches.length > 0 && {
@@ -358,6 +345,44 @@ export function SignUpDefaultForm() {
358
345
  }),
359
346
  referralCode: search.get('referralCode') ?? undefined,
360
347
  agentCode,
348
+ };
349
+ if (signUpProps.versionSession === 'Inplay' &&
350
+ featureFlag.enabled) {
351
+ await inplaySignUpMutation.mutateAsync({
352
+ ...signUpInput,
353
+ mobileNumberVerificationCode: verificationCode.join(''),
354
+ });
355
+ const name = mobileNumberParser.format(mobileNumber);
356
+ const password = `${name}${id}`;
357
+ try {
358
+ await signInMutation.mutateAsync({
359
+ type: 'NAME_AND_PASSWORD',
360
+ name,
361
+ password,
362
+ });
363
+ }
364
+ catch {
365
+ globalStore.setPrefillMobileNumber(name);
366
+ globalStore.setPendingType('MOBILE_NUMBER');
367
+ globalStore.signUp.setOpen(false);
368
+ globalStore.signIn.setOpen(true);
369
+ step1Form.reset();
370
+ step2Form.reset();
371
+ setStep(1);
372
+ return;
373
+ }
374
+ globalStore.signUp.setOpen(false);
375
+ globalStore.setFirstTimeSignUp(true);
376
+ step1Form.reset();
377
+ step2Form.reset();
378
+ setStep(1);
379
+ return;
380
+ }
381
+ const { dateOfBirth, ...legacySignUpInput } = signUpInput;
382
+ await signUpMutation.mutateAsync({
383
+ ...legacySignUpInput,
384
+ birthDay: dateOfBirth,
385
+ verificationCode: verificationCode.join(''),
361
386
  });
362
387
  const name = mobileNumberParser.format(mobileNumber);
363
388
  const password = `${name}${id}`;
@@ -391,7 +416,10 @@ export function SignUpDefaultForm() {
391
416
  }
392
417
  catch (error) {
393
418
  if (error instanceof Error &&
394
- error.name === 'MemberAccountAlreadyExistsError') {
419
+ (error.name === 'MemberAccountAlreadyExistsError' ||
420
+ (signUpProps.versionSession === 'Inplay' &&
421
+ featureFlag.enabled &&
422
+ error.name === 'MobileNumberNotAvailableError'))) {
395
423
  toaster.warning({
396
424
  description: 'This mobile number is already registered. Please try to log in.',
397
425
  });
@@ -1,4 +1,4 @@
1
- import { ENVIRONMENT } from './EnvVar.js';
1
+ import { AUTH_API_BASE_URL, ENVIRONMENT } from './EnvVar.js';
2
2
  export const ACCOUNT_GRAPHQL_ENDPOINT = {
3
3
  development: 'https://account.development.opexa.io/graphql',
4
4
  staging: 'https://account.staging.atalos.io/graphql',
@@ -34,11 +34,12 @@ export const WALLET_GRAPHQL_ENDPOINT = {
34
34
  staging: 'https://wallet.staging.atalos.io/graphql',
35
35
  production: 'https://wallet.opexa.io/graphql',
36
36
  }[ENVIRONMENT];
37
- export const AUTH_ENDPOINT = {
38
- development: 'https://auth.development.opexa.io',
39
- staging: 'https://auth.staging.atalos.io',
40
- production: 'https://auth.opexa.io',
41
- }[ENVIRONMENT];
37
+ export const AUTH_ENDPOINT = AUTH_API_BASE_URL ||
38
+ {
39
+ development: 'https://auth.development.opexa.io',
40
+ staging: 'https://auth.staging.atalos.io',
41
+ production: 'https://auth.opexa.io',
42
+ }[ENVIRONMENT];
42
43
  export const CMS_PORTAL_ENDPOINT = {
43
44
  development: 'https://portal-api.opexacms.io',
44
45
  staging: 'https://portal-api.staging.opexacms.io',
@@ -2,4 +2,9 @@ export declare const SITE_ID: string;
2
2
  export declare const PLATFORM_ID: string;
3
3
  export declare const PLATFORM_CODE: string;
4
4
  export declare const ENVIRONMENT: "production" | "staging" | "development";
5
+ /**
6
+ * Overrides the auth service base URL for all environments, taking
7
+ * precedence over the per-environment default in `AUTH_ENDPOINT`.
8
+ */
9
+ export declare const AUTH_API_BASE_URL: string | undefined;
5
10
  export declare const INTERNALS__REPORT_WEB_VITALS: boolean;
@@ -18,6 +18,15 @@ export const ENVIRONMENT = z
18
18
  .enum(['production', 'staging', 'development'])
19
19
  .catch('development')
20
20
  .parse(process.env.NEXT_PUBLIC_ENVIRONMENT);
21
+ /**
22
+ * Overrides the auth service base URL for all environments, taking
23
+ * precedence over the per-environment default in `AUTH_ENDPOINT`.
24
+ */
25
+ export const AUTH_API_BASE_URL = z
26
+ .string()
27
+ .trim()
28
+ .optional()
29
+ .parse(process.env.NEXT_PUBLIC_AUTH_API_BASE_URL);
21
30
  export const INTERNALS__REPORT_WEB_VITALS = z
22
31
  .any()
23
32
  .transform(Boolean)
@@ -2,6 +2,7 @@ export declare const RECAPTCHA_HEADER_KEY: string;
2
2
  export declare const TEST_PASS_HEADER_KEY: string;
3
3
  export declare const DOMAIN_HEADER_KEY: string;
4
4
  export declare const SESSION_VERSION_HEADER_KEY: string;
5
+ export declare const AUTH_API_BASE_URL_HEADER_KEY: string;
5
6
  export declare const API_VERSION_HEADER_KEY: string;
6
7
  export declare const PLATFORM_WEB_HEADER_KEY: string;
7
8
  export declare const FINGERPRINT_HEADER_KEY: string;
@@ -2,6 +2,7 @@ export const RECAPTCHA_HEADER_KEY = 'Google-Recaptcha-Response';
2
2
  export const TEST_PASS_HEADER_KEY = 'Test-Pass';
3
3
  export const DOMAIN_HEADER_KEY = 'Domain';
4
4
  export const SESSION_VERSION_HEADER_KEY = 'X-Session-Version';
5
+ export const AUTH_API_BASE_URL_HEADER_KEY = 'X-Auth-Api-Base-Url';
5
6
  export const API_VERSION_HEADER_KEY = 'X-Api-Version';
6
7
  export const PLATFORM_WEB_HEADER_KEY = 'X-Platform-Web';
7
8
  export const FINGERPRINT_HEADER_KEY = 'Fingerprint';
@@ -1,7 +1,7 @@
1
1
  import { addDays, addMinutes, subMinutes } from 'date-fns';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
- import { ACCESS_TOKEN_COOKIE_NAME, API_VERSION_HEADER_KEY, DOMAIN_HEADER_KEY, FINGERPRINT_HEADER_KEY, GOOGLE_FRAUD_DEFENSE_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, SESSION_VERSION_HEADER_KEY, } from '../constants/index.js';
4
+ import { ACCESS_TOKEN_COOKIE_NAME, API_VERSION_HEADER_KEY, AUTH_API_BASE_URL_HEADER_KEY, DOMAIN_HEADER_KEY, FINGERPRINT_HEADER_KEY, GOOGLE_FRAUD_DEFENSE_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, SESSION_VERSION_HEADER_KEY, } from '../constants/index.js';
5
5
  import { createSession, } from '../services/auth.js';
6
6
  const CreateSessionDefinition = z.union([
7
7
  z.object({
@@ -44,6 +44,7 @@ export async function postSession(request) {
44
44
  const fingerprint = request.headers.get(FINGERPRINT_HEADER_KEY);
45
45
  const versionSessionHeader = request.headers.get(SESSION_VERSION_HEADER_KEY);
46
46
  const versionSession = versionSessionHeader === 'Inplay' ? 'Inplay' : 'default';
47
+ const authApiBaseUrl = request.headers.get(AUTH_API_BASE_URL_HEADER_KEY);
47
48
  const version = request.headers.get(API_VERSION_HEADER_KEY) === '4' ? 4 : 1;
48
49
  const isWeb = request.headers.get(PLATFORM_WEB_HEADER_KEY) === 'true';
49
50
  try {
@@ -69,7 +70,7 @@ export async function postSession(request) {
69
70
  ...(channel && { Channel: channel }),
70
71
  ...(isWeb && { [PLATFORM_WEB_HEADER_KEY]: 'true' }),
71
72
  },
72
- }, versionSession, version);
73
+ }, versionSession, version, authApiBaseUrl);
73
74
  if (res.authenticator) {
74
75
  return NextResponse.json({
75
76
  ok: true,
@@ -8,24 +8,24 @@ export declare const createForgotPasswordSchema: (mobileNumberParser: MobileNumb
8
8
  mobileNumber: z.ZodEffects<z.ZodString, string, string>;
9
9
  verificationCode: z.ZodEffects<z.ZodString, string, string>;
10
10
  }, "strip", z.ZodTypeAny, {
11
- mobileNumber: string;
12
11
  verificationCode: string;
13
12
  password: string;
13
+ mobileNumber: string;
14
14
  confirmPassword: string;
15
15
  }, {
16
- mobileNumber: string;
17
16
  verificationCode: string;
18
17
  password: string;
18
+ mobileNumber: string;
19
19
  confirmPassword: string;
20
20
  }>, {
21
- mobileNumber: string;
22
21
  verificationCode: string;
23
22
  password: string;
23
+ mobileNumber: string;
24
24
  confirmPassword: string;
25
25
  }, {
26
- mobileNumber: string;
27
26
  verificationCode: string;
28
27
  password: string;
28
+ mobileNumber: string;
29
29
  confirmPassword: string;
30
30
  }>;
31
31
  export type ForgotPasswordSchema = z.infer<ReturnType<typeof createForgotPasswordSchema>>;
@@ -105,6 +105,53 @@ export interface RegisterMemberAccountByMobileNumberMutation {
105
105
  }
106
106
  export type RegisterMemberAccountByMobileNumberInput = Simplify<RegisterMemberAccountByMobileNumberMutationVariables['input'] & Pick<RegisterMemberAccountByMobileNumberMutationVariables, 'mobileNumberVerificationCode'>>;
107
107
  export declare const registerMemberAccountByMobileNumber: (input: RegisterMemberAccountByMobileNumberInput, options?: GraphQLRequestOptions) => Promise<void>;
108
+ export type RegisterMemberAccountByMobileNumberInplayError = {
109
+ name: 'AccountNameNotAvailableError';
110
+ message: string;
111
+ } | {
112
+ name: 'MobileNumberNotAvailableError';
113
+ message: string;
114
+ } | {
115
+ name: 'EmailAddressNotAvailableError';
116
+ message: string;
117
+ } | {
118
+ name: 'InvalidMobileNumberVerificationCodeError';
119
+ message: string;
120
+ } | {
121
+ name: 'InvalidAgentCodeError';
122
+ message: string;
123
+ } | {
124
+ name: 'InvalidPlatformError';
125
+ message: string;
126
+ } | {
127
+ name: 'ReCAPTCHAVerificationFailedError';
128
+ message: string;
129
+ } | {
130
+ name: 'MemberAccountAlreadyExistsError';
131
+ message: string;
132
+ };
133
+ export interface RegisterMemberAccountByMobileNumberInplayMutation {
134
+ registerMemberAccountByMobileNumber?: null | RegisterMemberAccountByMobileNumberInplayError;
135
+ }
136
+ export interface RegisterMemberAccountByMobileNumberInplayMutationVariables {
137
+ input: {
138
+ id: string;
139
+ mobileNumber: string;
140
+ emailAddress?: string;
141
+ branchCode?: string;
142
+ mobileNumberVerificationCode: string;
143
+ agentCode?: string;
144
+ gigRewardsQuestDetails?: {
145
+ gigUserId: string;
146
+ };
147
+ cellxpertCxd?: string;
148
+ realName?: string;
149
+ dateOfBirth?: string;
150
+ };
151
+ referralCode?: string;
152
+ }
153
+ export type RegisterMemberAccountByMobileNumberInplayInput = Simplify<RegisterMemberAccountByMobileNumberInplayMutationVariables['input'] & Pick<RegisterMemberAccountByMobileNumberInplayMutationVariables, 'referralCode'>>;
154
+ export declare const registerMemberAccountByMobileNumberInplay: (input: RegisterMemberAccountByMobileNumberInplayInput, options?: GraphQLRequestOptions) => Promise<void>;
108
155
  export interface RegisterMemberAccountMutationVariables__Next {
109
156
  input: {
110
157
  id: string;