@opexa/portal-components 0.0.106 → 0.0.108

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 (202) hide show
  1. package/dist/client/hooks/useAuthenticateMutation.js +2 -1
  2. package/dist/client/hooks/useCheckInDailyCheckInQuestMutation.d.ts +1 -1
  3. package/dist/client/hooks/useCheckInDailyCheckInQuestMutation.js +20 -2
  4. package/dist/client/hooks/useClaimCashbackBonusMutation.js +2 -1
  5. package/dist/client/hooks/useClaimSpotBonusMutation.js +2 -1
  6. package/dist/client/hooks/useCompleteOnboardingMutation.d.ts +3 -0
  7. package/dist/client/hooks/useCompleteOnboardingMutation.js +25 -0
  8. package/dist/client/hooks/useCreateGCashDepositMutation.js +2 -1
  9. package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +1 -1
  10. package/dist/client/hooks/useCreateGameSessionMutation.js +1 -1
  11. package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +1 -1
  12. package/dist/client/hooks/useCreateMayaAppDepositMutation.js +2 -1
  13. package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +1 -1
  14. package/dist/client/hooks/useCreateMayaDepositMutation.js +2 -1
  15. package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +1 -1
  16. package/dist/client/hooks/useCreateMemberVerificationMutation.d.ts +4 -0
  17. package/dist/client/hooks/useCreateMemberVerificationMutation.js +45 -0
  18. package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +2 -1
  19. package/dist/client/hooks/useCreateQRPHDepositMutation.js +2 -1
  20. package/dist/client/hooks/useEndGameSessionMutation.js +1 -1
  21. package/dist/client/hooks/useFileQuery.d.ts +2 -0
  22. package/dist/client/hooks/useFileQuery.js +30 -0
  23. package/dist/client/hooks/useMarkGameAsFavoriteMutation.js +24 -5
  24. package/dist/client/hooks/useMarkMessageAsReadMutation.js +16 -7
  25. package/dist/client/hooks/useOnboardingStatusQuery.d.ts +2 -0
  26. package/dist/client/hooks/useOnboardingStatusQuery.js +28 -0
  27. package/dist/client/hooks/useRecommendedGamesQuery.d.ts +2 -0
  28. package/dist/client/hooks/useRecommendedGamesQuery.js +27 -0
  29. package/dist/client/hooks/useSendVerificationCodeMutation.js +1 -1
  30. package/dist/client/hooks/useSignInMutation.js +2 -1
  31. package/dist/client/hooks/useSignOutMutation.js +2 -1
  32. package/dist/client/hooks/useSignUpMutation.js +1 -1
  33. package/dist/client/hooks/useSiteQuery.d.ts +2 -0
  34. package/dist/client/hooks/useSiteQuery.js +16 -0
  35. package/dist/client/hooks/useSkipOnboardingMutation.d.ts +2 -0
  36. package/dist/client/hooks/useSkipOnboardingMutation.js +25 -0
  37. package/dist/client/hooks/useUnmarkGameAsFavoriteMutation.js +5 -5
  38. package/dist/client/hooks/useUpdateAccountMutation.js +2 -1
  39. package/dist/client/hooks/useUpdateMemberVerificationMutation.d.ts +6 -0
  40. package/dist/client/hooks/useUpdateMemberVerificationMutation.js +38 -0
  41. package/dist/client/hooks/useUploadImageFileMutation.d.ts +4 -0
  42. package/dist/client/hooks/useUploadImageFileMutation.js +24 -0
  43. package/dist/client/utils/createContext.js +1 -1
  44. package/dist/client/utils/createRecipeContext.js +1 -1
  45. package/dist/components/BetRecords/BetRecords.client.js +1 -1
  46. package/dist/components/Bonuses/Bonuses.client.js +1 -1
  47. package/dist/components/Disclaimer/DisclaimerV1.js +1 -1
  48. package/dist/components/Games/Game.js +1 -1
  49. package/dist/components/Games/GamesCarousel.client.js +1 -1
  50. package/dist/components/Games/GamesList.client.js +1 -1
  51. package/dist/components/Jackpots/JackpotsList/JackpotsList.d.ts +1 -0
  52. package/dist/components/Jackpots/JackpotsList/JackpotsList.js +1 -1
  53. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.d.ts +2 -1
  54. package/dist/components/Jackpots/JackpotsList/JackpotsListItemDesktop.js +3 -3
  55. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.d.ts +2 -1
  56. package/dist/components/Jackpots/JackpotsList/JackpotsListItemMobile.js +2 -2
  57. package/dist/components/KYC/BasicInformation.js +85 -4
  58. package/dist/components/KYC/CaptureIdDocument.d.ts +1 -0
  59. package/dist/components/KYC/CaptureIdDocument.js +11 -0
  60. package/dist/components/KYC/CaptureSelfie.d.ts +1 -0
  61. package/dist/components/KYC/CaptureSelfie.js +11 -0
  62. package/dist/components/KYC/IdentityVerification.js +20 -4
  63. package/dist/components/KYC/Indicator.js +1 -1
  64. package/dist/components/KYC/KYC.lazy.js +7 -1
  65. package/dist/components/KYC/PersonalInformation.js +92 -5
  66. package/dist/components/KYC/useKYC.d.ts +15 -0
  67. package/dist/components/KYC/useKYC.js +18 -1
  68. package/dist/components/Messages/Messages.lazy.js +1 -1
  69. package/dist/components/News/News.d.ts +10 -0
  70. package/dist/components/News/News.js +10 -0
  71. package/dist/components/News/index.d.ts +1 -0
  72. package/dist/components/News/index.js +1 -0
  73. package/dist/components/NewsFeed/NewsFeed.d.ts +18 -0
  74. package/dist/components/NewsFeed/NewsFeed.js +11 -0
  75. package/dist/components/NewsFeed/index.d.ts +1 -0
  76. package/dist/components/NewsFeed/index.js +1 -0
  77. package/dist/components/Promos/PromosCarousel.js +1 -1
  78. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +1 -4
  79. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +28 -25
  80. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestRules.d.ts +6 -0
  81. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestRules.js +15 -0
  82. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +1 -4
  83. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.js +27 -3
  84. package/dist/components/Quests/OnboardingQuest/OnboardingQuestRules.d.ts +6 -0
  85. package/dist/components/Quests/OnboardingQuest/OnboardingQuestRules.js +15 -0
  86. package/dist/components/Quests/Quests.client.js +22 -7
  87. package/dist/components/Quests/QuestsContext.d.ts +2 -0
  88. package/dist/components/Quests/QuestsContext.js +2 -0
  89. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +1 -4
  90. package/dist/components/Quests/WageringQuest/WageringQuest.js +12 -9
  91. package/dist/components/Quests/WageringQuest/WageringQuestRules.d.ts +7 -0
  92. package/dist/components/Quests/WageringQuest/WageringQuestRules.js +17 -0
  93. package/dist/components/Search/Search.lazy.d.ts +8 -0
  94. package/dist/components/Search/Search.lazy.js +8 -3
  95. package/dist/components/SignIn/MobileNumberSignIn.js +7 -4
  96. package/dist/components/SignIn/NameAndPasswordSignIn.js +10 -5
  97. package/dist/components/SignUp/SignUpForm.js +13 -7
  98. package/dist/components/TransactionRecords/DepositRecordsTable.js +1 -1
  99. package/dist/components/TransactionRecords/TransactionRecordsTable.js +1 -1
  100. package/dist/components/TransactionRecords/WithdrawalRecordsTable.js +1 -1
  101. package/dist/constants/{endpoints.js → Endpoint.js} +1 -1
  102. package/dist/constants/index.d.ts +7 -7
  103. package/dist/constants/index.js +7 -7
  104. package/dist/server/utils/prefetchAccountQuery.js +5 -2
  105. package/dist/server/utils/prefetchAvailablePromosQuery.js +5 -2
  106. package/dist/server/utils/prefetchAvailableQuestsCountQuery.js +5 -2
  107. package/dist/server/utils/prefetchAvailableQuestsQuery.js +5 -2
  108. package/dist/server/utils/prefetchBetRecordsQuery.js +5 -2
  109. package/dist/server/utils/prefetchBonusQuery.js +5 -2
  110. package/dist/server/utils/prefetchBonusesCountQuery.js +5 -2
  111. package/dist/server/utils/prefetchBonusesQuery.js +5 -2
  112. package/dist/server/utils/prefetchCashbackBonusQuery.js +5 -2
  113. package/dist/server/utils/prefetchCashbackBonusesCountQuery.js +5 -2
  114. package/dist/server/utils/prefetchCashbackBonusesQuery.js +5 -2
  115. package/dist/server/utils/prefetchCashbackQuery.js +5 -2
  116. package/dist/server/utils/prefetchCashbacksQuery.js +5 -2
  117. package/dist/server/utils/prefetchDepositQuery.js +5 -2
  118. package/dist/server/utils/prefetchDepositRecordsQuery.js +5 -2
  119. package/dist/server/utils/prefetchDepositsCountQuery.js +5 -2
  120. package/dist/server/utils/prefetchFavoriteGamesQuery.js +5 -2
  121. package/dist/server/utils/prefetchFileQuery.d.ts +1 -0
  122. package/dist/server/utils/prefetchFileQuery.js +23 -0
  123. package/dist/server/utils/prefetchGamesQuery.js +5 -2
  124. package/dist/server/utils/prefetchInstapayBankListQuery.js +5 -2
  125. package/dist/server/utils/prefetchIsMayaSessionValidQuery.js +5 -2
  126. package/dist/server/utils/prefetchJackpotsCountQuery.js +5 -2
  127. package/dist/server/utils/prefetchJackpotsQuery.js +5 -2
  128. package/dist/server/utils/prefetchMemberVerificationQuery.js +5 -2
  129. package/dist/server/utils/prefetchOnboardingStatusQuery.d.ts +1 -0
  130. package/dist/server/utils/prefetchOnboardingStatusQuery.js +24 -0
  131. package/dist/server/utils/prefetchPaymentSettingsQuery.js +5 -2
  132. package/dist/server/utils/prefetchPlatformQuery.js +5 -2
  133. package/dist/server/utils/prefetchProfileCompletionQuery.js +5 -2
  134. package/dist/server/utils/prefetchPromoQuery.js +5 -2
  135. package/dist/server/utils/prefetchPromosQuery.js +5 -2
  136. package/dist/server/utils/prefetchRecommendedGamesQuery.d.ts +1 -0
  137. package/dist/server/utils/prefetchRecommendedGamesQuery.js +23 -0
  138. package/dist/server/utils/prefetchSessionQuery.js +6 -3
  139. package/dist/server/utils/prefetchSiteQuery.d.ts +1 -0
  140. package/dist/server/utils/prefetchSiteQuery.js +17 -0
  141. package/dist/server/utils/prefetchTopWinsQuery.js +5 -2
  142. package/dist/server/utils/prefetchTournamentsCountQuery.js +5 -2
  143. package/dist/server/utils/prefetchTournamentsQuery.js +5 -2
  144. package/dist/server/utils/prefetchTransactionRecordsQuery.js +5 -2
  145. package/dist/server/utils/prefetchUnreadMessagesCountQuery.js +5 -2
  146. package/dist/server/utils/prefetchWalletQuery.js +5 -2
  147. package/dist/server/utils/prefetchWithdrawalRecordsQuery.js +5 -2
  148. package/dist/services/account.d.ts +1 -0
  149. package/dist/services/account.js +11 -1
  150. package/dist/services/queries.d.ts +2 -1
  151. package/dist/services/queries.js +19 -1
  152. package/dist/styles/theme.css +1 -0
  153. package/dist/types/index.d.ts +7 -0
  154. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  155. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  156. package/dist/ui/Checkbox/checkbox.recipe.js +2 -2
  157. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  158. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  159. package/dist/ui/Dialog/dialog.recipe.js +1 -1
  160. package/dist/ui/Menu/Menu.d.ts +144 -144
  161. package/dist/ui/Menu/menu.recipe.d.ts +8 -8
  162. package/dist/ui/Select/Select.d.ts +45 -45
  163. package/dist/ui/Select/select.recipe.d.ts +3 -3
  164. package/dist/ui/Table/Table.d.ts +21 -21
  165. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  166. package/dist/ui/Table/table.recipe.d.ts +3 -3
  167. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  168. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  169. package/dist/utils/callIfFn.d.ts +8 -0
  170. package/dist/utils/callIfFn.js +8 -0
  171. package/dist/utils/createPoll.d.ts +1 -0
  172. package/dist/utils/createPoll.js +1 -0
  173. package/dist/utils/createSplitProps.d.ts +9 -0
  174. package/dist/utils/createSplitProps.js +9 -0
  175. package/dist/utils/log.d.ts +3 -0
  176. package/dist/utils/log.js +18 -0
  177. package/dist/utils/mutationKeys.d.ts +29 -0
  178. package/dist/utils/mutationKeys.js +104 -0
  179. package/dist/utils/queryKeys.d.ts +5 -24
  180. package/dist/utils/queryKeys.js +80 -97
  181. package/package.json +1 -1
  182. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.d.ts +0 -8
  183. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +0 -9
  184. package/dist/components/Quests/WageringQuest/WageringQuestModal.d.ts +0 -9
  185. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +0 -9
  186. /package/dist/components/{Empty.d.ts → shared/Empty.d.ts} +0 -0
  187. /package/dist/components/{Empty.js → shared/Empty.js} +0 -0
  188. /package/dist/components/{InfiniteScroll.d.ts → shared/InfiniteScroll.d.ts} +0 -0
  189. /package/dist/components/{InfiniteScroll.js → shared/InfiniteScroll.js} +0 -0
  190. /package/dist/constants/{endpoints.d.ts → Endpoint.d.ts} +0 -0
  191. /package/dist/constants/{envVars.d.ts → EnvVar.d.ts} +0 -0
  192. /package/dist/constants/{envVars.js → EnvVar.js} +0 -0
  193. /package/dist/constants/{gameProviders.d.ts → GameProvider.d.ts} +0 -0
  194. /package/dist/constants/{gameProviders.js → GameProvider.js} +0 -0
  195. /package/dist/constants/{gameTypes.d.ts → GameType.d.ts} +0 -0
  196. /package/dist/constants/{gameTypes.js → GameType.js} +0 -0
  197. /package/dist/constants/{headerKeys.d.ts → HeaderKey.d.ts} +0 -0
  198. /package/dist/constants/{headerKeys.js → HeaderKey.js} +0 -0
  199. /package/dist/constants/{secretQuestions.d.ts → SecretQuestion.d.ts} +0 -0
  200. /package/dist/constants/{secretQuestions.js → SecretQuestion.js} +0 -0
  201. /package/dist/constants/{storageKeys.d.ts → StorageKey.d.ts} +0 -0
  202. /package/dist/constants/{storageKeys.js → StorageKey.js} +0 -0
@@ -0,0 +1,38 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import invariant from 'tiny-invariant';
3
+ import { updateMemberVerification__next, } from '../../services/account.js';
4
+ import { getQueryClient } from '../../utils/getQueryClient.js';
5
+ import { getUpdateMemberVerificationQueryKey } from '../../utils/mutationKeys.js';
6
+ import { getMemberVerificationQueryKey } from '../../utils/queryKeys.js';
7
+ import { getSession } from '../services/getSession.js';
8
+ export const useUpdateMemberVerificationMutation = (config) => {
9
+ const queryClient = getQueryClient();
10
+ const mutation = useMutation({
11
+ ...config,
12
+ mutationKey: getUpdateMemberVerificationQueryKey(),
13
+ mutationFn: async ({ id, data }) => {
14
+ const session = await getSession();
15
+ invariant(session.status === 'authenticated');
16
+ await updateMemberVerification__next(id, data, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ },
20
+ });
21
+ queryClient.setQueryData(getMemberVerificationQueryKey(), (prev) => {
22
+ if (!prev)
23
+ return prev;
24
+ return {
25
+ ...prev,
26
+ ...data,
27
+ idFrontImage: data.idFrontImage
28
+ ? { id: data.idFrontImage, status: 'UPLOADING' }
29
+ : prev.idFrontImage,
30
+ selfieImage: data.selfieImage
31
+ ? { id: data.selfieImage, status: 'UPLOADING' }
32
+ : prev.selfieImage,
33
+ };
34
+ });
35
+ },
36
+ });
37
+ return mutation;
38
+ };
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import { type UploadPrivateImageFileInput } from '../../services/file';
3
+ import type { Mutation } from '../../types';
4
+ export declare const useUploadImageFileMutation: Mutation<string, SetOptional<UploadPrivateImageFileInput, 'id'>>;
@@ -0,0 +1,24 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import invariant from 'tiny-invariant';
4
+ import { uploadPrivateImageFile, } from '../../services/file.js';
5
+ import { ObjectType } from '../../services/ObjectType.js';
6
+ import { getUploadImageFileMutationKey } from '../../utils/mutationKeys.js';
7
+ import { getSession } from '../services/getSession.js';
8
+ export const useUploadImageFileMutation = (config) => {
9
+ return useMutation({
10
+ ...config,
11
+ mutationKey: getUploadImageFileMutationKey(),
12
+ mutationFn: async (input) => {
13
+ const session = await getSession();
14
+ invariant(session.status === 'authenticated');
15
+ const id = input.id ?? ObjectId.generate(ObjectType.File).toString();
16
+ await uploadPrivateImageFile({ ...input, id }, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ },
20
+ });
21
+ return id;
22
+ },
23
+ });
24
+ };
@@ -5,7 +5,7 @@ export function createContext(options) {
5
5
  const defaultValue = options?.defaultValue ?? null;
6
6
  const Context = React.createContext(defaultValue ?? null);
7
7
  function useContext() {
8
- const context = React.useContext(Context);
8
+ const context = React.use(Context);
9
9
  if (!context && strict)
10
10
  invariant(context);
11
11
  return context;
@@ -4,7 +4,7 @@ import { createSplitProps } from '../../utils/createSplitProps.js';
4
4
  export function createRecipeContext(recipe) {
5
5
  const RecipeContext = React.createContext(null);
6
6
  function useContext() {
7
- const context = React.useContext(RecipeContext);
7
+ const context = React.use(RecipeContext);
8
8
  return context;
9
9
  }
10
10
  function withRootProvider(Component) {
@@ -26,7 +26,7 @@ import { Select } from '../../ui/Select/index.js';
26
26
  import { Table } from '../../ui/Table/index.js';
27
27
  import { capitalize } from '../../utils/capitalize.js';
28
28
  import { formatNumber } from '../../utils/formatNumber.js';
29
- import { Empty } from '../Empty.js';
29
+ import { Empty } from '../shared/Empty.js';
30
30
  export function BetRecords__client(props) {
31
31
  const [tab, setTab] = useState('all');
32
32
  const gameTypes = props.gameTypes.map((type) => GAME_TYPE_DATA[type]);
@@ -22,7 +22,7 @@ import { SegmentGroup } from '../../ui/SegmentGroup/index.js';
22
22
  import { capitalize } from '../../utils/capitalize.js';
23
23
  import { formatNumber } from '../../utils/formatNumber.js';
24
24
  import { parseDecimal } from '../../utils/parseDecimal.js';
25
- import { Empty } from '../Empty.js';
25
+ import { Empty } from '../shared/Empty.js';
26
26
  const TABS = ['ALL', 'ACTIVE', 'CASHBACKS'];
27
27
  export function Bonuses__client(props) {
28
28
  const [tab, setTab] = useState(TABS[0]);
@@ -11,5 +11,5 @@ import { useDisclaimer } from './useDisclaimer.js';
11
11
  export function DisclaimerV1(props) {
12
12
  const disclaimer = useDisclaimer();
13
13
  const acceptTriggerRef = useRef(null);
14
- 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, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "mt-3xl text-center text-lg font-semibold", children: "Age Verification" }), _jsxs(Dialog.Description, { className: "text-text-tertiary-600 mt-xs text-center text-sm", children: ["By entering this website I acknowledge and confirmI am 21 years of age and I agree with the", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", children: "Terms and Conditions." })] }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, children: "Accept" })] }) })] }) }));
14
+ 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, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "flex h-full w-full flex-col items-start p-3xl lg:mx-auto lg:h-auto lg:w-[400px] lg:rounded-xl", children: [_jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto h-auto w-[120px]", draggable: false }), _jsxs("div", { className: "w-full grow", children: [_jsx(Dialog.Title, { className: "mt-3xl text-center text-lg font-semibold", children: "Age Verification" }), _jsxs(Dialog.Description, { className: "text-text-tertiary-600 mt-xs text-center text-sm", children: ["By entering this website I acknowledge and confirm I am 21 years of age and I agree with the", ' ', _jsx("button", { type: "button", className: "text-brand-400 underline underline-offset-2", children: "Terms and Conditions." })] }), _jsxs("div", { className: "mt-5 flex items-center justify-center gap-3xl", children: [_jsx(Image, { src: pagcorLogo, alt: "", height: 75, width: 88, className: "h-[88px] w-auto shrink-0", draggable: false }), _jsx(Image, { src: responsibleGamingLogo, alt: "", height: 62, width: 186, className: "h-[62px] w-auto shrink-0", draggable: false })] })] }), _jsx(Button, { ref: acceptTriggerRef, type: "button", className: "mt-4xl", onClick: disclaimer.close, children: "Accept" })] }) })] }) }));
15
15
  }
@@ -21,7 +21,7 @@ export function Game(props) {
21
21
  const favoriteGames = favoriteGamesQuery.data ?? [];
22
22
  const markGameAsFavoriteMutation = useMarkGameAsFavoriteMutation();
23
23
  const unmarkGameAsFavoriteMutation = useUnmarkGameAsFavoriteMutation();
24
- const markedAsFavorite = favoriteGames.some((favoriteGame) => favoriteGame.id === game.id);
24
+ const markedAsFavorite = favoriteGames.some((favoriteGame) => favoriteGame.id === game.reference);
25
25
  const classNames = isString(props.className)
26
26
  ? { root: props.className }
27
27
  : (props.className ?? {});
@@ -12,7 +12,7 @@ import { ChevronRightIcon } from '../../icons/ChevronRightIcon.js';
12
12
  import { GamingPad01Icon } from '../../icons/GamingPad01Icon.js';
13
13
  import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
14
14
  import { Button } from '../../ui/Button/index.js';
15
- import { Empty } from '../Empty.js';
15
+ import { Empty } from '../shared/Empty.js';
16
16
  import { Game } from './Game.js';
17
17
  import { GameContext } from './GamesContext.js';
18
18
  export function GamesCarousel__client(props) {
@@ -7,7 +7,7 @@ import { GamingPad01Icon } from '../../icons/GamingPad01Icon.js';
7
7
  import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
8
8
  import { Button } from '../../ui/Button/index.js';
9
9
  import { Progress } from '../../ui/Progress/index.js';
10
- import { Empty } from '../Empty.js';
10
+ import { Empty } from '../shared/Empty.js';
11
11
  import { Game } from './Game.js';
12
12
  import { GameContext } from './GamesContext.js';
13
13
  export function GamesList__client(props) {
@@ -19,6 +19,7 @@ export interface JackpotsListProps {
19
19
  style?: CSSProperties | StyleEntries;
20
20
  gameProviders: GameProvider[];
21
21
  gameProviderImages?: Partial<Record<GameProvider, ImageProps['src']>>;
22
+ animate?: boolean;
22
23
  }
23
24
  export declare function JackpotsList(props: JackpotsListProps): import("react/jsx-runtime").JSX.Element | null;
24
25
  export {};
@@ -33,5 +33,5 @@ export function JackpotsList(props) {
33
33
  const classNames = isString(props.className)
34
34
  ? { root: props.className }
35
35
  : (props.className ?? {});
36
- return (_jsx(JackpotsListPropsContext, { value: props, children: _jsxs("div", { style: styles.root, className: classNames.root, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotsListItemContext, { value: jackpot, children: _jsx(JackpotsListItemDesktop, { style: styles.itemRoot, className: classNames.itemRoot }) }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotsListItemContext, { value: jackpot, children: _jsx(JackpotsListItemMobile, { style: styles.itemRoot, className: classNames.itemRoot }) }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }) }));
36
+ return (_jsx(JackpotsListPropsContext, { value: props, children: _jsxs("div", { style: styles.root, className: classNames.root, children: [_jsx("div", { className: "mb-3 text-lg font-semibold lg:mb-4.5", children: props.heading ?? 'Jackpots' }), jackpots.length > 0 ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "hidden flex-col gap-6 lg:flex", children: jackpots.map((jackpot) => (_jsx(JackpotsListItemContext, { value: jackpot, children: _jsx(JackpotsListItemDesktop, { style: styles.itemRoot, className: classNames.itemRoot, animate: props.animate }) }, jackpot.id))) }), _jsx("div", { className: "flex flex-col gap-6 lg:hidden", children: jackpots.map((jackpot) => (_jsx(JackpotsListItemContext, { value: jackpot, children: _jsx(JackpotsListItemMobile, { style: styles.itemRoot, className: classNames.itemRoot, animate: props.animate }) }, jackpot.id))) })] })) : (_jsxs("div", { className: "mt-11 flex flex-col items-center justify-center", children: [_jsx(Image, { width: 100, height: 100, src: closeChest, alt: "closeChest", quality: 100, className: "h-29.5 w-29.5 lg:h-25 lg:w-25 size-full mix-blend-luminosity" }), _jsx("div", { className: "text-text-primary-900 mt-4 text-base font-semibold", children: props.heading ?? 'Jackpots' }), _jsxs("div", { className: "text-text-tertiary-600 mt-1 text-center text-sm", children: ["No ", props.heading?.toLocaleLowerCase() ?? 'jackpots', " are running at the moment. ", _jsx("br", {}), "Please check back later!"] })] }))] }) }));
37
37
  }
@@ -2,6 +2,7 @@ import type { CSSProperties } from 'react';
2
2
  interface JackpotsListItemDesktopProps {
3
3
  className?: string;
4
4
  style?: CSSProperties;
5
+ animate?: boolean;
5
6
  }
6
- export declare function JackpotsListItemDesktop(props: JackpotsListItemDesktopProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function JackpotsListItemDesktop({ animate, ...props }: JackpotsListItemDesktopProps): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -19,7 +19,7 @@ import styles from './JackpotsListItem.module.css';
19
19
  import { JackpotsListItemGameProviders } from './JackpotsListItemGameProviders.js';
20
20
  import { JackpotsListItemRules } from './JackpotsListItemRules.js';
21
21
  import { useJackpotsListItemData } from './useJackpotsListItemData.js';
22
- export function JackpotsListItemDesktop(props) {
22
+ export function JackpotsListItemDesktop({ animate = true, ...props }) {
23
23
  const jackpot = useJackpotsListItemContext();
24
24
  const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, } = useJackpotsListItemData();
25
25
  return (_jsxs("div", { className: twMerge('bg-bg-tertiary border-border-primary rounded-2xl border', props.className), children: [_jsxs("div", { style: props.style, className: twMerge('relative flex shrink-0 rounded-2xl p-3 text-center lg:gap-4 lg:p-5'), children: [_jsxs("div", { className: "z-1 relative flex flex-1 flex-col", children: [_jsx("div", { className: "flex h-full flex-col justify-between", children: _jsx("div", { className: "flex w-full justify-between", children: _jsxs("div", { className: "flex w-full flex-col", children: [_jsxs("div", { className: "relative flex w-full justify-between", children: [_jsxs("div", { children: [isPayingOut ? (_jsxs("div", { className: "border-utility-success-200 bg-utility-success-50 text-utility-success-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx("span", { className: "full bg-utility-success-500 size-1.5 animate-pulse rounded" }), "Paying Out"] })) : (_jsxs("div", { className: "border-utility-blue-200 bg-utility-blue-50 text-utility-blue-700 flex w-fit items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium", children: [_jsx(ArrowNarrowUpRightIcon, { className: "text-utility-blue-500 size-3.5" }), "Accumulating"] })), _jsx("div", { className: "text-text-primary-900 mt-1 text-left text-lg font-medium lg:mt-5 lg:text-2xl", children: jackpot.name }), _jsx("div", { className: "bg-bg-primary text-brand-400 mt-1.5 w-fit rounded-md px-2 py-1 text-2xl font-bold lg:mt-2 lg:text-4xl", children: formatNumber(jackpotAmount, {
@@ -41,9 +41,9 @@ export function JackpotsListItemDesktop(props) {
41
41
  currency: localeInfo.currency.code,
42
42
  compact: true,
43
43
  })} Play now for your chance to win big! 🔥`
44
- : getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, quality: 100, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' })] }), _jsx(JackpotsListItemRules, {})] }), _jsx("div", { className: twMerge('max-h-[272px] overflow-y-scroll', styles['scrollArea']), children: _jsx("div", { className: "border-gray-200 overflow-hidden rounded-xl", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-xs font-medium", children: [_jsx("th", { children: "Player" }), _jsx("th", { children: "Game" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" }), _jsx("th", { children: "Timestamp" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
44
+ : getAccumulatingJackpotDescription(Number(jackpot?.pool) ?? 0, Number(jackpot?.maximumJackpotPoolLimit) ?? 0) })] })] }), _jsxs("div", { className: "z-1 hidden flex-1 space-y-4 lg:block", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { width: 24, height: 24, src: leaderboard, quality: 100, alt: "leaderboardIcon", className: "size-full h-auto w-6" }), _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' })] }), _jsx(JackpotsListItemRules, {})] }), _jsx("div", { className: twMerge('max-h-[272px] overflow-y-scroll', styles['scrollArea']), children: _jsx("div", { className: "border-gray-200 overflow-hidden rounded-xl", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-xs font-medium", children: [_jsx("th", { children: "Player" }), _jsx("th", { children: "Game" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" }), _jsx("th", { children: "Timestamp" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
45
45
  currency: localeInfo.currency.code,
46
46
  minDecimalPlaces: 2,
47
47
  maxDecimalPlaces: 2,
48
- }) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl') }))] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotsListItemGameProviders, { gameProviders: filteredGameProviders }))] }));
48
+ }) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) : (_jsx(_Fragment, { children: Array.from({ length: 10 }).map((_, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" })] }, i))) })) })] }) }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl') }))] }), Boolean(filteredGameProviders.length) && (_jsx(JackpotsListItemGameProviders, { gameProviders: filteredGameProviders }))] }));
49
49
  }
@@ -2,6 +2,7 @@ import { type CSSProperties } from 'react';
2
2
  interface JackpotsListItemMobileProps {
3
3
  className?: string;
4
4
  style?: CSSProperties;
5
+ animate?: boolean;
5
6
  }
6
- export declare function JackpotsListItemMobile(props: JackpotsListItemMobileProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function JackpotsListItemMobile({ animate, ...props }: JackpotsListItemMobileProps): import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -22,7 +22,7 @@ import styles from './JackpotsListItem.module.css';
22
22
  import { JackpotsListItemGameProviders } from './JackpotsListItemGameProviders.js';
23
23
  import { JackpotsListItemRules } from './JackpotsListItemRules.js';
24
24
  import { useJackpotsListItemData } from './useJackpotsListItemData.js';
25
- export function JackpotsListItemMobile(props) {
25
+ export function JackpotsListItemMobile({ animate = true, ...props }) {
26
26
  const jackpot = useJackpotsListItemContext();
27
27
  const { jackpotPayouts, topJackpotPayout, filteredGameProviders, localeInfo, isPayingOut, jackpotAmount, arrowImages, getAccumulatingJackpotDescription, } = useJackpotsListItemData();
28
28
  const [isDetailsVisible, setIsDetailsVisible] = useState(false);
@@ -45,7 +45,7 @@ export function JackpotsListItemMobile(props) {
45
45
  currency: localeInfo.currency.code,
46
46
  minDecimalPlaces: 2,
47
47
  maxDecimalPlaces: 2,
48
- }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Latest Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Leaderboard' : 'Starting soon!' }) }), _jsx(JackpotsListItemRules, {})] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { children: "Player" }), _jsx("th", { children: "Game" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" }), _jsx("th", { children: "Timestamp" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
48
+ }) })] })] }) })) : (_jsxs("div", { className: "bg-bg-primary relative mt-4 flex w-full gap-4 rounded-lg p-4", children: [_jsx(Image, { width: 66, height: 87, src: firstPlace, alt: "closeChest", className: "size-full h-auto w-[66px] mix-blend-luminosity" }), _jsxs("div", { className: "flex flex-col gap-1 text-left", children: [_jsxs("div", { className: "border-utility-brand-200 bg-utility-brand-50 text-utility-brand-700 flex h-fit w-fit items-center gap-1 rounded-sm border px-2 py-0.5 text-xs font-medium", children: [_jsx(Trophy01Icon, { className: "text-utility-brand-600 size-3.5" }), "Latest Payout"] }), _jsx("div", { className: "font-semibold", children: "No winners yet" }), _jsx("div", { className: "text-text-secondary-700 text-xs", children: "You could be the first to win the tournament!" })] })] })), _jsx(Button, { variant: "outline", className: twMerge('mt-5.5 px-3.5 py-2.5 text-sm', isDetailsVisible ? 'hidden' : 'flex'), onClick: () => setIsDetailsVisible(!isDetailsVisible), children: _jsxs("div", { className: "flex gap-1.5", children: ["See Details", _jsx(ArrowNarrowDownIcon, { className: "size-5" })] }) })] }), isPayingOut && animate && (_jsx("div", { className: twMerge(styles['light-rays'], 'absolute right-0 top-0 rounded-2xl [--light-rays-top:15%] lg:[--light-rays-top:150px]') }))] }), isDetailsVisible && (_jsxs("div", { children: [_jsxs("div", { className: "z-1 flex-1", children: [_jsxs("div", { className: "flex items-center justify-between p-3", children: [_jsx("div", { className: "flex gap-2", children: _jsx("div", { className: "text-text-primary-900 text-lg font-semibold", children: jackpotPayouts.length ? 'Recent payouts' : 'Starting soon!' }) }), _jsx(JackpotsListItemRules, {})] }), _jsx("div", { children: _jsx("div", { className: "border-gray-200 overflow-hidden", children: _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsxs("tr", { className: "bg-bg-secondary text-text-tertiary-600 h-8 text-center text-xs font-medium", children: [_jsx("th", { children: "Player" }), _jsx("th", { children: "Game" }), _jsx("th", { children: "Multiplier" }), _jsx("th", { children: "Prize" }), _jsx("th", { children: "Timestamp" })] }) }), _jsx("tbody", { children: jackpotPayouts.length ? (_jsx(_Fragment, { children: jackpotPayouts.map((jackpotPayout, i) => (_jsxs("tr", { className: "bg-bg-primary text-text-secondary-700 text-center text-sm", children: [_jsx("td", { className: "border-border-secondary h-12 border-t-2", children: mask(jackpotPayout.member.name) }), _jsx("td", { className: "border-border-secondary h-12 border-t-2", children: "-" }), _jsxs("td", { className: "border-border-secondary h-12 border-t-2", children: [jackpotPayout.multiplier, "x"] }), _jsx("td", { className: "border-border-secondary text-brand-400 h-12 border-t-2", children: formatNumber(jackpotPayout.amount, {
49
49
  currency: localeInfo.currency.code,
50
50
  minDecimalPlaces: 2,
51
51
  maxDecimalPlaces: 2,
@@ -1,12 +1,93 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { differenceInYears, format, isSameDay, isValid, parse } from 'date-fns';
4
+ import { isNil, omitBy, size } from 'lodash-es';
5
+ import { useEffect } from 'react';
6
+ import { useForm } from 'react-hook-form';
7
+ import invariant from 'tiny-invariant';
8
+ import { z } from 'zod';
9
+ import { useAccountQuery } from '../../client/hooks/useAccountQuery.js';
10
+ import { useUpdateAccountMutation } from '../../client/hooks/useUpdateAccountMutation.js';
11
+ import { toaster } from '../../client/utils/toaster.js';
12
+ import { SpinnerIcon } from '../../icons/SpinnerIcon.js';
2
13
  import { Button } from '../../ui/Button/index.js';
3
14
  import { Dialog } from '../../ui/Dialog/index.js';
4
15
  import { Field } from '../../ui/Field/index.js';
5
16
  import { useKYCContext } from './KYCContext.js';
17
+ const definition = z.object({
18
+ realName: z
19
+ .string()
20
+ .min(3, 'Name must be 3 or more characters')
21
+ .max(50, 'Name must not be more than 50 characters')
22
+ .regex(/^[a-z0-9 ]+$/gi, 'Name must not contain special characters')
23
+ .trim(),
24
+ birthDay: z
25
+ .string()
26
+ .min(1, 'Date of birth is required')
27
+ .superRefine((value, ctx) => {
28
+ const dob = parse(value, 'yyyy-MM-dd', new Date());
29
+ if (!isValid(dob)) {
30
+ return ctx.addIssue({
31
+ code: z.ZodIssueCode.invalid_date,
32
+ });
33
+ }
34
+ const now = new Date();
35
+ const age = differenceInYears(now, dob);
36
+ if (age < 21) {
37
+ return ctx.addIssue({
38
+ code: z.ZodIssueCode.custom,
39
+ message: 'You must be at least 21 years old',
40
+ });
41
+ }
42
+ }),
43
+ branchCode: z.string().min(4).max(10).optional().or(z.literal('')),
44
+ });
6
45
  export function BasicInformation() {
7
46
  const kyc = useKYCContext();
8
- return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Basic Information" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Enter your basic details for identification and communication." }), _jsxs("form", { className: "mt-3", onSubmit: (e) => {
9
- e.preventDefault();
10
- kyc.setStep(2);
11
- }, children: [_jsxs(Field.Root, { children: [_jsx(Field.Label, { children: "Real Name" }), _jsx(Field.Input, { placeholder: "Enter your real name" })] }), _jsxs(Field.Root, { className: "mt-3", children: [_jsx(Field.Label, { children: "Date of Birth" }), _jsx(Field.Input, { type: "date" })] }), _jsx(Button, { type: "submit", className: "mt-8", children: "Continue" })] })] }));
47
+ const form = useForm({
48
+ resolver: zodResolver(definition),
49
+ mode: 'all',
50
+ defaultValues: {
51
+ birthDay: '',
52
+ branchCode: '',
53
+ realName: '',
54
+ },
55
+ });
56
+ const accountQuery = useAccountQuery();
57
+ const account = accountQuery.data;
58
+ const updateAccountMutation = useUpdateAccountMutation({
59
+ onError(error) {
60
+ toaster.error({
61
+ title: 'Error',
62
+ description: error.message,
63
+ });
64
+ },
65
+ onSuccess() {
66
+ kyc.setStep(2);
67
+ },
68
+ });
69
+ useEffect(() => {
70
+ if (account) {
71
+ form.reset({
72
+ realName: account.realName ?? '',
73
+ birthDay: account.birthDay
74
+ ? format(account.birthDay, 'yyyy-MM-dd')
75
+ : '',
76
+ });
77
+ }
78
+ }, [account, form, kyc]);
79
+ if (accountQuery.isLoading)
80
+ return _jsx(SpinnerIcon, {});
81
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Basic Information" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Enter your basic details for identification and communication." }), _jsxs("form", { className: "mt-3", onSubmit: form.handleSubmit((data) => {
82
+ invariant(account);
83
+ const input = omitBy({
84
+ realName: account.realName === data.realName ? undefined : data.realName,
85
+ birthDay: account.birthDay && isSameDay(data.birthDay, account.birthDay)
86
+ ? undefined
87
+ : format(data.birthDay, 'yyyy-MM-dd'),
88
+ }, isNil);
89
+ if (size(input) === 0)
90
+ return kyc.setStep(2);
91
+ updateAccountMutation.mutate(input);
92
+ }), children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!accountQuery.data?.realName, children: [_jsx(Field.Label, { children: "Real Name" }), _jsx(Field.Input, { placeholder: "Enter your real name", ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-3", invalid: !!form.formState.errors.branchCode, readOnly: !!accountQuery.data?.birthDay, children: [_jsx(Field.Label, { children: "Date of Birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), _jsx(Button, { type: "submit", className: "mt-8", disabled: updateAccountMutation.isPending, children: "Continue" })] })] }));
12
93
  }
@@ -0,0 +1 @@
1
+ export declare function CaptureIdDocument(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
3
+ import { Camera01Icon } from '../../icons/Camera01Icon.js';
4
+ import { XIcon } from '../../icons/XIcon.js';
5
+ import { Button } from '../../ui/Button/index.js';
6
+ import { Dialog } from '../../ui/Dialog/index.js';
7
+ import { useKYCContext } from './KYCContext.js';
8
+ export function CaptureIdDocument() {
9
+ const kyc = useKYCContext();
10
+ return (_jsxs("div", { className: "w-full p-4 lg:w-[640px] lg:px-12 lg:py-4xl", children: [_jsxs("button", { type: "button", className: "flex items-center gap-lg lg:absolute lg:right-5 lg:top-5 lg:p-md", onClick: () => kyc.setCapturing(null), children: [_jsx(XIcon, { className: "text-text-senary-300 hidden size-5 lg:block" }), _jsx(ArrowLeftIcon, { className: "text-text-senary-300 size-5 lg:hidden" }), _jsx("span", { className: "text-lg font-semibold lg:hidden", children: "Back" })] }), _jsx(Dialog.Title, { className: "mt-6 text-center text-lg font-semibold lg:mt-0", children: "Take a Picture of Your Front ID" }), _jsxs(Dialog.Description, { className: "lg:max-w-auto text-text-tertiary-600 mx-auto mt-sm max-w-[19rem] text-center text-sm lg:max-w-full", children: ["Make sure your ID is clearly visible, well-lit, and not blurry.", _jsx("br", { className: "hidden lg:block" }), " Avoid glare or reflections, and ensure all corners are within the frame."] }), _jsx("div", { className: "border-border-disabled mt-6 aspect-video rounded-xl border bg-black lg:mt-8" }), _jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-6 px-xl disabled:opacity-100 lg:mt-8 lg:w-fit", disabled: true, children: ["Capture", _jsx(Camera01Icon, { className: "size-5" })] })] }));
11
+ }
@@ -0,0 +1 @@
1
+ export declare function CaptureSelfie(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
3
+ import { Camera01Icon } from '../../icons/Camera01Icon.js';
4
+ import { XIcon } from '../../icons/XIcon.js';
5
+ import { Button } from '../../ui/Button/index.js';
6
+ import { Dialog } from '../../ui/Dialog/index.js';
7
+ import { useKYCContext } from './KYCContext.js';
8
+ export function CaptureSelfie() {
9
+ const kyc = useKYCContext();
10
+ return (_jsxs("div", { className: "w-full p-4 lg:w-[640px] lg:px-12 lg:py-4xl", children: [_jsxs("button", { type: "button", className: "flex items-center gap-lg lg:absolute lg:right-5 lg:top-5 lg:p-md", onClick: () => kyc.setCapturing(null), children: [_jsx(XIcon, { className: "text-text-senary-300 hidden size-5 lg:block" }), _jsx(ArrowLeftIcon, { className: "text-text-senary-300 size-5 lg:hidden" }), _jsx("span", { className: "text-lg font-semibold lg:hidden", children: "Back" })] }), _jsx(Dialog.Title, { className: "mt-6 text-center text-lg font-semibold lg:mt-0", children: "Take a Selfie Holding Your ID" }), _jsx(Dialog.Description, { className: "text-text-tertiary-600 mx-auto mt-sm max-w-[19rem] text-center text-sm lg:max-w-full", children: "Make sure your face and ID are clearly visible, with no glare or blur." }), _jsx("div", { className: "border-border-disabled mt-6 aspect-video rounded-xl border bg-black lg:mt-8" }), _jsxs(Button, { className: "disabled:bg-bg-disabled disabled:text-text-disabled mx-auto mt-6 px-xl disabled:opacity-100 lg:mt-8 lg:w-fit", disabled: true, children: ["Capture", _jsx(Camera01Icon, { className: "size-5" })] })] }));
11
+ }
@@ -1,20 +1,36 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useShallow } from 'zustand/shallow';
3
+ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
2
4
  import { HelpCircleIcon } from '../../icons/HelpCircleIcon.js';
3
5
  import { UploadCloud02Icon } from '../../icons/UploadCloud02Icon.js';
4
6
  import { Button } from '../../ui/Button/index.js';
5
7
  import { Dialog } from '../../ui/Dialog/index.js';
6
8
  import { Field } from '../../ui/Field/index.js';
9
+ import { Portal } from '../../ui/Portal/index.js';
7
10
  import { useKYCContext } from './KYCContext.js';
8
11
  export function IdentityVerification() {
9
12
  const kyc = useKYCContext();
10
- return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Verify your identity" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Verify your details to confirm your identity and secure your access." }), _jsxs("div", { className: "border-border-primary bg-bg-primary text-text-placeholder mt-7 rounded-xl border p-lg text-2xs leading-tight", children: [_jsx("h3", { className: "font-semibold", children: "Instructions" }), _jsxs("ol", { className: "mt-2 list-inside list-decimal", children: [_jsx("li", { children: "Upload a full photo of your ID." }), _jsx("li", { children: "Please ensure that all details in the uploaded image are legible." }), _jsx("li", { children: "Please ensure that the ID uploaded is within the validity period." })] })] }), _jsxs("form", { className: "mt-xl", onSubmit: (e) => {
13
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
14
+ kyc: ctx.kyc,
15
+ })));
16
+ return (_jsxs("div", { children: [_jsx(Dialog.Title, { className: "text-center text-lg font-semibold", children: "Verify your identity" }), _jsx(Dialog.Description, { className: "text-text-secondary-700 mt-xs text-center text-sm", children: "Verify your details to confirm your identity and secure your access." }), _jsxs("div", { className: "border-border-primary bg-bg-primary text-text-placeholder mt-7 rounded-xl border p-lg text-xs leading-tight", children: [_jsx("h3", { className: "font-semibold", children: "Instructions" }), _jsxs("ol", { className: "mt-2 list-inside list-decimal", children: [_jsx("li", { children: "Upload a full photo of your ID." }), _jsx("li", { children: "Please ensure that all details in the uploaded image are legible." }), _jsx("li", { children: "Please ensure that the ID uploaded is within the validity period." })] })] }), _jsxs("form", { className: "mt-xl", onSubmit: (e) => {
11
17
  e.preventDefault();
12
18
  kyc.setStep(3);
13
- }, children: [_jsxs(Field.Root, { children: [_jsxs(Field.Label, { className: "flex items-center gap-1.5", children: [_jsx("span", { children: "Front of your ID" }), _jsx(HelpCircleIcon, { className: "text-text-quinary size-4" })] }), _jsx(UploadIdDocument, {})] }), _jsxs(Field.Root, { className: "mt-3", children: [_jsxs(Field.Label, { className: "flex items-center gap-1.5", children: [_jsx("span", { children: "Selfie holding your ID" }), _jsx(HelpCircleIcon, { className: "text-text-quinary size-4" })] }), _jsx(UploadSelfie, {})] }), _jsx(Button, { type: "submit", className: "mt-6", children: "Continue" }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", children: "Skip for now" })] })] }));
19
+ }, children: [_jsxs(Field.Root, { children: [_jsxs(Field.Label, { className: "flex items-center gap-1.5", children: [_jsx("span", { children: "Front of your ID" }), _jsx(HelpCircleIcon, { className: "text-text-quinary size-4" })] }), _jsx(UploadIdDocument, {})] }), _jsxs(Field.Root, { className: "mt-3", children: [_jsxs(Field.Label, { className: "flex items-center gap-1.5", children: [_jsx("span", { children: "Selfie holding your ID" }), _jsx(HelpCircleIcon, { className: "text-text-quinary size-4" })] }), _jsx(UploadSelfie, {})] }), _jsx(Button, { type: "submit", className: "mt-6", children: "Continue" }), _jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", onClick: () => {
20
+ kyc.setStep(3);
21
+ kyc.setDone(true);
22
+ globalStore.kyc.setOpen(false);
23
+ }, children: "Skip for now" })] }), _jsx(Dialog.Root, { lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsx(Dialog.Content, { className: "bg-bg-primary-alt mx-auto min-h-full w-full p-3xl lg:h-auto lg:w-[400px]" }) })] }) })] }));
14
24
  }
15
25
  function UploadIdDocument() {
16
- return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs mx-auto flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-quinary size-4" }) }), _jsxs("p", { className: "text-text-tertiary-600 text-center text-sm", children: [_jsx("span", { className: "text-button-secondary-fg font-semibold", children: "Click to upload" }), ' ', "or drag and drop", _jsx("br", {}), "PNG, JPG or JPEG (max. 10mb)", _jsx("br", {}), "or"] }), _jsx(Button, { size: "xs", variant: "outline", className: "mx-auto w-fit", children: "Take a photo" })] }));
26
+ const kyc = useKYCContext();
27
+ return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs mx-auto flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-quinary size-4" }) }), _jsxs("p", { className: "text-text-tertiary-600 text-center text-sm", children: [_jsx("span", { className: "text-button-secondary-fg font-semibold", children: "Click to upload" }), ' ', "or drag and drop", _jsx("br", {}), "PNG, JPG or JPEG (max. 10mb)", _jsx("br", {}), "or"] }), _jsx(Button, { size: "xs", variant: "outline", className: "mx-auto w-fit", onClick: () => {
28
+ kyc.setCapturing('ID_DOCUMENT');
29
+ }, children: "Take a photo" })] }));
17
30
  }
18
31
  function UploadSelfie() {
19
- return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs mx-auto flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-quinary size-4" }) }), _jsx(Button, { size: "xs", variant: "outline", className: "mx-auto w-fit", children: "Take a photo" })] }));
32
+ const kyc = useKYCContext();
33
+ return (_jsxs("div", { className: "border-border-primary bg-bg-primary flex min-h-[11.25rem] flex-col justify-center gap-lg rounded-xl border px-3xl py-xl", children: [_jsx("div", { className: "border-border-primary shadow-xs mx-auto flex size-8 items-center justify-center rounded-sm border", children: _jsx(UploadCloud02Icon, { className: "text-text-quinary size-4" }) }), _jsx(Button, { size: "xs", variant: "outline", className: "mx-auto w-fit", onClick: () => {
34
+ kyc.setCapturing('SELFIE');
35
+ }, children: "Take a photo" })] }));
20
36
  }
@@ -4,5 +4,5 @@ import { Progress } from '../../ui/Progress/index.js';
4
4
  import { useKYCContext } from './KYCContext.js';
5
5
  export function Indicator() {
6
6
  const kyc = useKYCContext();
7
- return (_jsxs("div", { className: "flex items-center justify-center gap-1.5 py-3", children: [_jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step <= 1 ? 50 : 100, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step < 2 ? 0 : kyc.step === 2 ? 50 : 100, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.done ? 100 : kyc.step < 3 ? 0 : 50, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) })] }));
7
+ return (_jsxs("div", { className: "flex items-center justify-center gap-1.5 py-3", children: [_jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 1 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step > 2 ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) }), _jsx(Progress.Root, { className: "w-10 shrink-0", value: kyc.step === 3 && kyc.done ? 100 : 0, onValueChange: noop, children: _jsx(Progress.Track, { className: "bg-bg-primary-hover", children: _jsx(Progress.Range, {}) }) })] }));
8
8
  }
@@ -6,6 +6,8 @@ import { XIcon } from '../../icons/XIcon.js';
6
6
  import { Dialog } from '../../ui/Dialog/index.js';
7
7
  import { Portal } from '../../ui/Portal/index.js';
8
8
  import { BasicInformation } from './BasicInformation.js';
9
+ import { CaptureIdDocument } from './CaptureIdDocument.js';
10
+ import { CaptureSelfie } from './CaptureSelfie.js';
9
11
  import { IdentityVerification } from './IdentityVerification.js';
10
12
  import { Indicator } from './Indicator.js';
11
13
  import { KYCContext } from './KYCContext.js';
@@ -18,5 +20,9 @@ export function KYC(props) {
18
20
  })));
19
21
  return (_jsx(KYCContext, { value: kyc, children: _jsx(Dialog.Root, { open: globalStore.kyc.open, onOpenChange: (details) => {
20
22
  globalStore.kyc.setOpen(details.open);
21
- }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt mx-auto size-full p-3xl lg:h-auto lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }) })] }) }) }));
23
+ }, lazyMount: true, unmountOnExit: true, onExitComplete: () => {
24
+ kyc.setStep(1);
25
+ kyc.setDone(false);
26
+ kyc.setCapturing(null);
27
+ }, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { children: _jsxs(Dialog.Content, { className: "bg-bg-primary-alt lg:min-h-auto mx-auto min-h-full w-full lg:w-fit", children: [kyc.capturing === 'SELFIE' && _jsx(CaptureSelfie, {}), kyc.capturing === 'ID_DOCUMENT' && _jsx(CaptureIdDocument, {}), !kyc.capturing && (_jsxs("div", { className: "w-full p-3xl lg:w-[400px]", children: [_jsx(Dialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsx(Image, { src: props.logo, alt: "", width: 200, height: 100, className: "mx-auto mb-5 block h-7.5 w-auto", draggable: false }), _jsx(Indicator, {}), kyc.step === 1 && _jsx(BasicInformation, {}), kyc.step === 2 && _jsx(IdentityVerification, {}), kyc.step === 3 && _jsx(PersonalInformation, {})] }))] }) })] }) }) }));
22
28
  }