@opexa/portal-components 0.0.204 → 0.0.206

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 (200) hide show
  1. package/dist/client/hooks/useCreatePisoPayDepositMutation.d.ts +4 -0
  2. package/dist/client/hooks/useCreatePisoPayDepositMutation.js +73 -0
  3. package/dist/client/hooks/useCreatePisoPayWithdrawalMutation.d.ts +4 -0
  4. package/dist/client/hooks/useCreatePisoPayWithdrawalMutation.js +28 -0
  5. package/dist/client/hooks/useGlobalStore.d.ts +2 -5
  6. package/dist/client/hooks/useGlobalStore.js +10 -3
  7. package/dist/components/Bonus/Bonus.client.js +1 -1
  8. package/dist/components/Cashback/Cashback.client.js +1 -1
  9. package/dist/components/CustomPromo/CustomPromo.js +1 -1
  10. package/dist/components/DepositWithdrawal/Deposit/Deposit.js +8 -1
  11. package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.d.ts +1 -0
  12. package/dist/components/DepositWithdrawal/Deposit/PisoPayDeposit/PisoPayDeposit.js +182 -0
  13. package/dist/components/DepositWithdrawal/PaymentMethods.js +6 -0
  14. package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.d.ts +1 -0
  15. package/dist/components/DepositWithdrawal/Withdrawal/PisoPayWithdrawal/PisoPayWithdrawal.js +151 -0
  16. package/dist/components/DepositWithdrawal/Withdrawal/Withdrawal.js +8 -1
  17. package/dist/components/DepositWithdrawal/utils.d.ts +1 -1
  18. package/dist/components/DepositWithdrawal/utils.js +1 -0
  19. package/dist/components/GameLaunch/GameLaunch.lazy.js +1 -1
  20. package/dist/components/GamesSearch/GamesSearch.js +1 -1
  21. package/dist/components/Jackpots/JackpotsCarousel/JackpotsCarouselItem.module.css +184 -184
  22. package/dist/components/Jackpots/JackpotsList/JackpotsListItem.module.css +184 -184
  23. package/dist/components/KYC/AutoOpen.js +3 -8
  24. package/dist/components/KYC/BasicInformation.js +16 -12
  25. package/dist/components/KYC/IdentityVerification.js +2 -2
  26. package/dist/components/KYC/Indicator.js +3 -6
  27. package/dist/components/KYC/KYC.js +1 -2
  28. package/dist/components/KYC/KYC.lazy.d.ts +2 -1
  29. package/dist/components/KYC/KYC.lazy.js +16 -11
  30. package/dist/components/KYC/KYCReminder.d.ts +2 -0
  31. package/dist/components/KYC/KYCReminder.js +14 -0
  32. package/dist/components/KYC/KYCReminder.lazy.d.ts +4 -0
  33. package/dist/components/KYC/KYCReminder.lazy.js +30 -0
  34. package/dist/components/KYC/backup/KYCContext.d.ts +5 -1
  35. package/dist/components/KYC/index.d.ts +1 -0
  36. package/dist/components/KYC/index.js +1 -0
  37. package/dist/components/KYC/loadModels.d.ts +1 -0
  38. package/dist/components/KYC/loadModels.js +9 -0
  39. package/dist/components/KYC/utils.js +18 -18
  40. package/dist/components/Messages/MessageContext.d.ts +5 -1
  41. package/dist/components/News/News.js +1 -1
  42. package/dist/components/Promo/Promo.client.js +1 -1
  43. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.d.ts +1 -1
  44. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuest.js +10 -5
  45. package/dist/components/Quests/DailyCheckInQuest/DailyCheckInQuestModal.js +4 -3
  46. package/dist/components/Quests/OnboardingQuest/OnboardingQuest.d.ts +1 -1
  47. package/dist/components/Quests/WageringQuest/WageringQuest.d.ts +1 -1
  48. package/dist/components/Quests/WageringQuest/WageringQuest.js +3 -2
  49. package/dist/components/Quests/WageringQuest/WageringQuestModal.js +4 -3
  50. package/dist/components/Search/Search.lazy.js +1 -1
  51. package/dist/components/SignIn/MobileNumberSignIn.js +6 -5
  52. package/dist/components/SignIn/NameAndPasswordSignIn.js +2 -0
  53. package/dist/components/SignUp/SignUpDefault/SignUpForm.js +11 -8
  54. package/dist/components/SignUp/SignUpForm.js +2 -1
  55. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.d.ts +1 -0
  56. package/dist/components/SignUp/SignUpPagcor/CaptureIdDocument.js +198 -0
  57. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.d.ts +1 -0
  58. package/dist/components/SignUp/SignUpPagcor/CaptureSelfie.js +251 -0
  59. package/dist/components/SignUp/SignUpPagcor/ImageUploader.d.ts +10 -0
  60. package/dist/components/SignUp/SignUpPagcor/ImageUploader.js +41 -0
  61. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.d.ts +1 -0
  62. package/dist/components/SignUp/SignUpPagcor/SignUpFormPagcor.js +429 -0
  63. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.d.ts +13 -0
  64. package/dist/components/SignUp/SignUpPagcor/SignUpPagcor.lazy.js +26 -0
  65. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.d.ts +7 -0
  66. package/dist/components/SignUp/SignUpPagcor/SignUpPagcorContext.js +2 -0
  67. package/dist/components/SignUp/SignUpPagcor/useImageUploader.d.ts +11 -0
  68. package/dist/components/SignUp/SignUpPagcor/useImageUploader.js +20 -0
  69. package/dist/components/Tournaments/TournamentsCarousel/TournamentsCarouselItem.module.css +184 -184
  70. package/dist/components/Tournaments/TournamentsList/TournamentItem.module.css +184 -184
  71. package/dist/constants/BranchCode.d.ts +4 -0
  72. package/dist/constants/BranchCode.js +42 -0
  73. package/dist/constants/PisoPayBanks.d.ts +4 -0
  74. package/dist/constants/PisoPayBanks.js +45 -0
  75. package/dist/constants/StorageKey.d.ts +0 -1
  76. package/dist/constants/StorageKey.js +0 -1
  77. package/dist/images/piso-pay.png +0 -0
  78. package/dist/services/queries.d.ts +2 -0
  79. package/dist/services/queries.js +2504 -2436
  80. package/dist/services/wallet.d.ts +27 -0
  81. package/dist/services/wallet.js +26 -1
  82. package/dist/styles/theme.css +693 -693
  83. package/dist/types/index.d.ts +2 -0
  84. package/dist/utils/mutationKeys.d.ts +2 -0
  85. package/dist/utils/mutationKeys.js +8 -0
  86. package/dist/utils/resizeImageSize.d.ts +1 -0
  87. package/dist/utils/resizeImageSize.js +5 -0
  88. package/package.json +164 -164
  89. package/dist/client/hooks/index.d.ts +0 -65
  90. package/dist/client/hooks/index.js +0 -65
  91. package/dist/client/services/index.d.ts +0 -4
  92. package/dist/client/services/index.js +0 -4
  93. package/dist/client/utils/index.d.ts +0 -3
  94. package/dist/client/utils/index.js +0 -3
  95. package/dist/components/Empty.d.ts +0 -10
  96. package/dist/components/Empty.js +0 -7
  97. package/dist/components/Games/GameContext.d.ts +0 -2
  98. package/dist/components/Games/GameContext.js +0 -2
  99. package/dist/components/InfiniteScroll.d.ts +0 -10
  100. package/dist/components/InfiniteScroll.js +0 -25
  101. package/dist/components/JackpotCounter/JackpotCounter.client.d.ts +0 -2
  102. package/dist/components/JackpotCounter/JackpotCounter.client.js +0 -66
  103. package/dist/components/JackpotCounter/JackpotCounter.d.ts +0 -17
  104. package/dist/components/JackpotCounter/JackpotCounter.js +0 -21
  105. package/dist/components/JackpotCounter/JackpotCounterItem.d.ts +0 -18
  106. package/dist/components/JackpotCounter/JackpotCounterItem.js +0 -109
  107. package/dist/components/JackpotCounter/JackpotCounterItem.module.css +0 -184
  108. package/dist/components/JackpotCounter/index.d.ts +0 -1
  109. package/dist/components/JackpotCounter/index.js +0 -1
  110. package/dist/components/Jackpots/JackpotDesktop.d.ts +0 -1
  111. package/dist/components/Jackpots/JackpotDesktop.js +0 -45
  112. package/dist/components/Jackpots/JackpotGameProviders.d.ts +0 -5
  113. package/dist/components/Jackpots/JackpotGameProviders.js +0 -41
  114. package/dist/components/Jackpots/JackpotItemDesktop.d.ts +0 -9
  115. package/dist/components/Jackpots/JackpotItemDesktop.js +0 -43
  116. package/dist/components/Jackpots/JackpotItemMobile.d.ts +0 -9
  117. package/dist/components/Jackpots/JackpotItemMobile.js +0 -44
  118. package/dist/components/Jackpots/JackpotMobile.d.ts +0 -1
  119. package/dist/components/Jackpots/JackpotMobile.js +0 -46
  120. package/dist/components/Jackpots/JackpotRules.d.ts +0 -5
  121. package/dist/components/Jackpots/JackpotRules.js +0 -11
  122. package/dist/components/Jackpots/Jackpots.client.d.ts +0 -2
  123. package/dist/components/Jackpots/Jackpots.client.js +0 -29
  124. package/dist/components/Jackpots/JackpotsContext.d.ts +0 -4
  125. package/dist/components/Jackpots/JackpotsContext.js +0 -3
  126. package/dist/components/Jackpots/useJackpotData.d.ts +0 -14
  127. package/dist/components/Jackpots/useJackpotData.js +0 -93
  128. package/dist/components/Jackpots/useJackpotItemData.d.ts +0 -20
  129. package/dist/components/Jackpots/useJackpotItemData.js +0 -87
  130. package/dist/components/KYC/Header.d.ts +0 -1
  131. package/dist/components/KYC/Header.js +0 -6
  132. package/dist/components/KYC/Step1.d.ts +0 -1
  133. package/dist/components/KYC/Step1.js +0 -12
  134. package/dist/components/KYC/Step2.d.ts +0 -1
  135. package/dist/components/KYC/Step2.js +0 -12
  136. package/dist/components/KYC/Step3.d.ts +0 -1
  137. package/dist/components/KYC/Step3.js +0 -11
  138. package/dist/components/KYC/Step4.d.ts +0 -1
  139. package/dist/components/KYC/Step4.js +0 -6
  140. package/dist/components/Messages/MessageItem.d.ts +0 -4
  141. package/dist/components/Messages/MessageItem.js +0 -34
  142. package/dist/components/TournamentCounter/TournamentCounter.client.d.ts +0 -2
  143. package/dist/components/TournamentCounter/TournamentCounter.client.js +0 -50
  144. package/dist/components/TournamentCounter/TournamentCounter.d.ts +0 -8
  145. package/dist/components/TournamentCounter/TournamentCounter.js +0 -21
  146. package/dist/components/TournamentCounter/TournamentCounterItem.d.ts +0 -8
  147. package/dist/components/TournamentCounter/TournamentCounterItem.js +0 -106
  148. package/dist/components/TournamentCounter/index.d.ts +0 -1
  149. package/dist/components/TournamentCounter/index.js +0 -1
  150. package/dist/components/Tournaments/TournamentDesktop.d.ts +0 -1
  151. package/dist/components/Tournaments/TournamentDesktop.js +0 -57
  152. package/dist/components/Tournaments/TournamentGameProviders.d.ts +0 -5
  153. package/dist/components/Tournaments/TournamentGameProviders.js +0 -38
  154. package/dist/components/Tournaments/TournamentItemDesktop.d.ts +0 -7
  155. package/dist/components/Tournaments/TournamentItemDesktop.js +0 -56
  156. package/dist/components/Tournaments/TournamentItemMobile.d.ts +0 -7
  157. package/dist/components/Tournaments/TournamentItemMobile.js +0 -54
  158. package/dist/components/Tournaments/TournamentMobile.d.ts +0 -1
  159. package/dist/components/Tournaments/TournamentMobile.js +0 -55
  160. package/dist/components/Tournaments/TournamentRules.d.ts +0 -5
  161. package/dist/components/Tournaments/TournamentRules.js +0 -11
  162. package/dist/components/Tournaments/Tournaments.client.d.ts +0 -2
  163. package/dist/components/Tournaments/Tournaments.client.js +0 -20
  164. package/dist/components/Tournaments/TournamentsContext.d.ts +0 -4
  165. package/dist/components/Tournaments/TournamentsContext.js +0 -3
  166. package/dist/components/Tournaments/useTournamentData.d.ts +0 -10
  167. package/dist/components/Tournaments/useTournamentData.js +0 -72
  168. package/dist/components/Tournaments/useTournamentItemData.d.ts +0 -16
  169. package/dist/components/Tournaments/useTournamentItemData.js +0 -64
  170. package/dist/components/index.d.ts +0 -33
  171. package/dist/components/index.js +0 -33
  172. package/dist/constants/envVars.d.ts +0 -5
  173. package/dist/constants/envVars.js +0 -28
  174. package/dist/constants/gameProviders.d.ts +0 -5
  175. package/dist/constants/gameProviders.js +0 -362
  176. package/dist/constants/gameTypes.d.ts +0 -4
  177. package/dist/constants/gameTypes.js +0 -64
  178. package/dist/constants/headerKeys.d.ts +0 -1
  179. package/dist/constants/headerKeys.js +0 -1
  180. package/dist/constants/secretQuestions.d.ts +0 -3
  181. package/dist/constants/secretQuestions.js +0 -24
  182. package/dist/constants/storageKeys.d.ts +0 -2
  183. package/dist/constants/storageKeys.js +0 -2
  184. package/dist/icons/index.d.ts +0 -65
  185. package/dist/icons/index.js +0 -65
  186. package/dist/images/hacksaw-gaming.png +0 -0
  187. package/dist/server/services/index.d.ts +0 -4
  188. package/dist/server/services/index.js +0 -4
  189. package/dist/server/utils/index.d.ts +0 -29
  190. package/dist/server/utils/index.js +0 -29
  191. package/dist/ui/Presence.d.ts +0 -2
  192. package/dist/ui/Presence.js +0 -7
  193. package/dist/ui/Prose.d.ts +0 -2
  194. package/dist/ui/Prose.js +0 -5
  195. package/dist/ui/index.d.ts +0 -26
  196. package/dist/ui/index.js +0 -26
  197. package/dist/utils/index.d.ts +0 -17
  198. package/dist/utils/index.js +0 -17
  199. package/dist/utils/isMobile.d.ts +0 -5
  200. package/dist/utils/isMobile.js +0 -9
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import { type CreatePisoPayDepositInput } from '../../services/wallet';
3
+ import type { Deposit, Mutation } from '../../types';
4
+ export declare const useCreatePisoPayDepositMutation: Mutation<Deposit, SetOptional<CreatePisoPayDepositInput, 'id'>>;
@@ -0,0 +1,73 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import { clamp } from 'lodash-es';
4
+ import invariant from 'tiny-invariant';
5
+ import { ObjectType } from '../../services/ObjectType.js';
6
+ import { createPisoPayDeposit, getDeposit, } from '../../services/wallet.js';
7
+ import { createPoll } from '../../utils/createPoll.js';
8
+ import { getQueryClient } from '../../utils/getQueryClient.js';
9
+ import { getCreatePisoPayDepositMutationKey } from '../../utils/mutationKeys.js';
10
+ import { parseDecimal } from '../../utils/parseDecimal.js';
11
+ import { getAvailableQuestsQueryKey, getDepositsCountQueryKey, } from '../../utils/queryKeys.js';
12
+ import { getSession } from '../services/getSession.js';
13
+ export const useCreatePisoPayDepositMutation = (config) => {
14
+ const queryClient = getQueryClient();
15
+ const mutation = useMutation({
16
+ ...config,
17
+ mutationKey: getCreatePisoPayDepositMutationKey(),
18
+ mutationFn: async (input) => {
19
+ const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
20
+ const session = await getSession();
21
+ invariant(session.status === 'authenticated');
22
+ await createPisoPayDeposit({ ...input, id }, {
23
+ headers: {
24
+ Authorization: `Bearer ${session.token}`,
25
+ ...(session.domain && {
26
+ Domain: session.domain,
27
+ }),
28
+ },
29
+ });
30
+ const poll = createPoll(async () => {
31
+ const session = await getSession();
32
+ invariant(session.status === 'authenticated');
33
+ return await getDeposit(id, {
34
+ headers: {
35
+ Authorization: `Bearer ${session.token}`,
36
+ },
37
+ });
38
+ }, {
39
+ until(res) {
40
+ return !!res?.checkoutUrl;
41
+ },
42
+ interval: 1000,
43
+ maxAttempt: 5,
44
+ });
45
+ const res = await poll();
46
+ if (!res?.checkoutUrl) {
47
+ const error = new Error();
48
+ error.name = 'PisoPayDepositError';
49
+ error.message = 'Failed to process PisoPay deposit';
50
+ throw error;
51
+ }
52
+ const depositsCount = queryClient.getQueryData(getDepositsCountQueryKey()) ?? 0;
53
+ if (depositsCount <= 0) {
54
+ queryClient.setQueryData(getAvailableQuestsQueryKey(), (prev) => {
55
+ return prev?.map((quest) => {
56
+ const progressPercentage = clamp(parseDecimal(quest.progressPercentage, 0) + 50, 100);
57
+ if (quest.type === 'ONBOARDING') {
58
+ return {
59
+ ...quest,
60
+ status: progressPercentage >= 100 ? 'COMPLETED' : quest.status,
61
+ progressPercentage: progressPercentage.toFixed(2),
62
+ };
63
+ }
64
+ return quest;
65
+ });
66
+ });
67
+ }
68
+ queryClient.setQueryData(getDepositsCountQueryKey(), (prev) => prev ? prev + 1 : 1);
69
+ return res;
70
+ },
71
+ });
72
+ return mutation;
73
+ };
@@ -0,0 +1,4 @@
1
+ import type { SetOptional } from 'type-fest';
2
+ import { type CreatePisoPayWithdrawalInput } from '../../services/wallet';
3
+ import type { Mutation } from '../../types';
4
+ export declare const useCreatePisoPayWithdrawalMutation: Mutation<string, SetOptional<CreatePisoPayWithdrawalInput, 'id'>>;
@@ -0,0 +1,28 @@
1
+ import { ObjectId } from '@opexa/object-id';
2
+ import { useMutation } from '@tanstack/react-query';
3
+ import invariant from 'tiny-invariant';
4
+ import { ObjectType } from '../../services/ObjectType.js';
5
+ import { createPisoPayWithdrawal, } from '../../services/wallet.js';
6
+ import { getCreatePisoPayWithdrawalMutationKey } from '../../utils/mutationKeys.js';
7
+ import { getSession } from '../services/getSession.js';
8
+ export const useCreatePisoPayWithdrawalMutation = (config) => {
9
+ const mutation = useMutation({
10
+ ...config,
11
+ mutationKey: getCreatePisoPayWithdrawalMutationKey(),
12
+ mutationFn: async (input) => {
13
+ const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
14
+ const session = await getSession();
15
+ invariant(session.status === 'authenticated');
16
+ await createPisoPayWithdrawal({ ...input, id }, {
17
+ headers: {
18
+ Authorization: `Bearer ${session.token}`,
19
+ ...(session.domain && {
20
+ Domain: session.domain,
21
+ }),
22
+ },
23
+ });
24
+ return id;
25
+ },
26
+ });
27
+ return mutation;
28
+ };
@@ -4,10 +4,6 @@ export interface PopupStore {
4
4
  setOpen: (open: boolean) => void;
5
5
  '~touched': boolean;
6
6
  }
7
- export interface KYCPopupStore extends PopupStore {
8
- step: number;
9
- setStep: (step: number) => void;
10
- }
11
7
  export type GameLaunchStore__Details = {
12
8
  status: 'WAITING';
13
9
  game?: null;
@@ -64,7 +60,8 @@ interface GlobalStore {
64
60
  message: MessageStore;
65
61
  sidebar: PopupStore;
66
62
  sidebar__mobile: PopupStore;
67
- kyc: KYCPopupStore;
63
+ kyc: PopupStore;
64
+ kycReminder: PopupStore;
68
65
  spotBonus: PopupStore;
69
66
  }
70
67
  export declare const useGlobalStore: import("zustand").UseBoundStore<import("zustand").StoreApi<GlobalStore>>;
@@ -193,12 +193,19 @@ export const useGlobalStore = create((set) => ({
193
193
  },
194
194
  }));
195
195
  },
196
- step: 1,
197
- setStep(step) {
196
+ '~touched': false,
197
+ },
198
+ kycReminder: {
199
+ open: false,
200
+ setOpen(open) {
198
201
  set((prev) => ({
202
+ kycReminder: {
203
+ ...prev.kycReminder,
204
+ open,
205
+ '~touched': true,
206
+ },
199
207
  kyc: {
200
208
  ...prev.kyc,
201
- step,
202
209
  '~touched': true,
203
210
  },
204
211
  }));
@@ -13,7 +13,7 @@ import piggyBank from '../../images/piggy-bank.png';
13
13
  import { Badge } from '../../ui/Badge/index.js';
14
14
  import { Collapsible } from '../../ui/Collapsible/index.js';
15
15
  import { Progress } from '../../ui/Progress/index.js';
16
- import { Prose } from '../../ui/Prose.js';
16
+ import { Prose } from '../../ui/Prose/index.js';
17
17
  import { capitalize } from '../../utils/capitalize.js';
18
18
  import { formatNumber } from '../../utils/formatNumber.js';
19
19
  import { parseDecimal } from '../../utils/parseDecimal.js';
@@ -11,7 +11,7 @@ import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
11
11
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
12
12
  import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
13
13
  import { Button } from '../../ui/Button/index.js';
14
- import { Prose } from '../../ui/Prose.js';
14
+ import { Prose } from '../../ui/Prose/index.js';
15
15
  export function Cashback__client(props) {
16
16
  const availablePromosQuery = useAvailablePromosQuery();
17
17
  const cashbackQuery = useCashbackQuery(props.id);
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
3
3
  import Image from 'next/image';
4
4
  import Link from 'next/link';
5
5
  import { ChevronLeftIcon } from '../../icons/ChevronLeftIcon.js';
6
- import { Prose } from '../../ui/Prose.js';
6
+ import { Prose } from '../../ui/Prose/index.js';
7
7
  import { stripTags } from '../../utils/stripTags.js';
8
8
  export function CustomPromo(props) {
9
9
  return (_jsxs(_Fragment, { children: [_jsx("meta", { name: "description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "og:title", content: props.promo.name }), _jsx("meta", { name: "og:description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "og:image", content: props.promo.banner }), _jsx("meta", { name: "twitter:title", content: props.promo.name }), _jsx("meta", { name: "twitter:description", content: stripTags(props.promo.description) }), _jsx("meta", { name: "twitter:image", content: props.promo.banner }), _jsx("meta", { name: "twitter:card", content: "summary_large_image" }), _jsxs("div", { className: props.className, children: [_jsxs(Link, { href: props.viewAllPromosUrl ?? '/promos', className: "text-button-tertiary-fg flex w-fit items-center gap-lg text-lg font-semibold", children: [_jsx(ChevronLeftIcon, { className: "size-6" }), "Back to all Promotions"] }), _jsx(Image, { src: props.promo.banner, alt: "", width: 1024, height: 600, priority: true, unoptimized: true, className: "mt-xl h-auto w-full rounded-xl lg:mt-6" }), _jsx("h1", { className: "mt-xl text-2xl font-semibold lg:mt-6 lg:text-3xl", children: props.promo.name }), _jsx(Prose, { className: "mt-2xl lg:mt-6", dangerouslySetInnerHTML: {
@@ -12,6 +12,7 @@ import { LibanganDeposit } from './LibanganDeposit/LibanganDeposit.js';
12
12
  import { MayaAppDeposit } from './MayaAppDeposit/MayaAppDeposit.js';
13
13
  import { MayaDeposit } from './MayaDeposit/MayaDeposit.js';
14
14
  import { OnlineBankDeposit } from './OnlineBankDeposit/OnlineBankDeposit.js';
15
+ import { PisoPayDeposit } from './PisoPayDeposit/PisoPayDeposit.js';
15
16
  import { QRPHDeposit } from './QRPHDeposit/QRPHDeposit.js';
16
17
  export function Deposit() {
17
18
  const [onMMA] = useOnMMA();
@@ -38,6 +39,9 @@ export function Deposit() {
38
39
  if (paymentSettings?.libanganDepositGatewaySettings?.mobileWebEnabled) {
39
40
  l.push('LIBANGAN');
40
41
  }
42
+ if (paymentSettings?.pisoPayDepositGatewaySettings?.mobileWebEnabled) {
43
+ l.push('PISO_PAY');
44
+ }
41
45
  }
42
46
  else {
43
47
  if (paymentSettings?.gcashDepositGatewaySettings?.webEnabled) {
@@ -55,6 +59,9 @@ export function Deposit() {
55
59
  if (paymentSettings?.libanganDepositGatewaySettings?.webEnabled) {
56
60
  l.push('LIBANGAN');
57
61
  }
62
+ if (paymentSettings?.pisoPayDepositGatewaySettings?.webEnabled) {
63
+ l.push('PISO_PAY');
64
+ }
58
65
  }
59
66
  return l;
60
67
  })();
@@ -75,7 +82,7 @@ export function Deposit() {
75
82
  if (enabledPaymentMethods.length <= 0) {
76
83
  return _jsx(NoAvailablePaymentMethods, {});
77
84
  }
78
- return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN' && _jsx(LibanganDeposit, {})] }));
85
+ return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'QRPH' && _jsx(QRPHDeposit, {}), paymentMethod === 'GCASH' && _jsx(GCashDeposit, {}), paymentMethod === 'MAYA' && _jsx(MayaDeposit, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppDeposit, {}), paymentMethod === 'ONLINE_BANK' && _jsx(OnlineBankDeposit, {}), paymentMethod === 'LIBANGAN' && _jsx(LibanganDeposit, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayDeposit, {})] }));
79
86
  }
80
87
  function MayaSessionSessionExpired() {
81
88
  return (_jsxs("div", { className: "py-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Session Expired" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "Your session has timed out. To continue with deposits or withdrawals, Please try reloading the app." })] }));
@@ -0,0 +1 @@
1
+ export declare function PisoPayDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,182 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { zodResolver } from '@hookform/resolvers/zod';
3
+ import { ObjectId } from '@opexa/object-id';
4
+ import Link from 'next/link';
5
+ import { useEffect, useState } from 'react';
6
+ import { Controller, useForm } from 'react-hook-form';
7
+ import invariant from 'tiny-invariant';
8
+ import { z } from 'zod';
9
+ import { useShallow } from 'zustand/shallow';
10
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
11
+ import { useCreatePisoPayDepositMutation } from '../../../../client/hooks/useCreatePisoPayDepositMutation.js';
12
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
13
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
14
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
15
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
16
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
17
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
18
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
19
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
20
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
21
+ import { XIcon } from '../../../../icons/XIcon.js';
22
+ import { ObjectType } from '../../../../services/ObjectType.js';
23
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
24
+ import { Button } from '../../../../ui/Button/index.js';
25
+ import { Field } from '../../../../ui/Field/index.js';
26
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
27
+ import { Portal } from '../../../../ui/Portal/index.js';
28
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
29
+ import { AmountChoices } from '../../AmountChoices.js';
30
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
31
+ import { AvailablePromos } from '../AvailablePromos.js';
32
+ export function PisoPayDeposit() {
33
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
34
+ const disclosure = useDisclosure();
35
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
36
+ depositWithdrawal: ctx.depositWithdrawal,
37
+ })));
38
+ const [status, setStatus] = useState('waiting');
39
+ const createDepositMutation = useCreatePisoPayDepositMutation({
40
+ onMutate() {
41
+ disclosure.setOpen(true);
42
+ setStatus('processing');
43
+ },
44
+ onSuccess(data) {
45
+ invariant(data.checkoutUrl);
46
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
47
+ form.reset();
48
+ disclosure.setOpen(false);
49
+ },
50
+ onError() {
51
+ disclosure.setOpen(true);
52
+ setStatus('failed');
53
+ },
54
+ });
55
+ const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
56
+ enabled: createDepositMutation.data != null,
57
+ refetchInterval(ctx) {
58
+ if (ctx.state.data?.status === 'CANCELLED' ||
59
+ ctx.state.data?.status === 'CONFIRMED') {
60
+ return false;
61
+ }
62
+ else {
63
+ return 2500;
64
+ }
65
+ },
66
+ });
67
+ useEffect(() => {
68
+ if (depositQuery.data?.status === 'CANCELLED') {
69
+ disclosure.setOpen(true);
70
+ setStatus('failed');
71
+ }
72
+ else if (depositQuery.data?.status === 'CONFIRMED') {
73
+ disclosure.setOpen(true);
74
+ setStatus('success');
75
+ }
76
+ }, [depositQuery.data?.status, disclosure]);
77
+ const depositsCountQuery = useDepositsCountQuery();
78
+ const depositsCount = depositsCountQuery.data ?? 0;
79
+ const paymentSettingsQuery = usePaymentSettingsQuery();
80
+ const paymentSettings = paymentSettingsQuery.data;
81
+ const gatewaySettings = paymentSettings?.pisoPayDepositGatewaySettings;
82
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
83
+ const minimumAmount = depositsCount <= 0
84
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
85
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
86
+ const promosQuery = useAvailablePromosQuery();
87
+ const promos = promosQuery.data ?? [];
88
+ const definition = z
89
+ .object({
90
+ amount: z.string().superRefine((val, ctx) => {
91
+ const n = parseDecimal(val, 0);
92
+ if (n < minimumAmount) {
93
+ ctx.addIssue({
94
+ type: 'number',
95
+ code: z.ZodIssueCode.too_small,
96
+ inclusive: true,
97
+ minimum: minimumAmount,
98
+ message: `Minimum amount is ${minimumAmount.toLocaleString()}`,
99
+ });
100
+ }
101
+ if (n > maximumAmount) {
102
+ ctx.addIssue({
103
+ type: 'number',
104
+ code: z.ZodIssueCode.too_big,
105
+ inclusive: true,
106
+ maximum: maximumAmount,
107
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
108
+ });
109
+ }
110
+ }),
111
+ promo: z.string().optional().nullable(),
112
+ })
113
+ .superRefine((value, ctx) => {
114
+ const promo = promos.find((o) => o.id === value.promo);
115
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
116
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
117
+ const amount = parseDecimal(value.amount, 0);
118
+ if (promo && amount < promoMinAmount) {
119
+ ctx.addIssue({
120
+ path: ['amount'],
121
+ code: z.ZodIssueCode.custom,
122
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
123
+ });
124
+ }
125
+ if (promo && amount > promoMaxAmount) {
126
+ ctx.addIssue({
127
+ path: ['amount'],
128
+ code: z.ZodIssueCode.custom,
129
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
130
+ });
131
+ }
132
+ });
133
+ const form = useForm({
134
+ mode: 'all',
135
+ resolver: zodResolver(definition),
136
+ defaultValues: {
137
+ amount: '0',
138
+ promo: globalStore.depositWithdrawal.promo ?? null,
139
+ },
140
+ });
141
+ useEffect(() => {
142
+ if (minimumAmount) {
143
+ form.reset({
144
+ amount: minimumAmount.toString(),
145
+ promo: form.getValues('promo') ?? null,
146
+ });
147
+ }
148
+ }, [form, minimumAmount]);
149
+ const depositId = ObjectId.generate(ObjectType.Deposit).toString();
150
+ const url = new URL(window.location.href);
151
+ const rootDomain = url.hostname;
152
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
153
+ createDepositMutation.reset();
154
+ createDepositMutation.mutate({
155
+ id: depositId,
156
+ amount: data.amount.toString(),
157
+ promo: data.promo ?? undefined,
158
+ redirectionUrl: `${rootDomain}/pisopay/checkout/${depositId}`,
159
+ });
160
+ }), noValidate: true, children: [_jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
161
+ o.field.onChange(details.value);
162
+ }, formatOptions: {
163
+ maximumFractionDigits: 2,
164
+ minimumFractionDigits: 0,
165
+ }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to deposit" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
166
+ form.setValue('amount', value.toString(), {
167
+ shouldTouch: true,
168
+ shouldDirty: true,
169
+ shouldValidate: true,
170
+ });
171
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
172
+ o.field.onChange(value);
173
+ globalStore.depositWithdrawal.setPromo(null);
174
+ }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "text-text-tertiary-600 mt-lg text-xs", children: ["By depositing, you agree to our", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.privacyPolicyUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "text-text-warning-primary-600 underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(AlertDialog.Root, { open: disclosure.open, onOpenChange: (details) => {
175
+ disclosure.setOpen(details.open);
176
+ }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' && 'Deposit Successful', status === 'failed' && 'Deposit Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
177
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
178
+ 'Your deposit has been successfully processed.', status === 'failed' &&
179
+ 'Something went wrong while processing your deposit. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
180
+ api.setOpen(false);
181
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
182
+ }
@@ -9,6 +9,7 @@ import instapay from '../../images/instapay.png';
9
9
  import libangan from '../../images/libangan.png';
10
10
  import maya from '../../images/maya.png';
11
11
  import onlineBank from '../../images/online-bank.png';
12
+ import pisoPay from '../../images/piso-pay.png';
12
13
  import { Checkbox } from '../../ui/Checkbox/index.js';
13
14
  import { Field } from '../../ui/Field/index.js';
14
15
  import { PaymentMethodDefinition } from './utils.js';
@@ -48,6 +49,11 @@ const OPTIONS = [
48
49
  label: 'Libangan',
49
50
  image: libangan,
50
51
  },
52
+ {
53
+ value: 'PISO_PAY',
54
+ label: 'Piso Pay',
55
+ image: pisoPay,
56
+ },
51
57
  ];
52
58
  export function PaymentMethods(props) {
53
59
  const options = props.options?.length
@@ -0,0 +1 @@
1
+ export declare function PisoPayWithdrawal(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,151 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createListCollection } from '@ark-ui/react/collection';
3
+ import { zodResolver } from '@hookform/resolvers/zod';
4
+ import Link from 'next/link';
5
+ import { useEffect, useMemo, useState } from 'react';
6
+ import { Controller, useForm } from 'react-hook-form';
7
+ import { z } from 'zod';
8
+ import { useShallow } from 'zustand/shallow';
9
+ import { useCreatePisoPayWithdrawalMutation } from '../../../../client/hooks/useCreatePisoPayWithdrawalMutation.js';
10
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
11
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
12
+ import { PISO_PAY_BANKS } from '../../../../constants/PisoPayBanks.js';
13
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
14
+ import { CheckIcon } from '../../../../icons/CheckIcon.js';
15
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
16
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
17
+ import { EyeIcon } from '../../../../icons/EyeIcon.js';
18
+ import { EyeOffIcon } from '../../../../icons/EyeOffIcon.js';
19
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
20
+ import { XIcon } from '../../../../icons/XIcon.js';
21
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
22
+ import { Button } from '../../../../ui/Button/index.js';
23
+ import { Field } from '../../../../ui/Field/index.js';
24
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
25
+ import { PasswordInput } from '../../../../ui/PasswordInput/index.js';
26
+ import { Portal } from '../../../../ui/Portal/index.js';
27
+ import { Select } from '../../../../ui/Select/index.js';
28
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
29
+ import { AmountChoices } from '../../AmountChoices.js';
30
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
31
+ export function PisoPayWithdrawal() {
32
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
33
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
34
+ depositWithdrawal: ctx.depositWithdrawal,
35
+ })));
36
+ const [status, setStatus] = useState('waiting');
37
+ const createWithdrawalMutation = useCreatePisoPayWithdrawalMutation({
38
+ onMutate() {
39
+ setStatus('processing');
40
+ },
41
+ onSuccess() {
42
+ form.reset();
43
+ setStatus('success');
44
+ },
45
+ onError() {
46
+ setStatus('failed');
47
+ },
48
+ });
49
+ const paymentSettingsQuery = usePaymentSettingsQuery();
50
+ const paymentSettings = paymentSettingsQuery.data;
51
+ const gatewaySettings = paymentSettings?.pisoPayWithdrawalGatewaySettings;
52
+ const minimumAmount = parseDecimal(gatewaySettings?.minimumAmount, 0);
53
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
54
+ const definition = z.object({
55
+ amount: z.string().superRefine((val, ctx) => {
56
+ const n = parseDecimal(val, 0);
57
+ if (n < minimumAmount) {
58
+ ctx.addIssue({
59
+ type: 'number',
60
+ code: z.ZodIssueCode.too_small,
61
+ inclusive: true,
62
+ minimum: minimumAmount,
63
+ message: `Minimum amount is ${minimumAmount.toLocaleString()}`,
64
+ });
65
+ }
66
+ if (n > maximumAmount) {
67
+ ctx.addIssue({
68
+ type: 'number',
69
+ code: z.ZodIssueCode.too_big,
70
+ inclusive: true,
71
+ maximum: maximumAmount,
72
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
73
+ });
74
+ }
75
+ }),
76
+ password: z
77
+ .string()
78
+ .min(8, 'Password must be 8 or more characters')
79
+ .max(64, 'Password must be not be more than 64 characters'),
80
+ accountNumber: z.string().min(1).trim(),
81
+ bankCode: z.string().min(1, 'Bank is required').trim(),
82
+ });
83
+ const form = useForm({
84
+ mode: 'all',
85
+ resolver: zodResolver(definition),
86
+ defaultValues: {
87
+ amount: '0',
88
+ password: '',
89
+ accountNumber: '',
90
+ bankCode: '',
91
+ },
92
+ });
93
+ useEffect(() => {
94
+ if (minimumAmount) {
95
+ form.reset({
96
+ amount: minimumAmount.toString(),
97
+ bankCode: form.getValues('bankCode'),
98
+ password: '',
99
+ accountNumber: '',
100
+ });
101
+ }
102
+ }, [form, minimumAmount]);
103
+ useEffect(() => {
104
+ if (PISO_PAY_BANKS?.length) {
105
+ form.reset({
106
+ amount: form.getValues('amount'),
107
+ bankCode: PISO_PAY_BANKS[0].code,
108
+ password: '',
109
+ accountNumber: '',
110
+ });
111
+ }
112
+ }, [form]);
113
+ const handleSubmit = form.handleSubmit(async (data) => {
114
+ createWithdrawalMutation.mutate({
115
+ amount: data.amount,
116
+ transactionPassword: data.password,
117
+ accountNumber: data.accountNumber,
118
+ bankCode: data.bankCode,
119
+ });
120
+ });
121
+ const bankCollection = useMemo(() => createListCollection({
122
+ items: PISO_PAY_BANKS ?? [],
123
+ itemToValue: (item) => item.code,
124
+ itemToString: (item) => item.name,
125
+ }), []);
126
+ return (_jsxs("form", { onSubmit: handleSubmit, noValidate: true, autoComplete: "off", children: [_jsx(Controller, { control: form.control, name: "bankCode", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.bankCode, children: [_jsxs(Select.Root, { collection: bankCollection, positioning: {
127
+ sameWidth: true,
128
+ }, value: o.field.value ? [o.field.value] : [], onValueChange: (details) => {
129
+ o.field.onChange(details.value.at(0) ?? '');
130
+ }, children: [_jsx(Select.Label, { children: "Bank" }), _jsx(Select.Control, { children: _jsxs(Select.Trigger, { children: [_jsx(Select.ValueText, {}), _jsx(Select.Indicator, { asChild: true, children: _jsx(ChevronDownIcon, {}) })] }) }), _jsx(Select.Positioner, { children: _jsx(Select.Content, { children: _jsx(Select.ItemGroup, { children: bankCollection.items.map((item, index) => (_jsxs(Select.Item, { item: item, children: [_jsx(Select.ItemText, { children: item.name }), _jsx(Select.ItemIndicator, { asChild: true, children: _jsx(CheckIcon, {}) })] }, index))) }) }) })] }), _jsx(Field.ErrorText, { children: form.formState.errors.bankCode?.message })] })) }), _jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, className: "mt-3xl", children: [_jsx(Field.Label, { children: "Bank account number" }), _jsx(Field.Input, { ...form.register('accountNumber') }), _jsx(Field.ErrorText, { children: form.formState.errors.accountNumber?.message })] }), _jsx(Controller, { control: form.control, name: "amount", render: (o) => (_jsxs(Field.Root, { invalid: !!form.formState.errors.amount, className: "mt-3xl", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
131
+ o.field.onChange(details.value);
132
+ }, formatOptions: {
133
+ maximumFractionDigits: 2,
134
+ minimumFractionDigits: 0,
135
+ }, allowMouseWheel: true, children: [_jsx(NumberInput.Label, { children: "Enter amount you want to withdraw" }), _jsxs(NumberInput.Control, { children: [_jsx(NumberInput.Input, {}), _jsx(NumberInput.IncrementTrigger, { children: _jsx(ChevronUpIcon, {}) }), _jsx(NumberInput.DecrementTrigger, { children: _jsx(ChevronDownIcon, {}) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.amount?.message })] })) }), _jsx(AmountChoices, { value: parseDecimal(form.watch('amount'), 0), onChange: (value) => {
136
+ form.setValue('amount', value.toString(), {
137
+ shouldTouch: true,
138
+ shouldDirty: true,
139
+ shouldValidate: true,
140
+ });
141
+ }, min: minimumAmount, max: maximumAmount, className: "mt-xl" }), _jsxs(Field.Root, { className: "mt-3xl", invalid: !!form.formState.errors.password, children: [_jsxs(PasswordInput.Root, { children: [_jsx(PasswordInput.Label, { children: "Password" }), _jsxs(PasswordInput.Control, { children: [_jsx(PasswordInput.Input, { ...form.register('password') }), _jsx(PasswordInput.VisibilityTrigger, { children: _jsx(PasswordInput.Indicator, { fallback: _jsx(EyeOffIcon, {}), asChild: true, children: _jsx(EyeIcon, {}) }) })] })] }), _jsx(Field.ErrorText, { children: form.formState.errors.password?.message })] }), _jsxs("p", { className: "mt-4xl text-xs", children: ["Upon clicking the deposit button, you agree to the", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/terms-of-use', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "underline underline-offset-2", children: "Terms of Use" }), ' ', "and", ' ', _jsx(Link, { href: depositWithdrawalProps.termsOfUseUrl ?? '/privacy-policy', onClick: () => globalStore.depositWithdrawal.setOpen(false), className: "underline underline-offset-2", children: "Privacy Policy" }), "."] }), _jsx(Button, { type: "submit", className: "mt-4.5", disabled: createWithdrawalMutation.isPending, children: "Withdraw" }), _jsx(AlertDialog.Root, { open: status !== 'waiting', onOpenChange: (details) => {
142
+ if (!details.open) {
143
+ setStatus('waiting');
144
+ }
145
+ }, lazyMount: true, unmountOnExit: true, children: _jsxs(Portal, { children: [_jsx(AlertDialog.Backdrop, { className: "!z-[calc(var(--z-dialog)+2)]" }), _jsx(AlertDialog.Positioner, { className: "!z-[calc(var(--z-dialog)+3)]", children: _jsxs(AlertDialog.Content, { children: [_jsx(AlertDialog.CloseTrigger, { disabled: status === 'processing', children: _jsx(XIcon, {}) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "text-text-brand-primary-600 size-12" })), status === 'success' && (_jsx("div", { className: "bg-bg-success-secondary text-text-featured-icon-light-success flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "bg-bg-error-secondary text-text-featured-icon-light-error flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Withdraw', status === 'success' && 'Withdrawal Submitted', status === 'failed' && 'Withdraw Failed'] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
146
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
147
+ 'Your withdrawal request has been submitted successfully and is awaiting confirmation. You won’t have to wait long — once approved, the funds will be credited to your account.', status === 'failed' &&
148
+ 'Something went wrong while processing your withdrawal. Please try again or contact support.'] })] }), (status === 'failed' || status === 'success') && (_jsx(AlertDialog.Footer, { children: _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => {
149
+ api.setOpen(false);
150
+ }, children: status === 'failed' ? 'Try Again' : 'Ok' })) }) }))] }) })] }) })] }));
151
+ }
@@ -18,6 +18,7 @@ import { GCashWithdrawal } from './GCashWithdrawal/GCashWithdrawal.js';
18
18
  import { InstapayWithdrawal } from './InstapayWithdrawal/InstapayWithdrawal.js';
19
19
  import { MayaAppWithdrawal } from './MayaAppWithdrawal/MayaAppWithdrawal.js';
20
20
  import { MayaWithdrawal } from './MayaWithdrawal/MayaWithdrawal.js';
21
+ import { PisoPayWithdrawal } from './PisoPayWithdrawal/PisoPayWithdrawal.js';
21
22
  import { VentajaWithdrawal } from './VentajaWithdrawal/VentajaWithdrawal.js';
22
23
  export function Withdrawal() {
23
24
  const [onMMA] = useOnMMA();
@@ -49,6 +50,9 @@ export function Withdrawal() {
49
50
  if (paymentSettings?.ventajaWithdrawalGatewaySettings?.mobileWebEnabled) {
50
51
  l.push('VENTAJA');
51
52
  }
53
+ if (paymentSettings?.pisoPayWithdrawalGatewaySettings?.mobileWebEnabled) {
54
+ l.push('PISO_PAY');
55
+ }
52
56
  }
53
57
  else {
54
58
  if (paymentSettings?.gcashWithdrawalGatewaySettings?.webEnabled) {
@@ -63,6 +67,9 @@ export function Withdrawal() {
63
67
  if (paymentSettings?.ventajaWithdrawalGatewaySettings?.mobileWebEnabled) {
64
68
  l.push('VENTAJA');
65
69
  }
70
+ if (paymentSettings?.pisoPayWithdrawalGatewaySettings?.mobileWebEnabled) {
71
+ l.push('PISO_PAY');
72
+ }
66
73
  }
67
74
  return l;
68
75
  })();
@@ -96,7 +103,7 @@ export function Withdrawal() {
96
103
  if (enabledPaymentMethods.length <= 0) {
97
104
  return _jsx(NoAvailablePaymentMethods, {});
98
105
  }
99
- return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {}), paymentMethod === 'VENTAJA' && _jsx(VentajaWithdrawal, {})] }));
106
+ return (_jsxs(_Fragment, { children: [_jsx(PaymentMethods, { value: paymentMethod, onChange: setPaymentMethod, options: enabledPaymentMethods }), paymentMethod === 'GCASH' && _jsx(GCashWithdrawal, {}), paymentMethod === 'MAYA' && _jsx(MayaWithdrawal, {}), paymentMethod === 'MAYA_APP' && _jsx(MayaAppWithdrawal, {}), paymentMethod === 'INSTAPAY' && _jsx(InstapayWithdrawal, {}), paymentMethod === 'VENTAJA' && _jsx(VentajaWithdrawal, {}), paymentMethod === 'PISO_PAY' && _jsx(PisoPayWithdrawal, {})] }));
100
107
  }
101
108
  function TransactionPasswordNotSet() {
102
109
  return (_jsxs("div", { className: "pt-xl", children: [_jsx("div", { className: "bg-bg-warning-secondary mx-auto flex size-12 items-center justify-center rounded-full", children: _jsx(AlertCircleIcon, { className: "text-text-featured-icon-light-warning size-6" }) }), _jsx("h2", { className: "mt-lg text-center text-lg font-semibold", children: "Transaction Password Not Set" }), _jsx("p", { className: "text-text-tertiary-600 mx-auto mt-xs max-w-[25rem] text-center text-sm", children: "To proceed with withdrawals, you must first set up a transaction password. This ensures the security of your account and transactions." })] }));