@opexa/portal-components 0.0.972 → 0.0.974

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.
@@ -131,10 +131,15 @@ export function useCamera(options = {}) {
131
131
  const video = videoRef.current;
132
132
  if (!video || video.readyState < 2)
133
133
  return null;
134
+ // Reset error state and set snapping state before attempting to snap
135
+ setError(null);
136
+ setSnapping(true);
134
137
  const canvas = document.createElement('canvas');
135
138
  const context = canvas.getContext('2d', { willReadFrequently: true });
136
- if (!context)
139
+ if (!context) {
140
+ setSnapping(false);
137
141
  return null;
142
+ }
138
143
  canvas.width = video.videoWidth;
139
144
  canvas.height = video.videoHeight;
140
145
  context.drawImage(video, 0, 0, canvas.width, canvas.height);
@@ -142,6 +147,9 @@ export function useCamera(options = {}) {
142
147
  canvas.toBlob((blob) => {
143
148
  if (!blob) {
144
149
  resolve(null);
150
+ setData(null);
151
+ setSnapping(false);
152
+ setLoading(false);
145
153
  return setError({
146
154
  name: 'CameraError',
147
155
  message: 'Failed to snap photo',
@@ -81,6 +81,7 @@ export interface GlobalStore {
81
81
  kyc: PopupStore;
82
82
  kycReminder: PopupStore;
83
83
  kycReview: PopupStore;
84
+ updateMobilePhoneNumber: PopupStore;
84
85
  spotBonus: PopupStore;
85
86
  registerBiometrics: PopupStore;
86
87
  termsAndConditions: TermsAndConditionsStore;
@@ -239,6 +239,19 @@ export const useGlobalStore = create()(devtools(subscribeWithSelector((set) => (
239
239
  },
240
240
  '~touched': false,
241
241
  },
242
+ updateMobilePhoneNumber: {
243
+ open: false,
244
+ setOpen(open) {
245
+ set((prev) => ({
246
+ updateMobilePhoneNumber: {
247
+ ...prev.updateMobilePhoneNumber,
248
+ open,
249
+ '~touched': true,
250
+ },
251
+ }));
252
+ },
253
+ '~touched': false,
254
+ },
242
255
  sidebar: {
243
256
  open: true,
244
257
  setOpen(open) {
@@ -1,7 +1,7 @@
1
1
  export declare const OnlineBankDepositContext: (props: {
2
2
  value: {
3
3
  view: "form" | "vca";
4
- status: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
4
+ status: "failed" | "waiting" | "processing" | "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: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
17
+ status: "failed" | "waiting" | "processing" | "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: "waiting" | "failed" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
5
+ status: "failed" | "waiting" | "processing" | "verification-waiting" | "verification-processing" | "verification-failed" | "verification-success";
6
6
  verify: () => void;
7
7
  reset: () => void;
8
8
  deposit: Deposit | null;
@@ -4,7 +4,6 @@ export interface KYCDefaultProps extends KYCReminderProps {
4
4
  provider?: 'opexa';
5
5
  logo: ImageProps['src'];
6
6
  isSkippable?: boolean;
7
- requireMobileNumber?: boolean;
8
7
  hasKYCReviewPromo?: boolean;
9
8
  }
10
9
  export declare function KYCDefault(props: KYCDefaultProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import Image from 'next/image';
3
3
  import { useShallow } from 'zustand/shallow';
4
- import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
5
4
  import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
6
5
  import { useSessionQuery } from '../../../client/hooks/useSessionQuery.js';
7
6
  import { Dialog } from '../../../ui/Dialog/index.js';
@@ -18,15 +17,14 @@ export function KYCDefault(props) {
18
17
  kyc: ctx.kyc,
19
18
  kycReminder: ctx.kycReminder,
20
19
  responsibleGamingReminder: ctx.responsibleGamingReminder,
20
+ updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
21
21
  })));
22
22
  const kyc = useKYCDefault(props?.isSkippable ?? false, props?.hasKYCReviewPromo ?? false);
23
23
  const { isLoading: sessionLoading } = useSessionQuery();
24
- const accountQuery = useAccountQuery();
25
- const account = accountQuery.data;
26
- const baseCondition = !globalStore.kycReminder.open && globalStore.kyc.open && !sessionLoading;
27
- const isDialogOpen = props.requireMobileNumber
28
- ? baseCondition && !!account?.mobileNumber
29
- : baseCondition;
24
+ const isDialogOpen = !globalStore.kycReminder.open &&
25
+ globalStore.kyc.open &&
26
+ !sessionLoading &&
27
+ !globalStore.updateMobilePhoneNumber.open;
30
28
  return (_jsxs(_Fragment, { children: [_jsx(KYCDefaultContext, { value: kyc, children: _jsx(Dialog.Root, { open: isDialogOpen, onOpenChange: (details) => {
31
29
  globalStore.kyc.setOpen(details.open);
32
30
  }, lazyMount: true, unmountOnExit: true, closeOnEscape: false, closeOnInteractOutside: false, onExitComplete: kyc.reset, children: _jsxs(Portal, { children: [_jsx(Dialog.Backdrop, {}), _jsx(Dialog.Positioner, { className: "fixed top-[57px] overflow-hidden", children: _jsx(Dialog.Content, { className: "mx-auto h-full w-full overflow-y-auto bg-bg-primary-alt md:max-h-[95vh] lg:w-fit", children: _jsxs("div", { className: "mt-[calc(var(--safe-area-inset-top)*3)] flex h-dvh w-full flex-col overflow-y-auto p-3xl sm:h-fit lg:w-[400px]", children: [_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(IdentityVerification, {}), kyc.step === 2 && _jsx(PersonalInformation, {})] }) }) })] }) }) }), _jsx(KYCReminder, { ...props }), _jsx(KYCReview, {})] }));
@@ -15,7 +15,7 @@ import { Portal } from '../../ui/Portal/index.js';
15
15
  export function KYCReview() {
16
16
  const { kycReview } = useGlobalStore(useShallow((s) => ({ kycReview: s.kycReview })));
17
17
  const [isLoading, setIsLoading] = useState(false);
18
- 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", { disabled: isLoading, type: "button", className: "h-[44px] w-full rounded-md font-semibold", style: {
18
+ 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 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: {
19
19
  background: 'linear-gradient(90deg, #9333E8 0%, #D92778 100%)',
20
20
  }, onClick: async () => {
21
21
  const session = await getSession();
@@ -29,8 +29,8 @@ export function KYCReview() {
29
29
  'Content-Type': 'application/json',
30
30
  },
31
31
  });
32
- const data = (await response.json());
33
- window.open(data.redirectUrl, '_blank');
32
+ const data = await response.json();
33
+ window.open(data.data.redirectionUrl, '_blank');
34
34
  }
35
35
  catch {
36
36
  toaster.error({
@@ -24,20 +24,20 @@ import { PinInput } from '../../ui/PinInput/index.js';
24
24
  import { Portal } from '../../ui/Portal/index.js';
25
25
  export function UpdateMobilePhoneNumber() {
26
26
  const globalStore = useGlobalStore(useShallow((ctx) => ({
27
+ updateMobilePhoneNumber: ctx.updateMobilePhoneNumber,
27
28
  kyc: ctx.kyc,
28
29
  })));
29
30
  const accountQuery = useAccountQuery();
30
31
  const account = accountQuery.data;
31
32
  const isAccountLoading = accountQuery.isLoading;
32
33
  const hasMobileNumber = !!account?.mobileNumber;
33
- const [isDialogOpen, setIsDialogOpen] = useState(false);
34
34
  // biome-ignore lint/correctness/useExhaustiveDependencies: We only want to open the dialog when the account data loads, not on every hasMobileNumber change
35
35
  useEffect(() => {
36
36
  if (!isAccountLoading && !!account && !hasMobileNumber) {
37
- setIsDialogOpen(true);
37
+ globalStore.updateMobilePhoneNumber.setOpen(true);
38
38
  }
39
39
  else if (!isAccountLoading && !!account && hasMobileNumber) {
40
- setIsDialogOpen(false);
40
+ globalStore.updateMobilePhoneNumber.setOpen(false);
41
41
  }
42
42
  }, [isAccountLoading, account?.mobileNumber]);
43
43
  const [step, setStep] = useState(1);
@@ -62,7 +62,7 @@ export function UpdateMobilePhoneNumber() {
62
62
  title: 'Verification Successful',
63
63
  description: 'Your mobile number has been verified.',
64
64
  });
65
- setIsDialogOpen(false);
65
+ globalStore.updateMobilePhoneNumber.setOpen(false);
66
66
  globalStore.kyc.setOpen(true);
67
67
  },
68
68
  onError: (err) => {
@@ -117,7 +117,7 @@ export function UpdateMobilePhoneNumber() {
117
117
  duration: 1000 * 60,
118
118
  });
119
119
  const formRef = useRef(null);
120
- 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 space-y-4 rounded-xl bg-[#111827] p-6 text-center", style: {
120
+ return (_jsx(Dialog.Root, { open: globalStore.updateMobilePhoneNumber.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 space-y-4 rounded-xl bg-[#111827] p-6 text-center", style: {
121
121
  backgroundImage: `url(${lightBg.src})`,
122
122
  }, children: [_jsx(Image, { src: inplayLogo, alt: "inplay logo", width: 82, height: 34, className: "h-auto w-[82px]" }), _jsxs("div", { children: [step === 1 && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "font-bold text-sm", children: ["Get ", _jsx("span", { className: "text-[#F05127]", children: "\u20B150 Bonus" }), " when you verify your account and play."] }), _jsxs("form", { className: "mt-3xl", onSubmit: step1Form.handleSubmit(async (data) => {
123
123
  sendVerificationCodeMutation.mutateAsync({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.972",
3
+ "version": "0.0.974",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",