@opexa/portal-components 0.0.333 → 0.0.335

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 (79) hide show
  1. package/dist/client/hooks/useSignUpMutation.d.ts +1 -1
  2. package/dist/client/hooks/useSignUpMutation.js +3 -0
  3. package/dist/client/hooks/useUpdateSessionMutation.js +2 -0
  4. package/dist/client/services/updateSession.d.ts +1 -0
  5. package/dist/components/Bonuses/Bonuses.client.js +2 -0
  6. package/dist/components/DigitainLauncher/Loading.d.ts +1 -0
  7. package/dist/components/DigitainLauncher/Loading.js +5 -0
  8. package/dist/components/KYC/BasicInformation.d.ts +1 -0
  9. package/dist/components/KYC/BasicInformation.js +101 -0
  10. package/dist/components/KYC/IdentityVerification.d.ts +1 -0
  11. package/dist/components/KYC/IdentityVerification.js +120 -0
  12. package/dist/components/KYC/Indicator.d.ts +1 -0
  13. package/dist/components/KYC/Indicator.js +8 -0
  14. package/dist/components/KYC/KYC.lazy.d.ts +6 -0
  15. package/dist/components/KYC/KYC.lazy.js +45 -0
  16. package/dist/components/KYC/KYCContext.d.ts +6 -0
  17. package/dist/components/KYC/KYCContext.js +2 -0
  18. package/dist/components/KYC/PersonalInformation.d.ts +1 -0
  19. package/dist/components/KYC/PersonalInformation.js +122 -0
  20. package/dist/components/KYC/useKYC.d.ts +25 -0
  21. package/dist/components/KYC/useKYC.js +38 -0
  22. package/dist/components/PortalProvider/PortalProvider.js +2 -1
  23. package/dist/components/PortalProvider/SetupBtag.d.ts +1 -0
  24. package/dist/components/PortalProvider/SetupBtag.js +29 -0
  25. package/dist/components/PortalProvider/SetupCellxpertCxd.js +1 -1
  26. package/dist/components/PortalProvider/SetupDomain.js +1 -1
  27. package/dist/components/SignIn/GoogleSignInTrigger.js +12 -12
  28. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +0 -1
  29. package/dist/components/SignUp/SignUpKYC/SignUpKYCForm.js +0 -1
  30. package/dist/constants/StorageKey.d.ts +2 -1
  31. package/dist/constants/StorageKey.js +2 -1
  32. package/dist/handlers/getSession.js +4 -1
  33. package/dist/handlers/index.d.ts +7 -7
  34. package/dist/handlers/patchSession.js +9 -1
  35. package/dist/images/responsible-gaming-yellow.png +0 -0
  36. package/dist/services/account.d.ts +4 -0
  37. package/dist/types/index.d.ts +5 -3
  38. package/dist/ui/AlertDialog/AlertDialog.d.ts +55 -55
  39. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +5 -5
  40. package/dist/ui/Carousel/Carousel.d.ts +72 -72
  41. package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
  42. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  43. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  44. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  45. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  46. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  47. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  48. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  49. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  50. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  51. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  52. package/dist/ui/Dialog/Dialog.d.ts +55 -55
  53. package/dist/ui/Dialog/dialog.recipe.d.ts +5 -5
  54. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  55. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  56. package/dist/ui/Menu/Menu.d.ts +252 -252
  57. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  58. package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
  59. package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
  60. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  61. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  62. package/dist/ui/Popover/Popover.d.ts +88 -88
  63. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  64. package/dist/ui/Progress/Progress.d.ts +27 -27
  65. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  66. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  67. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  68. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  69. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  70. package/dist/ui/Select/Select.d.ts +45 -45
  71. package/dist/ui/Select/select.recipe.d.ts +3 -3
  72. package/dist/ui/Table/Table.d.ts +21 -21
  73. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  74. package/dist/ui/Table/table.recipe.d.ts +3 -3
  75. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  76. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  77. package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
  78. package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
  79. package/package.json +1 -1
@@ -32,6 +32,6 @@ export function SetupDomain() {
32
32
  if (oldDomain === newDomain)
33
33
  return;
34
34
  return mutation.mutate({ domain: newDomain });
35
- }, query.isPending ? null : 1000);
35
+ }, query.isPending ? null : 250);
36
36
  return null;
37
37
  }
@@ -16,31 +16,31 @@ export const GoogleSignInTrigger = (props) => {
16
16
  return null;
17
17
  return (_jsx(GoogleOAuthProvider, { clientId: googleClientId, children: _jsx(Trigger, { ...props }) }));
18
18
  };
19
- const Trigger = ({ children, asChild, onClick, ...props }) => {
20
- const signIn = useSignInMutation();
19
+ const Trigger = ({ children, disabled, asChild, onClick, ...props }) => {
20
+ const signIn = useSignInMutation({
21
+ onError() {
22
+ toaster.error({
23
+ title: 'Account Not Found',
24
+ description: 'The Google account you used isn’t connected to any existing account in our system. Please connect it to continue.',
25
+ });
26
+ },
27
+ });
21
28
  const signInGoogle = useGoogleLogin({
22
29
  flow: 'auth-code',
23
30
  scope: 'openid profile email phone',
24
31
  state: encodeURIComponent(`${window.location.origin},${PLATFORM_CODE}`),
25
32
  ux_mode: 'popup',
26
33
  redirect_uri: 'postmessage',
27
- onSuccess: async (cred) => {
28
- const { token } = await httpRequest.json(`${AUTH_ENDPOINT}/google/auth?state=${cred.state}&code=${cred.code}&scope=${cred.scope}`);
34
+ onSuccess: async (res) => {
35
+ const { token } = await httpRequest.json(`${AUTH_ENDPOINT}/google/auth?state=${res.state}&code=${res.code}&scope=${res.scope}`);
29
36
  signIn.mutate({
30
37
  type: 'SOCIALS',
31
38
  token,
32
- }, {
33
- onError: () => {
34
- toaster.error({
35
- title: 'Account Not Found',
36
- description: 'The Google account you used isn’t connected to any existing account in our system. Please connect it to continue.',
37
- });
38
- },
39
39
  });
40
40
  },
41
41
  });
42
42
  return (_jsx(ark.button, { type: "button", onClick: (e) => {
43
43
  onClick?.(e);
44
44
  signInGoogle();
45
- }, asChild: !children ? true : asChild, ...props, children: children ?? (_jsxs(Button, { variant: "outline", colorScheme: "gray", className: "bg-bg-primary", children: [_jsx(GoogleIcon, { className: "size-6" }), "Continue with Google"] })) }));
45
+ }, 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"] })) }));
46
46
  };
@@ -229,7 +229,6 @@ export function SignUpDefaultForm() {
229
229
  mobileNumber: mobileNumberParser.format(mobileNumber),
230
230
  verificationCode: verificationCode.join(''),
231
231
  referralCode: search.get('referralCode') ?? undefined,
232
- btag: search.get('btag') ?? undefined,
233
232
  });
234
233
  const name = mobileNumberParser.format(mobileNumber);
235
234
  const password = `${name}${id}`;
@@ -314,7 +314,6 @@ export function SignUpKYCForm() {
314
314
  mobileNumber: mobileNumberParser.format(mobileNumber),
315
315
  verificationCode: verificationCode.join(''),
316
316
  referralCode: search.get('referralCode') ?? undefined,
317
- btag: search.get('btag') ?? undefined,
318
317
  });
319
318
  const name = mobileNumberParser.format(mobileNumber);
320
319
  const password = `${name}${id}`;
@@ -1,5 +1,6 @@
1
1
  export declare const ACCESS_TOKEN_COOKIE_NAME: string;
2
2
  export declare const REFRESH_TOKEN_COOKIE_NAME: string;
3
3
  export declare const DOMAIN_COOKIE_NAME: string;
4
- export declare const FEATURE_FLAG_LOCAL_STORAGE_KEY: string;
4
+ export declare const BTAG_COOKIE_NAME: string;
5
5
  export declare const CELLXPERT_CXD_COOKIE_NAME: string;
6
+ export declare const FEATURE_FLAG_LOCAL_STORAGE_KEY: string;
@@ -1,5 +1,6 @@
1
1
  export const ACCESS_TOKEN_COOKIE_NAME = 'WebPortalAuthAccessToken';
2
2
  export const REFRESH_TOKEN_COOKIE_NAME = 'WebPortalAuthRefreshToken';
3
3
  export const DOMAIN_COOKIE_NAME = 'WebPortalDomain';
4
- export const FEATURE_FLAG_LOCAL_STORAGE_KEY = 'WebPortalFeatureFlag';
4
+ export const BTAG_COOKIE_NAME = 'WebPortalBtag';
5
5
  export const CELLXPERT_CXD_COOKIE_NAME = 'WebPortalCellxpertCxd';
6
+ export const FEATURE_FLAG_LOCAL_STORAGE_KEY = 'WebPortalFeatureFlag';
@@ -1,11 +1,12 @@
1
1
  import { addMinutes } from 'date-fns';
2
2
  import { NextResponse } from 'next/server';
3
- import { ACCESS_TOKEN_COOKIE_NAME, CELLXPERT_CXD_COOKIE_NAME, DOMAIN_COOKIE_NAME, REFRESH_TOKEN_COOKIE_NAME, } from '../constants/index.js';
3
+ import { ACCESS_TOKEN_COOKIE_NAME, BTAG_COOKIE_NAME, CELLXPERT_CXD_COOKIE_NAME, DOMAIN_COOKIE_NAME, REFRESH_TOKEN_COOKIE_NAME, } from '../constants/index.js';
4
4
  import { refreshSession } from '../services/auth.js';
5
5
  export async function getSession(request) {
6
6
  const accessToken = request.cookies.get(ACCESS_TOKEN_COOKIE_NAME)?.value;
7
7
  const refreshToken = request.cookies.get(REFRESH_TOKEN_COOKIE_NAME)?.value;
8
8
  const domain = request.cookies.get(DOMAIN_COOKIE_NAME)?.value;
9
+ const btag = request.cookies.get(BTAG_COOKIE_NAME)?.value;
9
10
  const cellxpertCxd = request.cookies.get(CELLXPERT_CXD_COOKIE_NAME)?.value;
10
11
  if (!refreshToken) {
11
12
  const response = NextResponse.json({
@@ -13,6 +14,7 @@ export async function getSession(request) {
13
14
  data: {
14
15
  status: 'unauthenticated',
15
16
  domain,
17
+ btag,
16
18
  cellxpertCxd,
17
19
  },
18
20
  });
@@ -56,6 +58,7 @@ export async function getSession(request) {
56
58
  data: {
57
59
  status: 'unauthenticated',
58
60
  domain,
61
+ btag,
59
62
  cellxpertCxd,
60
63
  },
61
64
  });
@@ -6,26 +6,26 @@ interface Context {
6
6
  params: Promise<Params>;
7
7
  }
8
8
  export declare const GET: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
9
- ok: true;
10
- data?: never;
11
- } | {
12
9
  ok: false;
13
10
  message: string;
14
11
  __error?: unknown;
12
+ } | {
13
+ ok: true;
14
+ data: import("../types").Session;
15
15
  }> | NextResponse<{
16
+ ok: true;
17
+ data?: never;
18
+ } | {
16
19
  ok: false;
17
20
  message: string;
18
21
  __error?: unknown;
19
- } | {
20
- ok: true;
21
- data: Record<string, unknown>;
22
22
  }> | NextResponse<{
23
23
  ok: false;
24
24
  message: string;
25
25
  __error?: unknown;
26
26
  } | {
27
27
  ok: true;
28
- data: import("../types").Session;
28
+ data: Record<string, unknown>;
29
29
  }>>;
30
30
  export declare const DELETE: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
31
31
  ok: true;
@@ -1,9 +1,10 @@
1
1
  import { addDays, addHours } from 'date-fns';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
- import { CELLXPERT_CXD_COOKIE_NAME, DOMAIN_COOKIE_NAME } from '../constants/index.js';
4
+ import { BTAG_COOKIE_NAME, CELLXPERT_CXD_COOKIE_NAME, DOMAIN_COOKIE_NAME, } from '../constants/index.js';
5
5
  const UpdateSessionDefinition = z.object({
6
6
  domain: z.string().optional().nullable(),
7
+ btag: z.string().optional().nullable(),
7
8
  cellxpertCxd: z.string().optional().nullable(),
8
9
  });
9
10
  export async function patchSession(request) {
@@ -30,5 +31,12 @@ export async function patchSession(request) {
30
31
  sameSite: 'strict',
31
32
  });
32
33
  }
34
+ if (parsed.data.btag) {
35
+ response.cookies.set(BTAG_COOKIE_NAME, parsed.data.btag, {
36
+ expires: addDays(new Date(), 30),
37
+ httpOnly: true,
38
+ sameSite: 'strict',
39
+ });
40
+ }
33
41
  return response;
34
42
  }
@@ -37,6 +37,7 @@ export interface RegisterMemberAccountMutationVariables {
37
37
  password: string;
38
38
  mobileNumber: string;
39
39
  birthDay: string;
40
+ /** @deprecated Attach domain as header instead */
40
41
  domain?: string;
41
42
  btag?: string;
42
43
  };
@@ -53,6 +54,7 @@ export interface RegisterMemberAccountViaMobileMutationVariables {
53
54
  id: string;
54
55
  mobileNumber: string;
55
56
  btag?: string;
57
+ /** @deprecated Attach domain as header instead */
56
58
  domain?: string;
57
59
  cellxpertCxd?: string;
58
60
  };
@@ -91,6 +93,7 @@ export interface RegisterMemberAccountMutationVariables__Next {
91
93
  name: string;
92
94
  password: string;
93
95
  mobileNumber?: string;
96
+ /** @deprecated Attach domain as header instead */
94
97
  domain?: string;
95
98
  btag?: string;
96
99
  };
@@ -331,6 +334,7 @@ export interface RegisterMayaMemberAccountMutationVariables {
331
334
  input: {
332
335
  name: string;
333
336
  password: string;
337
+ /** @deprecated Attach domain as header instead */
334
338
  domain?: string;
335
339
  };
336
340
  }
@@ -7,13 +7,15 @@ import type { ImageProps } from 'next/image';
7
7
  */
8
8
  export type Session = {
9
9
  status: 'authenticated';
10
- domain?: string;
11
10
  token: string;
12
- cellxpertCxd?: string;
11
+ domain?: string;
12
+ btag?: never;
13
+ cellxpertCxd?: never;
13
14
  } | {
14
15
  status: 'unauthenticated';
15
- domain?: string;
16
16
  token?: never;
17
+ domain?: string;
18
+ btag?: string;
17
19
  cellxpertCxd?: string;
18
20
  };
19
21
  /**