@opexa/portal-components 0.0.323 → 0.0.325

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 (87) hide show
  1. package/dist/client/hooks/useSignUpMutation.d.ts +1 -1
  2. package/dist/client/hooks/useSignUpMutation.js +6 -1
  3. package/dist/client/hooks/useUpdateSessionMutation.js +12 -4
  4. package/dist/client/services/getSession.js +1 -1
  5. package/dist/client/services/updateSession.d.ts +1 -0
  6. package/dist/components/AccountInfo/AccountInfo.js +1 -1
  7. package/dist/components/Disclaimer/DisclaimerV1.d.ts +1 -0
  8. package/dist/components/Disclaimer/DisclaimerV1.js +8 -9
  9. package/dist/components/PortalProvider/PortalProvider.js +4 -5
  10. package/dist/components/PortalProvider/SetupCellxpertCxd.d.ts +1 -0
  11. package/dist/components/PortalProvider/SetupCellxpertCxd.js +28 -0
  12. package/dist/constants/StorageKey.d.ts +1 -0
  13. package/dist/constants/StorageKey.js +1 -0
  14. package/dist/handlers/getSession.d.ts +1 -1
  15. package/dist/handlers/getSession.js +5 -2
  16. package/dist/handlers/index.d.ts +7 -7
  17. package/dist/handlers/patchSession.js +10 -2
  18. package/dist/services/account.d.ts +2 -1
  19. package/dist/types/index.d.ts +5 -3
  20. package/dist/ui/Badge/Badge.d.ts +12 -12
  21. package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
  22. package/dist/ui/Badge/badge.recipe.d.ts +3 -3
  23. package/dist/ui/Carousel/Carousel.d.ts +45 -45
  24. package/dist/ui/Carousel/carousel.recipe.d.ts +5 -5
  25. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  26. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  27. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  28. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  29. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  30. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  31. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  32. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  33. package/dist/ui/Menu/Menu.d.ts +144 -144
  34. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  35. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  36. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  37. package/dist/ui/Popover/Popover.d.ts +55 -55
  38. package/dist/ui/Popover/popover.recipe.d.ts +5 -5
  39. package/dist/ui/Progress/Progress.d.ts +27 -27
  40. package/dist/ui/Progress/progress.recipe.d.ts +3 -3
  41. package/dist/ui/QrCode/QrCode.d.ts +25 -25
  42. package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
  43. package/dist/ui/Select/Select.d.ts +45 -45
  44. package/dist/ui/Select/select.recipe.d.ts +3 -3
  45. package/dist/ui/Table/Table.d.ts +21 -21
  46. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  47. package/dist/ui/Table/table.recipe.d.ts +3 -3
  48. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  49. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  50. package/package.json +1 -1
  51. package/dist/components/Banner/Banner.client.d.ts +0 -12
  52. package/dist/components/Banner/Banner.client.js +0 -49
  53. package/dist/components/DigitainLauncher/Loading.d.ts +0 -1
  54. package/dist/components/DigitainLauncher/Loading.js +0 -5
  55. package/dist/components/KYC/BasicInformation.d.ts +0 -1
  56. package/dist/components/KYC/BasicInformation.js +0 -101
  57. package/dist/components/KYC/IdentityVerification.d.ts +0 -1
  58. package/dist/components/KYC/IdentityVerification.js +0 -120
  59. package/dist/components/KYC/Indicator.d.ts +0 -1
  60. package/dist/components/KYC/Indicator.js +0 -8
  61. package/dist/components/KYC/KYC.lazy.d.ts +0 -6
  62. package/dist/components/KYC/KYC.lazy.js +0 -45
  63. package/dist/components/KYC/KYCContext.d.ts +0 -6
  64. package/dist/components/KYC/KYCContext.js +0 -2
  65. package/dist/components/KYC/PersonalInformation.d.ts +0 -1
  66. package/dist/components/KYC/PersonalInformation.js +0 -122
  67. package/dist/components/KYC/useKYC.d.ts +0 -25
  68. package/dist/components/KYC/useKYC.js +0 -38
  69. package/dist/components/SignIn/utils.d.ts +0 -8
  70. package/dist/components/SignIn/utils.js +0 -26
  71. package/dist/constants/Branches.d.ts +0 -2
  72. package/dist/constants/Branches.js +0 -42
  73. package/dist/images/responsible-gaming-yellow.png +0 -0
  74. package/dist/third-parties/FacebookPixel/FacebookPixel.d.ts +0 -4
  75. package/dist/third-parties/FacebookPixel/FacebookPixel.js +0 -4
  76. package/dist/third-parties/FacebookPixel/api.d.ts +0 -0
  77. package/dist/third-parties/FacebookPixel/api.js +0 -1
  78. package/dist/third-parties/FacebookPixel/index.d.ts +0 -1
  79. package/dist/third-parties/FacebookPixel/index.js +0 -1
  80. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.d.ts +0 -4
  81. package/dist/third-parties/GoogleRecaptcha/GoogleRecaptcha.js +0 -4
  82. package/dist/third-parties/GoogleRecaptcha/api.d.ts +0 -0
  83. package/dist/third-parties/GoogleRecaptcha/api.js +0 -1
  84. package/dist/third-parties/GoogleRecaptcha/index.d.ts +0 -1
  85. package/dist/third-parties/GoogleRecaptcha/index.js +0 -1
  86. package/dist/third-parties/index.d.ts +0 -2
  87. package/dist/third-parties/index.js +0 -2
@@ -1,5 +1,5 @@
1
1
  import { type RegisterMemberAccountViaMobileInput } from '../../services/account';
2
2
  import type { Mutation } from '../../types';
3
- export interface SignUpMutationInput extends Omit<RegisterMemberAccountViaMobileInput, 'domain'> {
3
+ export interface SignUpMutationInput extends Omit<RegisterMemberAccountViaMobileInput, 'domain' | 'cellxpertCxd'> {
4
4
  }
5
5
  export declare const useSignUpMutation: Mutation<void, SignUpMutationInput>;
@@ -8,7 +8,12 @@ export const useSignUpMutation = (config) => {
8
8
  mutationKey: getSignUpMutationKey(),
9
9
  mutationFn: async (input) => {
10
10
  const session = await getSession();
11
- return await registerMemberAccountViaMobile(input, {
11
+ return await registerMemberAccountViaMobile({
12
+ ...input,
13
+ ...(session.cellxpertCxd && {
14
+ cellxpertCxd: session.cellxpertCxd,
15
+ }),
16
+ }, {
12
17
  headers: {
13
18
  ...(session.domain && {
14
19
  Domain: session.domain,
@@ -13,11 +13,19 @@ export const useUpdateSessionMutation = (config) => {
13
13
  queryClient.setQueryData(getSessionQueryKey(), (prev) => {
14
14
  if (!prev)
15
15
  return prev;
16
- if (!input.domain)
17
- return prev;
16
+ const domain = input.domain ?? prev.domain;
17
+ const cellxpertCxd = input.cellxpertCxd ?? prev.cellxpertCxd;
18
+ if (prev.status === 'unauthenticated') {
19
+ return {
20
+ status: 'unauthenticated',
21
+ domain,
22
+ cellxpertCxd,
23
+ };
24
+ }
18
25
  return {
19
- ...prev,
20
- ...input,
26
+ status: 'authenticated',
27
+ token: prev.token,
28
+ domain,
21
29
  };
22
30
  });
23
31
  return ok;
@@ -2,5 +2,5 @@ import { cache } from 'react';
2
2
  import { httpRequest, } from '../../services/httpRequest.js';
3
3
  export const getSession = cache(async (options) => {
4
4
  const res = await httpRequest.json('/api/sessions', options);
5
- return res.ok ? res.data : { status: 'unauthenticated', domain: null };
5
+ return res.ok ? res.data : { status: 'unauthenticated' };
6
6
  });
@@ -1,5 +1,6 @@
1
1
  import { type HttpRequestOptions } from '../../services/httpRequest';
2
2
  export interface UpdateSessionInput {
3
3
  domain?: string;
4
+ cellxpertCxd?: string;
4
5
  }
5
6
  export declare const updateSession: (input: UpdateSessionInput, options?: HttpRequestOptions) => Promise<boolean>;
@@ -24,7 +24,7 @@ export function AccountInfo(props) {
24
24
  function ProfileInfo() {
25
25
  const accountQuery = useAccountQuery();
26
26
  const account = accountQuery.data;
27
- return (_jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Profile Info" }), _jsxs("div", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt", children: [_jsx("div", { className: "border-border-secondary border-b px-4 py-5", children: _jsxs("div", { className: "flex items-center gap-xl", children: [_jsx(Image, { src: avatar, alt: "", width: 80, height: 80, className: "size-14 shrink-0 rounded-md object-cover" }), _jsxs("div", { children: [_jsx("h3", { className: "font-semibold text-lg text-text-secondary-700 leading-tight", children: account?.name }), _jsx("p", { className: "text-text-tertiary-600 leading-tight", children: account?.id })] })] }) }), _jsx("div", { className: "flex justify-end px-xl py-lg", children: _jsx(Button, { size: "sm", variant: "outline", fullWidth: false, children: "Upload New Avatar" }) })] })] }));
27
+ return (_jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Profile Info" }), _jsx("div", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt", children: _jsx("div", { className: 'border-border-secondary px-4 py-5', children: _jsxs("div", { className: "flex items-center gap-xl", children: [_jsx(Image, { src: avatar, alt: "", width: 80, height: 80, className: "size-14 shrink-0 rounded-md object-cover" }), _jsxs("div", { children: [_jsx("h3", { className: "font-semibold text-lg text-text-secondary-700 leading-tight", children: account?.name }), _jsx("p", { className: "text-text-tertiary-600 leading-tight", children: account?.id })] })] }) }) })] }));
28
28
  }
29
29
  function PersonalInfo() {
30
30
  const accountQuery = useAccountQuery();
@@ -2,6 +2,7 @@ import type { ImageProps } from 'next/image';
2
2
  export interface DisclaimerV1Props {
3
3
  version: '1';
4
4
  logo: ImageProps['src'];
5
+ siteName: string;
5
6
  termsOfUseUrl?: string;
6
7
  }
7
8
  export declare function DisclaimerV1(props: DisclaimerV1Props): import("react/jsx-runtime").JSX.Element;
@@ -3,7 +3,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import Image from 'next/image';
4
4
  import Link from 'next/link';
5
5
  import { useRef, useState } from 'react';
6
- import { useTimeout } from 'usehooks-ts';
7
6
  import { useShallow } from 'zustand/shallow';
8
7
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
9
8
  import { AlertCircleIcon } from '../../icons/AlertCircleIcon.js';
@@ -25,7 +24,6 @@ export function DisclaimerV1(props) {
25
24
  })));
26
25
  const checked = globalStore.termsOfUse.accepted;
27
26
  const [warn, setWarn] = useState(false);
28
- useTimeout(() => setWarn(false), warn ? 5000 : null);
29
27
  return (_jsx(Dialog.Root, { open: disclaimer.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, initialFocusEl: () => acceptTriggerRef.current, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+1)]" }), _jsx(Dialog.Positioner, { className: "!z-[calc(var(--z-dialog)+2)]", children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start overflow-y-auto p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx("button", { type: "button", onClick: () => {
30
28
  if (!checked) {
31
29
  setWarn(true);
@@ -33,13 +31,14 @@ export function DisclaimerV1(props) {
33
31
  else {
34
32
  disclaimer.close();
35
33
  }
36
- }, className: "absolute top-6.5 right-6.5", "aria-label": "Close", children: _jsx(XIcon, { className: "size-6 text-text-quinary" }) }), _jsx(Image, { src: props.logo, alt: "", width: 142, height: 30, className: "mx-auto h-auto w-[8.875rem]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 74, width: 88, className: "h-[5.5rem] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 185, className: "h-[3.875rem] w-auto shrink-0", draggable: false })] }), _jsx("p", { className: "mt-4 text-center text-sm", children: "The following individuals are prohibited from registering or participating in this online gaming platform." }), _jsx("div", { className: "mt-5", children: _jsx("ul", { className: "space-y-1", children: items.map((item, index) => (_jsxs("li", { className: "flex items-start gap-md text-sm text-text-secondary-700", children: [_jsx("div", { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full bg-bg-brand-solid", children: _jsx("div", { className: "size-1.5 rounded-full bg-cyan-950" }) }), item] }, index))) }) }), _jsx(Field.Root, { invalid: warn, className: "mt-2xl", children: _jsxs(Checkbox.Root, { checked: checked, onCheckedChange: (e) => {
37
- if (e.checked === 'indeterminate')
38
- return;
39
- globalStore.termsOfUse.setAccepted(e.checked);
40
- }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs("div", { className: "!text-sm !leading-tight", children: [_jsxs(Checkbox.Label, { className: "text-sm leading-tight", children: ["I am at least 21 years of age, I accept the", ' ', _jsx(Link, { href: props.termsOfUseUrl ?? '/terms-of-use', className: "text-brand-400 underline underline-offset-2", onClick: () => {
41
- globalStore.termsOfUse.setOpen(false);
42
- }, children: "Terms of Use" }), ' ', "and I am not playing in open or public space."] }), _jsxs(Field.ErrorText, { className: "mt-0 flex items-center gap-1 text-xs leading-none", children: [_jsx(AlertCircleIcon, { className: "size-3.5 text-error-400" }), "You must accept the Terms of Use to continue."] })] }), _jsx(Checkbox.HiddenInput, {})] }) }), _jsx("p", { className: "mt-2xl text-center text-sm", children: "Funds or credits in the account of any individual found ineligible to participate will be forfeited and turned over to the government as required by law." })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, disabled: !checked, children: "Accept" }), _jsx(Button, { variant: "outline", type: "button", className: "mt-lg", onClick: () => {
34
+ }, className: "absolute top-6.5 right-6.5", "aria-label": "Close", children: _jsx(XIcon, { className: "size-6 text-text-quinary" }) }), _jsx(Image, { src: props.logo, alt: "", width: 142, height: 30, className: "mx-auto h-auto w-[8.875rem]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 74, width: 88, className: "h-[5.5rem] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 185, className: "h-[3.875rem] w-auto shrink-0", draggable: false })] }), _jsx("p", { className: "mt-4 text-center text-sm", children: "The following individuals are prohibited from registering or participating in this online gaming platform." }), _jsx("div", { className: "mt-5", children: _jsx("ul", { className: "space-y-1", children: items.map((item, index) => (_jsxs("li", { className: "flex items-start gap-md text-sm text-text-secondary-700", children: [_jsx("div", { className: "mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full bg-bg-brand-solid", children: _jsx("div", { className: "size-1.5 rounded-full bg-cyan-950" }) }), item] }, index))) }) }), _jsxs(Field.Root, { invalid: warn, className: "mt-2xl", children: [_jsxs(Checkbox.Root, { checked: checked, onCheckedChange: (e) => {
35
+ if (e.checked === 'indeterminate')
36
+ return;
37
+ globalStore.termsOfUse.setAccepted(e.checked);
38
+ setWarn(!e.checked);
39
+ }, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsxs(Checkbox.Label, { className: "text-sm", children: ["I am at least 21 years of age, I accept the", ' ', _jsx(Link, { href: props.termsOfUseUrl ?? '/terms-of-use', className: "text-brand-400 underline underline-offset-2", onClick: () => {
40
+ globalStore.termsOfUse.setOpen(false);
41
+ }, children: "Terms of Use" }), ' ', "and I am not playing in open or public space."] }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Field.ErrorText, { className: "!mt-2xl flex items-center justify-center gap-2 text-error-600 text-sm", children: [_jsx(AlertCircleIcon, { className: "size-4 shrink-0 text-error-600" }), "Please agree to ", props.siteName, "\u2019s Terms of Use to proceed."] })] }), _jsx("p", { className: "mt-2xl text-center text-sm", children: "Funds or credits in the account of any individual found ineligible to participate will be forfeited and turned over to the government as required by law." })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, disabled: !checked, children: "Accept" }), _jsx(Button, { variant: "outline", type: "button", className: "mt-lg", onClick: () => {
43
42
  if (!checked) {
44
43
  setWarn(true);
45
44
  }
@@ -1,7 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { dehydrate, HydrationBoundary } from '@tanstack/react-query';
3
- import { Suspense } from 'react';
4
- import { INTERNALS__REPORT_WEB_VITALS } from '../../constants/index.js';
3
+ import { Fragment, Suspense } from 'react';
5
4
  import { prefetchAccountQuery } from '../../server/utils/prefetchAccountQuery.js';
6
5
  import { prefetchPlatformQuery } from '../../server/utils/prefetchPlatformQuery.js';
7
6
  import { prefetchSessionQuery } from '../../server/utils/prefetchSessionQuery.js';
@@ -9,9 +8,9 @@ import { prefetchWalletQuery } from '../../server/utils/prefetchWalletQuery.js';
9
8
  import { getQueryClient } from '../../utils/getQueryClient.js';
10
9
  import { FeatureFlag } from './FeatureFlag.js';
11
10
  import { Providers } from './Providers.js';
11
+ import { SetupCellxpertCxd } from './SetupCellxpertCxd.js';
12
12
  import { SetupDomain } from './SetupDomain.js';
13
13
  import { Snackbar } from './Snackbar.js';
14
- import { WebVitals } from './WebVitals.js';
15
14
  export async function PortalProvider({ recaptchaSiteKey, children, }) {
16
15
  const queryClient = getQueryClient();
17
16
  await Promise.allSettled([
@@ -20,5 +19,5 @@ export async function PortalProvider({ recaptchaSiteKey, children, }) {
20
19
  prefetchAccountQuery(),
21
20
  prefetchWalletQuery(),
22
21
  ]);
23
- return (_jsxs(_Fragment, { children: [INTERNALS__REPORT_WEB_VITALS && _jsx(WebVitals, {}), _jsx(Providers, { recaptchaSiteKey: recaptchaSiteKey, children: _jsxs(HydrationBoundary, { state: dehydrate(queryClient), children: [children, _jsx(Suspense, { fallback: null, children: _jsx(SetupDomain, {}) })] }) }), _jsx(Snackbar, {}), _jsx(Suspense, { fallback: null, children: _jsx(FeatureFlag, {}) })] }));
22
+ return (_jsxs(Fragment, { children: [_jsx(Providers, { recaptchaSiteKey: recaptchaSiteKey, children: _jsxs(HydrationBoundary, { state: dehydrate(queryClient), children: [children, _jsx(Suspense, { children: _jsx(SetupDomain, {}) }), _jsx(Suspense, { children: _jsx(SetupCellxpertCxd, {}) })] }) }), _jsx(Snackbar, {}), _jsx(Suspense, { children: _jsx(FeatureFlag, {}) })] }));
24
23
  }
@@ -0,0 +1 @@
1
+ export declare function SetupCellxpertCxd(): null;
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { useSearchParams } from 'next/navigation';
3
+ import { useTimeout } from 'usehooks-ts';
4
+ import { z } from 'zod';
5
+ import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
6
+ import { useUpdateSessionMutation } from '../../client/hooks/useUpdateSessionMutation.js';
7
+ const CellxpertCxdSchema = z
8
+ .string()
9
+ .min(200)
10
+ .trim()
11
+ .optional()
12
+ .nullable()
13
+ .catch(null);
14
+ export function SetupCellxpertCxd() {
15
+ const query = useSessionQuery();
16
+ const mutation = useUpdateSessionMutation();
17
+ const params = useSearchParams();
18
+ useTimeout(() => {
19
+ const oldValue = query.data?.cellxpertCxd;
20
+ const newValue = CellxpertCxdSchema.parse(params.get('cxd'));
21
+ if (oldValue === newValue)
22
+ return;
23
+ if (!newValue)
24
+ return;
25
+ mutation.mutate({ cellxpertCxd: newValue });
26
+ }, query.data?.status !== 'unauthenticated' ? null : 1000);
27
+ return null;
28
+ }
@@ -2,3 +2,4 @@ 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
4
  export declare const FEATURE_FLAG_LOCAL_STORAGE_KEY: string;
5
+ export declare const CELLXPERT_CXD_COOKIE_NAME: string;
@@ -2,3 +2,4 @@ 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
4
  export const FEATURE_FLAG_LOCAL_STORAGE_KEY = 'WebPortalFeatureFlag';
5
+ export const CELLXPERT_CXD_COOKIE_NAME = 'WebPortalCellxpertCxd';
@@ -1,4 +1,4 @@
1
- import { NextResponse, type NextRequest } from 'next/server';
1
+ import { type NextRequest, NextResponse } from 'next/server';
2
2
  import type { Session } from '../types';
3
3
  export declare function getSession(request: NextRequest): Promise<NextResponse<{
4
4
  ok: false;
@@ -1,17 +1,19 @@
1
1
  import { addMinutes } from 'date-fns';
2
2
  import { NextResponse } from 'next/server';
3
- import { ACCESS_TOKEN_COOKIE_NAME, DOMAIN_COOKIE_NAME, REFRESH_TOKEN_COOKIE_NAME, } from '../constants/index.js';
3
+ import { ACCESS_TOKEN_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 cellxpertCxd = request.cookies.get(CELLXPERT_CXD_COOKIE_NAME)?.value;
9
10
  if (!refreshToken) {
10
11
  const response = NextResponse.json({
11
12
  ok: true,
12
13
  data: {
13
- domain,
14
14
  status: 'unauthenticated',
15
+ domain,
16
+ cellxpertCxd,
15
17
  },
16
18
  });
17
19
  response.cookies.delete(ACCESS_TOKEN_COOKIE_NAME);
@@ -46,6 +48,7 @@ export async function getSession(request) {
46
48
  data: {
47
49
  status: 'unauthenticated',
48
50
  domain,
51
+ cellxpertCxd,
49
52
  },
50
53
  });
51
54
  response.cookies.delete(REFRESH_TOKEN_COOKIE_NAME);
@@ -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
- import { addDays } from 'date-fns';
1
+ import { addDays, addHours } from 'date-fns';
2
2
  import { NextResponse } from 'next/server';
3
3
  import { z } from 'zod';
4
- import { DOMAIN_COOKIE_NAME } from '../constants/index.js';
4
+ import { 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
+ cellxpertCxd: z.string().optional().nullable(),
7
8
  });
8
9
  export async function patchSession(request) {
9
10
  const body = await request.json();
@@ -22,5 +23,12 @@ export async function patchSession(request) {
22
23
  sameSite: 'strict',
23
24
  });
24
25
  }
26
+ if (parsed.data.cellxpertCxd) {
27
+ response.cookies.set(CELLXPERT_CXD_COOKIE_NAME, parsed.data.cellxpertCxd, {
28
+ expires: addHours(new Date(), 6),
29
+ httpOnly: true,
30
+ sameSite: 'strict',
31
+ });
32
+ }
25
33
  return response;
26
34
  }
@@ -52,8 +52,9 @@ export interface RegisterMemberAccountViaMobileMutationVariables {
52
52
  input: {
53
53
  id: string;
54
54
  mobileNumber: string;
55
- domain?: string;
56
55
  btag?: string;
56
+ domain?: string;
57
+ cellxpertCxd?: string;
57
58
  };
58
59
  referralCode?: string;
59
60
  verificationCode?: string;
@@ -7,12 +7,14 @@ import type { ImageProps } from 'next/image';
7
7
  */
8
8
  export type Session = {
9
9
  status: 'authenticated';
10
- domain?: string | null;
10
+ domain?: string;
11
11
  token: string;
12
+ cellxpertCxd?: string;
12
13
  } | {
13
14
  status: 'unauthenticated';
14
- domain?: string | null;
15
- token?: null;
15
+ domain?: string;
16
+ token?: never;
17
+ cellxpertCxd?: string;
16
18
  };
17
19
  /**
18
20
  * ------------------------------------------------------------
@@ -37,7 +37,7 @@ export declare const Root: import("react").ComponentType<import("@ark-ui/react")
37
37
  root: string;
38
38
  };
39
39
  };
40
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, {
40
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, {
41
41
  size: {
42
42
  md: {
43
43
  root: string;
@@ -72,7 +72,7 @@ export declare const Root: import("react").ComponentType<import("@ark-ui/react")
72
72
  root: string;
73
73
  };
74
74
  };
75
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, import("tailwind-variants").TVReturnType<{
75
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, import("tailwind-variants").TVReturnType<{
76
76
  size: {
77
77
  md: {
78
78
  root: string;
@@ -107,7 +107,7 @@ export declare const Root: import("react").ComponentType<import("@ark-ui/react")
107
107
  root: string;
108
108
  };
109
109
  };
110
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
110
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
111
111
  interface BadgeLabelProps extends ComponentPropsWithRef<'span'> {
112
112
  asChild?: boolean;
113
113
  }
@@ -146,7 +146,7 @@ export declare const Label: import("react").ComponentType<import("@ark-ui/react"
146
146
  root: string;
147
147
  };
148
148
  };
149
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, {
149
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, {
150
150
  size: {
151
151
  md: {
152
152
  root: string;
@@ -181,7 +181,7 @@ export declare const Label: import("react").ComponentType<import("@ark-ui/react"
181
181
  root: string;
182
182
  };
183
183
  };
184
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, import("tailwind-variants").TVReturnType<{
184
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, import("tailwind-variants").TVReturnType<{
185
185
  size: {
186
186
  md: {
187
187
  root: string;
@@ -216,7 +216,7 @@ export declare const Label: import("react").ComponentType<import("@ark-ui/react"
216
216
  root: string;
217
217
  };
218
218
  };
219
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
219
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
220
220
  interface BadgeIndicatorProps extends ComponentPropsWithRef<'svg'> {
221
221
  asChild?: boolean;
222
222
  }
@@ -255,7 +255,7 @@ export declare const Indicator: import("react").ComponentType<import("@ark-ui/re
255
255
  root: string;
256
256
  };
257
257
  };
258
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, {
258
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, {
259
259
  size: {
260
260
  md: {
261
261
  root: string;
@@ -290,7 +290,7 @@ export declare const Indicator: import("react").ComponentType<import("@ark-ui/re
290
290
  root: string;
291
291
  };
292
292
  };
293
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, import("tailwind-variants").TVReturnType<{
293
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, import("tailwind-variants").TVReturnType<{
294
294
  size: {
295
295
  md: {
296
296
  root: string;
@@ -325,7 +325,7 @@ export declare const Indicator: import("react").ComponentType<import("@ark-ui/re
325
325
  root: string;
326
326
  };
327
327
  };
328
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
328
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
329
329
  interface BadgeIconProps extends ComponentPropsWithRef<'svg'> {
330
330
  asChild?: boolean;
331
331
  }
@@ -364,7 +364,7 @@ export declare const Icon: import("react").ComponentType<import("@ark-ui/react")
364
364
  root: string;
365
365
  };
366
366
  };
367
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, {
367
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, {
368
368
  size: {
369
369
  md: {
370
370
  root: string;
@@ -399,7 +399,7 @@ export declare const Icon: import("react").ComponentType<import("@ark-ui/react")
399
399
  root: string;
400
400
  };
401
401
  };
402
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, import("tailwind-variants").TVReturnType<{
402
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, import("tailwind-variants").TVReturnType<{
403
403
  size: {
404
404
  md: {
405
405
  root: string;
@@ -434,5 +434,5 @@ export declare const Icon: import("react").ComponentType<import("@ark-ui/react")
434
434
  root: string;
435
435
  };
436
436
  };
437
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
437
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, unknown, unknown, undefined>>>>>;
438
438
  export {};
@@ -1 +1 @@
1
- export declare const badgeAnatomy: import("@ark-ui/react/anatomy").AnatomyInstance<"label" | "root" | "icon" | "indicator">;
1
+ export declare const badgeAnatomy: import("@ark-ui/react/anatomy").AnatomyInstance<"label" | "root" | "indicator" | "icon">;
@@ -33,7 +33,7 @@ export declare const badgeRecipe: import("tailwind-variants").TVReturnType<{
33
33
  root: string;
34
34
  };
35
35
  };
36
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, {
36
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, {
37
37
  size: {
38
38
  md: {
39
39
  root: string;
@@ -68,7 +68,7 @@ export declare const badgeRecipe: import("tailwind-variants").TVReturnType<{
68
68
  root: string;
69
69
  };
70
70
  };
71
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, import("tailwind-variants").TVReturnType<{
71
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, import("tailwind-variants").TVReturnType<{
72
72
  size: {
73
73
  md: {
74
74
  root: string;
@@ -103,4 +103,4 @@ export declare const badgeRecipe: import("tailwind-variants").TVReturnType<{
103
103
  root: string;
104
104
  };
105
105
  };
106
- }, Record<"label" | "root" | "icon" | "indicator", string | string[]>, undefined, unknown, unknown, undefined>>;
106
+ }, Record<"label" | "root" | "indicator" | "icon", string | string[]>, undefined, unknown, unknown, undefined>>;