@opexa/portal-components 0.0.905 → 0.0.907

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.
@@ -1,2 +1,4 @@
1
- export declare function SingleSignOn(): import("react/jsx-runtime").JSX.Element | undefined;
2
- export declare function VerifyMobileNumber(): import("react/jsx-runtime").JSX.Element;
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;
@@ -6,12 +6,6 @@ import { useParams, useRouter, useSearchParams } from 'next/navigation';
6
6
  import { useEffect, useRef, useState } from 'react';
7
7
  import { Controller, useForm } from 'react-hook-form';
8
8
  import z from 'zod';
9
- import cinePopLogo from '../../../lib/images/cinepop-logo.png';
10
- import dearUtolLogo from '../../../lib/images/dear-utol-logo.png';
11
- import inplayLogo from '../../../lib/images/inplay-logo.png';
12
- import lightBg from '../../../lib/images/light-bg.png';
13
- import mariasDiary from '../../../lib/images/marias-diary-logo.png';
14
- import secretConfessionsLogo from '../../../lib/images/secret-confessions-logo.png';
15
9
  import { useCooldown } from '../../client/hooks/useCooldown.js';
16
10
  import { useLocaleInfo } from '../../client/hooks/useLocaleInfo.js';
17
11
  import { useMobileNumberParser } from '../../client/hooks/useMobileNumberParser.js';
@@ -20,6 +14,12 @@ import { useSignInSSOMutation } from '../../client/hooks/useSignInSSOMutation.js
20
14
  import { useVerifyMobileNumber } from '../../client/hooks/useVerifyMobileNumber.js';
21
15
  import { toaster } from '../../client/utils/toaster.js';
22
16
  import { ArrowLeftIcon } from '../../icons/ArrowLeftIcon.js';
17
+ import cinePopLogo from '../../images/cinepop-logo.png';
18
+ import dearUtolLogo from '../../images/dear-utol-logo.png';
19
+ import inplayLogo from '../../images/inplay-logo.png';
20
+ import lightBg from '../../images/light-bg.png';
21
+ import mariasDiary from '../../images/marias-diary-logo.png';
22
+ import secretConfessionsLogo from '../../images/secret-confessions-logo.png';
23
23
  import { Button } from '../../ui/Button/index.js';
24
24
  import { Dialog } from '../../ui/Dialog/index.js';
25
25
  import { Field } from '../../ui/Field/index.js';
@@ -31,15 +31,22 @@ export function SingleSignOn() {
31
31
  const router = useRouter();
32
32
  const partnerId = params.partnerId;
33
33
  const token = searchParams.get('token');
34
+ const [isSsoOpen, setIsSsoOpen] = useState(true);
35
+ const [showVerifyDialog, setShowVerifyDialog] = useState(false);
34
36
  const ssoMutation = useSignInSSOMutation({
35
37
  onSuccess: () => {
36
- console.log('SSO Sign-in successful:');
37
- // Redirect to home or dashboard
38
- router.push('/');
38
+ toaster.success({
39
+ description: 'Account created successfully',
40
+ });
41
+ setIsSsoOpen(false);
42
+ setShowVerifyDialog(true);
39
43
  },
40
- onError: (error) => {
41
- console.log('error:', error);
42
- console.error('SSO Login failed:', error);
44
+ onError: () => {
45
+ toaster.error({
46
+ description: 'Account creation failed',
47
+ });
48
+ setIsSsoOpen(false);
49
+ router.push('/');
43
50
  },
44
51
  });
45
52
  // biome-ignore lint/correctness/useExhaustiveDependencies: We only want to trigger the mutation when the URL parameters change.
@@ -50,15 +57,19 @@ export function SingleSignOn() {
50
57
  }
51
58
  }, [partnerId, token]);
52
59
  if (ssoMutation.isPending) {
53
- return (_jsx(Dialog.Root, { open: true, 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 h-[333px] w-[375px] flex-col items-center space-y-4 bg-[#111827] p-6 text-center", style: {
60
+ return (_jsx(Dialog.Root, { open: isSsoOpen, 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 h-[333px] w-[375px] flex-col items-center space-y-4 bg-[#111827] p-6 text-center", style: {
54
61
  backgroundImage: `url(${lightBg.src})`,
55
62
  }, children: [_jsx(Image, { src: inplayLogo, alt: "inplay logo", width: 82, height: 34, className: "h-auto w-[82px]" }), _jsx("div", { className: "mb-4 h-7 w-7 animate-spin rounded-full border-4 border-[#101730] border-t-[#F05027]" }), _jsx("div", { className: "text-[#CECFD2] text-sm", children: "We\u2019re creating an account for you..." }), _jsx("div", { className: "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]" })] })] })] }) })] }) }));
56
63
  }
57
- if (ssoMutation.isError) {
58
- return _jsx(VerifyMobileNumber, {});
64
+ if (showVerifyDialog) {
65
+ return (_jsx(VerifyMobileNumber, { onClose: () => {
66
+ setShowVerifyDialog(false);
67
+ router.push('/');
68
+ } }));
59
69
  }
70
+ return null;
60
71
  }
61
- export function VerifyMobileNumber() {
72
+ export function VerifyMobileNumber({ onClose }) {
62
73
  const [step, setStep] = useState(1);
63
74
  const sendVerificationCodeMutation = useSendVerificationCodeMutation({
64
75
  onSuccess: () => {
@@ -81,6 +92,7 @@ export function VerifyMobileNumber() {
81
92
  title: 'Verification Successful',
82
93
  description: 'Your mobile number has been verified.',
83
94
  });
95
+ onClose?.();
84
96
  },
85
97
  onError: (err) => {
86
98
  const errorMessage = err.name === 'Forbidden'
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.905",
3
+ "version": "0.0.907",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",