@opexa/portal-components 0.0.542 → 0.0.544

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.
@@ -136,7 +136,8 @@ function PersonalInfo(props) {
136
136
  });
137
137
  }
138
138
  }, [account, form]);
139
- const branchName = props.branchCodes?.find((branch) => branch.code === account?.branchCode)?.name;
139
+ const branchName = props.branchCodes?.find((branch) => branch.code === account?.branchCode);
140
+ const displayBranchName = `${branchName?.code} - ${branchName?.name}`;
140
141
  return (_jsxs("div", { children: [_jsx("h2", { className: "font-semibold text-sm text-text-secondary-700", children: "Personal Data" }), _jsxs("form", { className: "mt-5 rounded-xl border border-border-secondary bg-bg-primary-alt shadow-xs", onSubmit: form.handleSubmit((data) => {
141
142
  updateAccountMutation.mutate({
142
143
  realName: data.realName && account?.realName !== data.realName
@@ -146,7 +147,7 @@ function PersonalInfo(props) {
146
147
  ? data.birthDay
147
148
  : undefined,
148
149
  });
149
- }), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: branchName ?? account?.branchCode ?? '' })] }))] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
150
+ }), children: [_jsxs("div", { className: "px-4 py-5 lg:px-3xl lg:py-5", children: [_jsxs(Field.Root, { invalid: !!form.formState.errors.realName, readOnly: !!account?.realName, children: [_jsx(Field.Label, { children: "Full name" }), _jsx(Field.Input, { ...form.register('realName') }), _jsx(Field.ErrorText, { children: form.formState.errors.realName?.message })] }), _jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Date of birth" }), _jsx(Field.Input, { type: "date", ...form.register('birthDay') }), _jsx(Field.ErrorText, { children: form.formState.errors.birthDay?.message })] }), props.shouldShowBranchCode && (_jsxs(Field.Root, { className: "mt-6", invalid: !!form.formState.errors.birthDay, readOnly: !!account?.birthDay, children: [_jsx(Field.Label, { children: "Branch Code" }), _jsx(Field.Input, { type: "text", disabled: true, value: displayBranchName ?? account?.branchCode ?? '' })] }))] }), form.formState.isDirty && (_jsxs("div", { className: "flex justify-end gap-lg border-border-secondary border-t px-xl py-lg lg:px-3xl lg:py-xl", children: [_jsx(Button, { size: "sm", variant: "outline", fullWidth: false, disabled: updateAccountMutation.isPending, onClick: () => form.reset(), children: "Cancel" }), _jsx(Button, { type: "submit", size: "sm", fullWidth: false, disabled: !form.formState.isValid || updateAccountMutation.isPending, children: "Save Changes" })] }))] })] }));
150
151
  }
151
152
  function ContactInfo() {
152
153
  const localeInfo = useLocaleInfo();
@@ -4,6 +4,7 @@ import { useTimeout } from 'usehooks-ts';
4
4
  import { useSessionHealthQuery } from '../../client/hooks/useSessionHealthQuery.js';
5
5
  import { useSessionQuery } from '../../client/hooks/useSessionQuery.js';
6
6
  import { useSignOutMutation } from '../../client/hooks/useSignOutMutation.js';
7
+ import { toaster } from '../../client/utils/toaster.js';
7
8
  export function SessionWatcher() {
8
9
  const router = useRouter();
9
10
  const sessionQuery = useSessionQuery();
@@ -14,6 +15,10 @@ export function SessionWatcher() {
14
15
  const signOutMutation = useSignOutMutation({
15
16
  onSuccess() {
16
17
  router.refresh();
18
+ toaster.warning({
19
+ title: 'Session expired',
20
+ description: 'Your session has expired. Please sign in again to continue.',
21
+ });
17
22
  },
18
23
  });
19
24
  const healthy = sessionHealthQuery.data ?? true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.542",
3
+ "version": "0.0.544",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",