@opexa/portal-components 0.0.1120 → 0.0.1121

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 (63) hide show
  1. package/dist/__tests__/utils/mocks.d.ts +1 -1
  2. package/dist/client/hooks/useVerifyMobileNumber.d.ts +3 -0
  3. package/dist/client/hooks/useVerifyMobileNumber.js +20 -0
  4. package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.d.ts +1 -0
  5. package/dist/components/DepositWithdrawal/Deposit/AurixPayPayMayaDeposit/AurixPayGrabPayDeposit.js +241 -0
  6. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/AurixPayQRPHDepositContext.d.ts +2 -2
  7. package/dist/components/DepositWithdrawal/Deposit/AurixPayQRPHDeposit/useAurixPayQRPHDeposit.d.ts +1 -1
  8. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
  9. package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
  10. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/QRPHDepositContext.d.ts +2 -2
  11. package/dist/components/DepositWithdrawal/Deposit/QRPHDeposit/useQRPHDeposit.d.ts +1 -1
  12. package/dist/components/KYC/KYCReview.js +33 -4
  13. package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +7 -4
  14. package/dist/components/SingleSignOn/SingleSignOn.d.ts +4 -0
  15. package/dist/components/SingleSignOn/SingleSignOn.js +185 -0
  16. package/dist/components/SingleSignOn/index.d.ts +1 -0
  17. package/dist/components/SingleSignOn/index.js +1 -0
  18. package/dist/components/UpdateMobileNumber/UpdateMobileNumber.d.ts +3 -0
  19. package/dist/components/UpdateMobileNumber/UpdateMobileNumber.js +141 -0
  20. package/dist/components/UpdateMobileNumber/index.d.ts +1 -0
  21. package/dist/components/UpdateMobileNumber/index.js +1 -0
  22. package/dist/lib/components/UpdateMobileNumber/UpdateMobileNumber.d.ts +1 -0
  23. package/dist/lib/components/UpdateMobileNumber/UpdateMobileNumber.js +154 -0
  24. package/dist/lib/components/UpdateMobileNumber/index.d.ts +1 -0
  25. package/dist/lib/components/UpdateMobileNumber/index.js +1 -0
  26. package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
  27. package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
  28. package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
  29. package/dist/ui/Carousel/Carousel.d.ts +72 -72
  30. package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
  31. package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
  32. package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
  33. package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
  34. package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
  35. package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
  36. package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
  37. package/dist/ui/Combobox/Combobox.d.ts +42 -42
  38. package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
  39. package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
  40. package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
  41. package/dist/ui/Dialog/Dialog.d.ts +33 -33
  42. package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
  43. package/dist/ui/Drawer/Drawer.d.ts +33 -33
  44. package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
  45. package/dist/ui/Menu/Menu.d.ts +252 -252
  46. package/dist/ui/Menu/menu.recipe.d.ts +14 -14
  47. package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
  48. package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
  49. package/dist/ui/Popover/Popover.d.ts +88 -88
  50. package/dist/ui/Popover/popover.recipe.d.ts +8 -8
  51. package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
  52. package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
  53. package/dist/ui/Select/Select.d.ts +45 -45
  54. package/dist/ui/Select/select.recipe.d.ts +3 -3
  55. package/dist/ui/Table/Table.d.ts +21 -21
  56. package/dist/ui/Table/table.anatomy.d.ts +1 -1
  57. package/dist/ui/Table/table.recipe.d.ts +3 -3
  58. package/dist/ui/Tabs/Tabs.d.ts +15 -15
  59. package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
  60. package/dist/ui/Tooltip/Tooltip.d.ts +30 -30
  61. package/dist/ui/Tooltip/tooltip.recipe.d.ts +5 -5
  62. package/dist/utils/isDisposableEmail.js +4 -4
  63. package/package.json +1 -1
@@ -165,7 +165,7 @@ export declare function createMockSignOutMutation(): {
165
165
  */
166
166
  export declare function createMockMemberVerificationQuery(status?: 'VERIFIED' | 'PENDING' | 'REJECTED' | 'MISSING' | 'APPROVED', isLoading?: boolean): {
167
167
  data: {
168
- status: "PENDING" | "APPROVED" | "REJECTED" | "VERIFIED" | "MISSING";
168
+ status: "VERIFIED" | "PENDING" | "REJECTED" | "MISSING" | "APPROVED";
169
169
  };
170
170
  isLoading: boolean;
171
171
  isError: boolean;
@@ -0,0 +1,3 @@
1
+ import { type VerifyMobileNumberInput } from '../../services/account';
2
+ import type { Mutation } from '../../types';
3
+ export declare const useVerifyMobileNumber: Mutation<void, VerifyMobileNumberInput>;
@@ -0,0 +1,20 @@
1
+ import { useMutation } from '@tanstack/react-query';
2
+ import invariant from 'tiny-invariant';
3
+ import { verifyMobileNumber, } from '../../services/account.js';
4
+ import { getVerifyMobileNumberMutationKey } from '../../utils/mutationKeys.js';
5
+ import { getSession } from '../services/getSession.js';
6
+ export const useVerifyMobileNumber = (config) => {
7
+ return useMutation({
8
+ ...config,
9
+ mutationKey: getVerifyMobileNumberMutationKey(),
10
+ mutationFn: async (input) => {
11
+ const session = await getSession();
12
+ invariant(session.status === 'authenticated');
13
+ await verifyMobileNumber(input.verificationCode, {
14
+ headers: {
15
+ Authorization: `Bearer ${session.token}`,
16
+ },
17
+ });
18
+ },
19
+ });
20
+ };
@@ -0,0 +1 @@
1
+ export declare function AurixPayGrabPayDeposit(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,241 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } 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 { useBoolean } from 'usehooks-ts';
9
+ import { z } from 'zod';
10
+ import { useShallow } from 'zustand/shallow';
11
+ import { useAvailablePromosQuery } from '../../../../client/hooks/useAvailablePromosQuery.js';
12
+ import { useCreateAurixPayGrabPayDepositMutation } from '../../../../client/hooks/useCreateAurixPayGrabPayDepositMutation.js';
13
+ import { useDepositQuery } from '../../../../client/hooks/useDepositQuery.js';
14
+ import { useDepositsCountQuery } from '../../../../client/hooks/useDepositsCountQuery.js';
15
+ import { useDisclosure } from '../../../../client/hooks/useDisclosure.js';
16
+ import { useGlobalStore } from '../../../../client/hooks/useGlobalStore.js';
17
+ import { useMemberVerificationQuery } from '../../../../client/hooks/useMemberVerificationQuery.js';
18
+ import { usePaymentSettingsQuery } from '../../../../client/hooks/usePaymentSettingsQuery.js';
19
+ import { AlertCircleIcon } from '../../../../icons/AlertCircleIcon.js';
20
+ import { ChevronDownIcon } from '../../../../icons/ChevronDownIcon.js';
21
+ import { ChevronUpIcon } from '../../../../icons/ChevronUpIcon.js';
22
+ import { RefreshCcw01Icon } from '../../../../icons/RefreshCcw01Icon.js';
23
+ import { SpinnerIcon } from '../../../../icons/SpinnerIcon.js';
24
+ import { XIcon } from '../../../../icons/XIcon.js';
25
+ import { ObjectType } from '../../../../services/ObjectType.js';
26
+ import { AlertDialog } from '../../../../ui/AlertDialog/index.js';
27
+ import { Button } from '../../../../ui/Button/index.js';
28
+ import { Field } from '../../../../ui/Field/index.js';
29
+ import { NumberInput } from '../../../../ui/NumberInput/index.js';
30
+ import { Portal } from '../../../../ui/Portal/index.js';
31
+ import { getQueryClient } from '../../../../utils/getQueryClient.js';
32
+ import { parseDecimal } from '../../../../utils/parseDecimal.js';
33
+ import { getDepositsCountQueryKey } from '../../../../utils/queryKeys.js';
34
+ import { AmountChoices } from '../../AmountChoices.js';
35
+ import { useDepositWithdrawalPropsContext } from '../../DepositWithdrawalContext.js';
36
+ import { AvailablePromos } from '../AvailablePromos.js';
37
+ export function AurixPayGrabPayDeposit() {
38
+ const depositWithdrawalProps = useDepositWithdrawalPropsContext();
39
+ const disclosure = useDisclosure({
40
+ onOpenChange(open) {
41
+ if (!open) {
42
+ form.reset();
43
+ }
44
+ },
45
+ });
46
+ const globalStore = useGlobalStore(useShallow((ctx) => ({
47
+ depositWithdrawal: ctx.depositWithdrawal,
48
+ kycVerificationStatus: ctx.kycVerificationStatus,
49
+ })));
50
+ const verificationQuery = useMemberVerificationQuery();
51
+ const verificationStatus = verificationQuery.data?.status ?? 'UNVERIFIED';
52
+ const [status, setStatus] = useState('waiting');
53
+ const [errorMessage, setErrorMessage] = useState(null);
54
+ const createDepositMutation = useCreateAurixPayGrabPayDepositMutation({
55
+ onMutate() {
56
+ disclosure.setOpen(true);
57
+ setStatus('processing');
58
+ },
59
+ onSuccess(data) {
60
+ const queryClient = getQueryClient();
61
+ invariant(data.checkoutUrl);
62
+ window.open(data.checkoutUrl, '_blank', 'noopener,noreferrer');
63
+ queryClient.invalidateQueries({
64
+ queryKey: getDepositsCountQueryKey(),
65
+ });
66
+ setStatus('success');
67
+ },
68
+ onError(data) {
69
+ setStatus('failed');
70
+ setErrorMessage({
71
+ name: data.name,
72
+ message: data.message,
73
+ });
74
+ },
75
+ });
76
+ const warn = useBoolean();
77
+ const depositQuery = useDepositQuery(createDepositMutation.data?.id, {
78
+ enabled: !warn.value && status === 'success',
79
+ refetchInterval: (ctx) => ctx.state.data?.status === 'CONFIRMED' ||
80
+ ctx.state.data?.status === 'REJECTED' ||
81
+ ctx.state.data?.status === 'CANCELLED'
82
+ ? false
83
+ : 1000,
84
+ });
85
+ useEffect(() => {
86
+ if (depositQuery.data?.status === 'CONFIRMED') {
87
+ setStatus('confirmed');
88
+ return;
89
+ }
90
+ if (depositQuery.data?.status === 'REJECTED' ||
91
+ depositQuery.data?.status === 'CANCELLED') {
92
+ setStatus('failed');
93
+ return;
94
+ }
95
+ }, [depositQuery.data?.status]);
96
+ const depositsCountQuery = useDepositsCountQuery();
97
+ const depositsCount = depositsCountQuery.data ?? 0;
98
+ const paymentSettingsQuery = usePaymentSettingsQuery();
99
+ const paymentSettings = paymentSettingsQuery.data;
100
+ const gatewaySettings = paymentSettings?.aioGCashDepositGatewaySettings;
101
+ const maximumAmount = parseDecimal(gatewaySettings?.maximumAmount, 0);
102
+ const minimumAmount = depositsCount <= 0
103
+ ? parseDecimal(paymentSettingsQuery.data?.minimumFirstDepositAmount, 0)
104
+ : parseDecimal(gatewaySettings?.minimumAmount, 0);
105
+ const promosQuery = useAvailablePromosQuery();
106
+ const promos = promosQuery.data ?? [];
107
+ const definition = z
108
+ .object({
109
+ amount: z.string().superRefine((val, ctx) => {
110
+ const n = parseDecimal(val, 0);
111
+ if (n < minimumAmount) {
112
+ ctx.addIssue({
113
+ type: 'number',
114
+ code: z.ZodIssueCode.too_small,
115
+ inclusive: true,
116
+ minimum: minimumAmount,
117
+ message: `Please enter ${minimumAmount.toLocaleString()} or more to proceed with your deposit.`,
118
+ });
119
+ }
120
+ if (n > maximumAmount) {
121
+ ctx.addIssue({
122
+ type: 'number',
123
+ code: z.ZodIssueCode.too_big,
124
+ inclusive: true,
125
+ maximum: maximumAmount,
126
+ message: `Maximum amount is ${maximumAmount.toLocaleString()}`,
127
+ });
128
+ }
129
+ }),
130
+ promo: z.string().optional().nullable(),
131
+ accountNumber: z
132
+ .string()
133
+ .min(1, 'Account number is required')
134
+ .min(8, 'Account number must be 8 or more characters')
135
+ .max(32, 'Account number must not be more than 32 characters'),
136
+ })
137
+ .superRefine((value, ctx) => {
138
+ const promo = promos.find((o) => o.id === value.promo);
139
+ const promoMinAmount = parseDecimal(promo?.minimumDepositAmount, 0);
140
+ const promoMaxAmount = parseDecimal(promo?.maximumDepositAmount, 0);
141
+ const amount = parseDecimal(value.amount, 0);
142
+ if (promo && amount < promoMinAmount) {
143
+ ctx.addIssue({
144
+ path: ['amount'],
145
+ code: z.ZodIssueCode.custom,
146
+ message: `Minimum amount for this promo is ${promoMinAmount.toLocaleString()}`,
147
+ });
148
+ }
149
+ if (promo && amount > promoMaxAmount) {
150
+ ctx.addIssue({
151
+ path: ['amount'],
152
+ code: z.ZodIssueCode.custom,
153
+ message: `Maximum amount for this promo is ${promoMaxAmount}`,
154
+ });
155
+ }
156
+ });
157
+ const form = useForm({
158
+ mode: 'all',
159
+ resolver: zodResolver(definition),
160
+ defaultValues: {
161
+ amount: '0',
162
+ promo: globalStore.depositWithdrawal.promo ?? null,
163
+ accountNumber: '',
164
+ },
165
+ });
166
+ useEffect(() => {
167
+ if (minimumAmount) {
168
+ form.reset({
169
+ amount: minimumAmount.toString(),
170
+ promo: form.getValues('promo') ?? null,
171
+ accountNumber: form.getValues('accountNumber') ?? '',
172
+ });
173
+ }
174
+ }, [form, minimumAmount]);
175
+ const redirectUrl = (() => {
176
+ const path = depositWithdrawalProps.depositSuccessPageUrl ?? '/deposits/:id/status';
177
+ const origin = window.location.origin.includes('localhost')
178
+ ? 'https://uat.powerplay.ph' +
179
+ depositWithdrawalProps.depositSuccessPageUrl
180
+ : window.location.origin;
181
+ return `${origin}${path}`;
182
+ })();
183
+ return (_jsxs("form", { onSubmit: form.handleSubmit(async (data) => {
184
+ if (!depositWithdrawalProps.bypassDepositKycCheck &&
185
+ (verificationStatus === 'PENDING' ||
186
+ verificationStatus === 'UNVERIFIED' ||
187
+ verificationStatus === 'REJECTED' ||
188
+ verificationStatus === 'CREATED')) {
189
+ globalStore.kycVerificationStatus.setOpen(true);
190
+ return;
191
+ }
192
+ else {
193
+ const id = ObjectId.generate(ObjectType.Deposit).toString();
194
+ createDepositMutation.reset();
195
+ createDepositMutation.mutate({
196
+ id,
197
+ amount: data.amount.toString(),
198
+ promo: data.promo ?? undefined,
199
+ redirectUrl: redirectUrl.replace(':id', id),
200
+ accountNumber: data.accountNumber,
201
+ });
202
+ }
203
+ }), noValidate: true, children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.accountNumber, children: [_jsx(Field.Label, { children: "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-lg", children: [_jsxs(NumberInput.Root, { min: 0, step: 1, value: o.field.value, onValueChange: (details) => {
204
+ o.field.onChange(details.value);
205
+ }, 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) => {
206
+ form.setValue('amount', value.toString(), {
207
+ shouldTouch: true,
208
+ shouldDirty: true,
209
+ shouldValidate: true,
210
+ });
211
+ }, min: minimumAmount, max: maximumAmount, className: "mt-lg" }), _jsx(Controller, { control: form.control, name: "promo", render: (o) => (_jsx(AvailablePromos, { value: o.field.value, onChange: (value) => {
212
+ o.field.onChange(value);
213
+ globalStore.depositWithdrawal.setPromo(null);
214
+ }, className: "mt-3xl" })) }), _jsx(Button, { type: "submit", className: "mt-3xl", disabled: createDepositMutation.isPending, children: "Deposit" }), _jsxs("p", { className: "mt-lg text-text-tertiary-600 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) => {
215
+ disclosure.setOpen(details.open);
216
+ }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: () => {
217
+ setStatus('waiting');
218
+ setErrorMessage(null);
219
+ form.reset();
220
+ warn.setFalse();
221
+ }, 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.Context, { children: (api) => (_jsx("button", { type: "button", className: "absolute top-2.5 right-2.5 flex icon:size-6 size-11 items-center justify-center text-text-quinary", onClick: () => {
222
+ if (status === 'success' && !warn.value) {
223
+ warn.setTrue();
224
+ }
225
+ else {
226
+ api.setOpen(false);
227
+ }
228
+ }, children: _jsx(XIcon, {}) })) }), _jsxs(AlertDialog.Header, { children: [status === 'processing' && (_jsx(SpinnerIcon, { className: "size-12 text-text-brand-primary-600" })), status === 'success' && !warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-brand-secondary text-text-featured-icon-light-brand", children: _jsx(RefreshCcw01Icon, {}) })), status === 'success' && warn.value && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) })), status === 'confirmed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-success-secondary text-text-featured-icon-light-success", children: _jsx(AlertCircleIcon, {}) })), status === 'failed' && (_jsx("div", { className: "flex size-12 items-center justify-center rounded-full bg-bg-error-secondary text-text-featured-icon-light-error", children: _jsx(AlertCircleIcon, {}) }))] }), _jsxs(AlertDialog.Body, { children: [_jsxs(AlertDialog.Title, { children: [status === 'processing' && 'Processing Deposit', status === 'success' &&
229
+ !warn.value &&
230
+ 'Didn’t see the payment window?', status === 'success' && warn.value && (_jsx(_Fragment, { children: "Are you sure you want to close this\u00A0window?" })), status === 'confirmed' && 'Deposit Successful', status === 'failed' && errorMessage?.name] }), _jsxs(AlertDialog.Description, { children: [status === 'processing' &&
231
+ "We're verifying your account and amount. Please hold a moment.", status === 'success' &&
232
+ !warn.value &&
233
+ 'Sometimes the payment pop up doesn’t appear right away. Don’t worry, just click the button below to reopen it and continue your deposit.', status === 'success' &&
234
+ warn.value &&
235
+ 'Closing this window might cancel your current deposit. Do you want to continue?', status === 'confirmed' &&
236
+ 'Your deposit has been successfully processed.', status === 'failed' && errorMessage?.message] })] }), (status === 'failed' ||
237
+ status === 'success' ||
238
+ status === 'confirmed') && (_jsxs(AlertDialog.Footer, { children: [status === 'success' && !warn.value && (_jsx(Button, { asChild: true, children: _jsx("a", { href: createDepositMutation.data?.checkoutUrl ?? '', target: "_blank", rel: "noopener noreferrer", children: "Try Again" }) })), status === 'success' && warn.value && (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "outline", onClick: () => {
239
+ warn.setFalse();
240
+ }, children: "Go back" }), _jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Continue" })) })] })), status !== 'success' && (_jsx(AlertDialog.Context, { children: (api) => (_jsx(Button, { onClick: () => api.setOpen(false), children: "Ok" })) }))] }))] }) })] }) })] }));
241
+ }
@@ -1,6 +1,6 @@
1
1
  export declare const AurixPayQRPHDepositContext: (props: {
2
2
  value: {
3
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
3
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
4
4
  deposit: import("../../../../types").Deposit | null;
5
5
  errorMessage: {
6
6
  name: string;
@@ -13,7 +13,7 @@ export declare const AurixPayQRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useAurixPayQRPHDepositContext: () => {
16
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
16
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
17
17
  deposit: import("../../../../types").Deposit | null;
18
18
  errorMessage: {
19
19
  name: string;
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
5
5
  promo?: string | null;
6
6
  }
7
7
  export declare function useAurixPayQRPHDeposit(): {
8
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
8
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
9
9
  deposit: Deposit | null;
10
10
  errorMessage: {
11
11
  name: string;
@@ -1,7 +1,7 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
3
  view: "form" | "vca";
4
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
5
  verify: () => void;
6
6
  reset: () => void;
7
7
  deposit: import("../../../../types").Deposit | null;
@@ -14,7 +14,7 @@ export declare const OnlineBankDepositContext: (props: {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useOnlineBankDepositContext: () => {
16
16
  view: "form" | "vca";
17
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
17
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
18
18
  verify: () => void;
19
19
  reset: () => void;
20
20
  deposit: import("../../../../types").Deposit | null;
@@ -2,7 +2,7 @@ import type { Deposit } from '../../../../types';
2
2
  export type UseOnlineBankDepositReturn = ReturnType<typeof useOnlineBankDeposit>;
3
3
  export declare function useOnlineBankDeposit(): {
4
4
  view: "form" | "vca";
5
- status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
+ status: "waiting" | "processing" | "failed" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
8
8
  deposit: Deposit | null;
@@ -1,6 +1,6 @@
1
1
  export declare const QRPHDepositContext: (props: {
2
2
  value: {
3
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
3
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
4
4
  deposit: import("../../../../types").Deposit | null;
5
5
  errorMessage: {
6
6
  name: string;
@@ -13,7 +13,7 @@ export declare const QRPHDepositContext: (props: {
13
13
  } & {
14
14
  children?: import("react").ReactNode | undefined;
15
15
  }) => React.ReactNode, useQRPHDepositContext: () => {
16
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
16
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
17
17
  deposit: import("../../../../types").Deposit | null;
18
18
  errorMessage: {
19
19
  name: string;
@@ -5,7 +5,7 @@ export interface GenerateQRCodeInput {
5
5
  promo?: string | null;
6
6
  }
7
7
  export declare function useQRPHDeposit(): {
8
- status: "idle" | "generating-qr-code" | "qr-code-generated" | "failed" | "confirmed";
8
+ status: "idle" | "failed" | "generating-qr-code" | "qr-code-generated" | "confirmed";
9
9
  deposit: Deposit | null;
10
10
  errorMessage: {
11
11
  name: string;
@@ -1,8 +1,12 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import Image from 'next/image';
4
+ import { useState } from 'react';
4
5
  import { useShallow } from 'zustand/shallow';
6
+ import { useFeatureFlag } from '../../client/hooks/useFeatureFlag.js';
5
7
  import { useGlobalStore } from '../../client/hooks/useGlobalStore.js';
8
+ import { getSession } from '../../client/services/getSession.js';
9
+ import { toaster } from '../../client/utils/toaster.js';
6
10
  import cinePopLogo from '../../images/cinepop-logo.png';
7
11
  import dearUtolLogo from '../../images/dear-utol-logo.png';
8
12
  import mariasDiary from '../../images/marias-diary-logo.png';
@@ -11,10 +15,35 @@ import { Dialog } from '../../ui/Dialog/index.js';
11
15
  import { Portal } from '../../ui/Portal/index.js';
12
16
  export function KYCReview() {
13
17
  const { kycReview } = useGlobalStore(useShallow((s) => ({ kycReview: s.kycReview })));
14
- return (_jsx(Dialog.Root, { open: kycReview.open, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center", children: _jsxs(Dialog.Content, { className: "flex w-[375px] flex-col items-center justify-between space-y-4 border bg-[#232443] p-6 text-center", children: [_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "mb-4 h-7 w-7 animate-spin rounded-full border-4 border-[#101730] border-t-[#F05027]" }), _jsx("div", { className: "font-semibold text-[#F5F5F6] text-lg", children: "Thanks for your submission." }), _jsxs("div", { className: "mt-1 text-[#CECFD2] text-sm", children: ["We\u2019re now ", '', _jsxs("span", { className: "text-[#F96B47]", children: ["reviewing your KYC information ", ''] }), "and will notify you once the verification is complete."] }), _jsx("div", { className: "mt-6 text-[#CECFD2] text-sm", children: "In the meantime, you can watch your favorite series on CinePop!" })] }), _jsxs("div", { className: "pt-3", children: [_jsx(Image, { src: cinePopLogo, alt: "cine poplogo", width: 151, height: 24, className: "mx-auto mb-2 h-auto w-[151px]" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { src: secretConfessionsLogo, alt: "secret confessions logo", width: 104, height: 53, className: "h-auto w-[104px]" }), _jsx(Image, { src: dearUtolLogo, alt: "dear utol logo", width: 105, height: 53, className: "h-auto w-[105px]" }), _jsx(Image, { src: mariasDiary, alt: "maria's diary logo", width: 104, height: 53, className: "h-auto w-[104px]" })] })] }), _jsx("button", { type: "button", className: "h-[44px] w-full rounded-md font-semibold", style: {
18
+ const [isLoading, setIsLoading] = useState(false);
19
+ const featureFlag = useFeatureFlag();
20
+ const isDialogOpen = kycReview.open && featureFlag.enabled;
21
+ return (_jsx(Dialog.Root, { open: isDialogOpen, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "flex items-center", children: _jsxs(Dialog.Content, { className: "flex w-[375px] flex-col items-center justify-between space-y-4 rounded-lg bg-[#232443] p-6 text-center", children: [_jsxs("div", { className: "flex flex-col items-center", children: [_jsx("div", { className: "mb-4 h-7 w-7 animate-spin rounded-full border-4 border-[#101730] border-t-[#F05027]" }), _jsx("div", { className: "font-semibold text-[#F5F5F6] text-lg", children: "Thanks for your submission." }), _jsxs("div", { className: "mt-1 text-[#CECFD2] text-sm", children: ["We\u2019re now ", '', _jsxs("span", { className: "text-[#F96B47]", children: ["reviewing your KYC information ", ''] }), "and will notify you once the verification is complete."] }), _jsx("div", { className: "mt-6 text-[#CECFD2] text-sm", children: "In the meantime, you can watch your favorite series on CinePop!" })] }), _jsxs("div", { className: "pt-3", children: [_jsx(Image, { src: cinePopLogo, alt: "cine poplogo", width: 151, height: 24, className: "mx-auto mb-2 h-auto w-[151px]" }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Image, { src: secretConfessionsLogo, alt: "secret confessions logo", width: 104, height: 53, className: "h-auto w-[104px]" }), _jsx(Image, { src: dearUtolLogo, alt: "dear utol logo", width: 105, height: 53, className: "h-auto w-[105px]" }), _jsx(Image, { src: mariasDiary, alt: "maria's diary logo", width: 104, height: 53, className: "h-auto w-[104px]" })] })] }), _jsx("button", { disabled: isLoading, type: "button", className: "h-[44px] w-full rounded-md font-semibold", style: {
15
22
  background: 'linear-gradient(90deg, #9333E8 0%, #D92778 100%)',
16
- }, onClick: () => {
17
- window.open('https://cinepop.film/', '_blank');
18
- kycReview.setOpen(false);
23
+ }, onClick: async () => {
24
+ const session = await getSession();
25
+ setIsLoading(true);
26
+ try {
27
+ const response = await fetch('https://auth.development.opexa.io/v1/sso/cinepop', {
28
+ method: 'POST',
29
+ headers: {
30
+ AUTHORIZATION: `Bearer ${session.token}`,
31
+ 'PLATFORM-ID': 'Z892',
32
+ 'Content-Type': 'application/json',
33
+ },
34
+ });
35
+ const data = (await response.json());
36
+ window.open(data.data.redirectionUrl, '_blank');
37
+ }
38
+ catch {
39
+ toaster.error({
40
+ title: 'Failed to redirect',
41
+ description: 'Unable to open CinePop. Please try again.',
42
+ });
43
+ }
44
+ finally {
45
+ setIsLoading(false);
46
+ kycReview.setOpen(false);
47
+ }
19
48
  }, children: "Watch Cinepop" })] }) })] }) }));
20
49
  }
@@ -122,10 +122,13 @@ export function SignUpDefaultForm() {
122
122
  });
123
123
  const emailAddressBaseSchema = z
124
124
  .string()
125
- .min(1, 'Email address is required')
125
+ .trim()
126
126
  .max(254, 'Email address must not be more than 254 characters')
127
127
  .email('Invalid email address')
128
+ .or(z.literal(''))
128
129
  .refine(async (email) => {
130
+ if (!email)
131
+ return true;
129
132
  const isDisposable = await isDisposableEmail(email);
130
133
  return !isDisposable;
131
134
  }, { message: 'Disposable email addresses are not allowed' });
@@ -198,6 +201,7 @@ export function SignUpDefaultForm() {
198
201
  middleName: '',
199
202
  lastName: '',
200
203
  mobileNumber: '',
204
+ emailAddress: '',
201
205
  branchCode: signUpProps?.branches?.length
202
206
  ? itemToValue(signUpProps.branches[0])
203
207
  : '',
@@ -329,9 +333,8 @@ export function SignUpDefaultForm() {
329
333
  }),
330
334
  }),
331
335
  ...(signUpProps.showEmailAddressField && {
332
- emailAddress: step1Form
333
- .getValues('emailAddress')
334
- ?.toLowerCase(),
336
+ emailAddress: step1Form.getValues('emailAddress')?.toLowerCase() ||
337
+ undefined,
335
338
  }),
336
339
  referralCode: search.get('referralCode') ?? undefined,
337
340
  agentCode,
@@ -0,0 +1,4 @@
1
+ export declare function SingleSignOn(): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function VerifyMobileNumber({ onClose }: {
3
+ onClose?: () => void;
4
+ }): import("react/jsx-runtime").JSX.Element;