@opexa/portal-components 0.0.996 → 0.0.997

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.
@@ -5,9 +5,11 @@ import { zodResolver } from '@hookform/resolvers/zod';
5
5
  import { useRouter } from 'next/navigation';
6
6
  import { useEffect } from 'react';
7
7
  import { Controller, useForm } from 'react-hook-form';
8
+ import { twMerge } from 'tailwind-merge';
8
9
  import invariant from 'tiny-invariant';
9
10
  import { z } from 'zod';
10
11
  import { useShallow } from 'zustand/shallow';
12
+ import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
11
13
  import { useCreateMemberVerificationMutation } from '../../../client/hooks/useCreateMemberVerificationMutation.js';
12
14
  import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
13
15
  import { useMemberVerificationQuery } from '../../../client/hooks/useMemberVerificationQuery.js';
@@ -88,6 +90,8 @@ export function IdentityVerification() {
88
90
  });
89
91
  const memberVerification = useMemberVerificationQuery();
90
92
  const memberId = memberVerification.data?.id;
93
+ const accountQuery = useAccountQuery();
94
+ const accountStatus = accountQuery.data?.status;
91
95
  const globalStore = useGlobalStore(useShallow((ctx) => ({
92
96
  kyc: ctx.kyc,
93
97
  kycReminder: ctx.kycReminder,
@@ -140,7 +144,7 @@ export function IdentityVerification() {
140
144
  type: 'validate',
141
145
  message: error.message,
142
146
  });
143
- } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-6", disabled: createPending || updatePending, children: "Continue" }), kyc.isSkippable && (_jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", type: "button", onClick: () => {
147
+ } }), _jsx(Field.ErrorText, { children: o.fieldState.error?.message })] })) }), _jsx(Button, { type: "submit", className: "mt-6", disabled: createPending || updatePending, children: "Continue" }), kyc.isSkippable && (_jsx(Button, { variant: "outline", colorScheme: "gray", className: twMerge('mt-lg', accountStatus === 'VERIFICATION_LOCKED' && 'hidden'), type: "button", onClick: () => {
144
148
  globalStore.kyc.setOpen(false);
145
149
  }, children: "Skip for now" })), _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: async () => {
146
150
  if (Capacitor.isNativePlatform()) {
@@ -3,9 +3,11 @@ import { Capacitor } from '@capacitor/core';
3
3
  import { zodResolver } from '@hookform/resolvers/zod';
4
4
  import { useRouter } from 'next/navigation';
5
5
  import { useForm } from 'react-hook-form';
6
+ import { twMerge } from 'tailwind-merge';
6
7
  import invariant from 'tiny-invariant';
7
8
  import { z } from 'zod';
8
9
  import { useShallow } from 'zustand/shallow';
10
+ import { useAccountQuery } from '../../../client/hooks/useAccountQuery.js';
9
11
  import { useApproveMemberVerification } from '../../../client/hooks/useApproveMemberVerification.js';
10
12
  import { useCreateMemberVerificationMutation } from '../../../client/hooks/useCreateMemberVerificationMutation.js';
11
13
  import { useGlobalStore } from '../../../client/hooks/useGlobalStore.js';
@@ -40,6 +42,8 @@ export function PersonalInformation() {
40
42
  })));
41
43
  const memberVerificationQuery = useMemberVerificationQuery();
42
44
  const memberVerificationId = memberVerificationQuery.data?.id;
45
+ const accountQuery = useAccountQuery();
46
+ const accountStatus = accountQuery.data?.status;
43
47
  const router = useRouter();
44
48
  const signOutMutation = useSignOutMutation({
45
49
  async onSuccess() {
@@ -146,7 +150,7 @@ export function PersonalInformation() {
146
150
  });
147
151
  }
148
152
  }, disabled: !permanentAddress, children: [_jsx(Checkbox.Control, { children: _jsx(Checkbox.Indicator, { asChild: true, children: _jsx(CheckIcon, {}) }) }), _jsx(Checkbox.Label, { children: "Use permanent address as current address" }), _jsx(Checkbox.HiddenInput, {})] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.sourceOfIncome, children: [_jsx(Field.Label, { children: "Source of income" }), _jsx(Field.Input, { placeholder: "Enter your source of income", ...form.register('sourceOfIncome') }), _jsx(Field.ErrorText, { children: form.formState.errors.sourceOfIncome?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.natureOfWork, children: [_jsx(Field.Label, { children: "Nature of Work" }), _jsx(Field.Input, { placeholder: "Enter your nature of work", ...form.register('natureOfWork') }), _jsx(Field.ErrorText, { children: form.formState.errors.natureOfWork?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.placeOfBirth, children: [_jsx(Field.Label, { children: "Place of birth" }), _jsx(Field.Input, { placeholder: "Enter your place of birth", ...form.register('placeOfBirth') }), _jsx(Field.ErrorText, { children: form.formState.errors.placeOfBirth?.message })] }), _jsxs(Field.Root, { className: "mt-2xl", invalid: !!form.formState.errors.nationality, children: [_jsx(Field.Label, { children: "Nationality" }), _jsx(Field.Input, { placeholder: "Enter your nationality", ...form.register('nationality') }), _jsx(Field.ErrorText, { children: form.formState.errors.nationality?.message })] }), _jsx(Button, { type: "submit", className: "mt-4xl", disabled: updateMemberVerificationMutation.isPending ||
149
- createMemberVerificationMutation.isPending, children: "Continue" }), kyc.isSkippable && (_jsx(Button, { variant: "outline", colorScheme: "gray", className: "mt-lg", type: "button", onClick: () => {
153
+ createMemberVerificationMutation.isPending, children: "Continue" }), kyc.isSkippable && (_jsx(Button, { variant: "outline", colorScheme: "gray", className: twMerge('mt-lg', accountStatus === 'VERIFICATION_LOCKED' && 'hidden'), type: "button", onClick: () => {
150
154
  globalStore.kyc.setOpen(false);
151
155
  }, disabled: updateMemberVerificationMutation.isPending ||
152
156
  createMemberVerificationMutation.isPending, children: "Skip for now" })), ' ', _jsx(Button, { className: "bg-transparent text-text-brand-primary-600", onClick: async () => {
@@ -27,7 +27,6 @@ export function KycOpenOnHomeMount(props) {
27
27
  verification?.sumsubVerified ||
28
28
  verification?.status === 'APPROVED' ||
29
29
  verification?.status === 'VERIFIED'; //add default value on null return
30
- const isPending = verification?.status === 'PENDING';
31
30
  useEffect(() => {
32
31
  // If bypass is enabled, do nothing.
33
32
  if (props.bypassKycCheck) {
@@ -42,8 +41,7 @@ export function KycOpenOnHomeMount(props) {
42
41
  const shouldShowReminder = Boolean(props.isSkippable);
43
42
  const hasSeenKycModal = sessionStorage.getItem('hasSeenKycModal');
44
43
  const isFirstVisit = !hasSeenKycModal;
45
- // 1. If KYC is completed or pending, close both
46
- if (isKycCompleted || isPending) {
44
+ if (isKycCompleted) {
47
45
  setkycReminderOpen(false);
48
46
  setkycOpen(false);
49
47
  if (isKycCompleted) {
@@ -96,7 +94,6 @@ export function KycOpenOnHomeMount(props) {
96
94
  isRejected,
97
95
  isUnverified,
98
96
  isKycCompleted,
99
- isPending,
100
97
  props.isSkippable,
101
98
  props.bypassKycCheck,
102
99
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.996",
3
+ "version": "0.0.997",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",