@opexa/portal-components 0.0.1028 → 0.0.1030

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.
@@ -72,10 +72,10 @@ function Bonus(props) {
72
72
  const promo = bonus.promo;
73
73
  const localeInfo = useLocaleInfo();
74
74
  const targetDate = useMemo(() => {
75
- const date = new Date(bonus.dateTimeCreated);
75
+ const date = new Date(bonus.dateTimeLastUpdated);
76
76
  date.setDate(date.getDate() + bonus.promo.daysToClear);
77
77
  return date;
78
- }, [bonus.dateTimeCreated, bonus.promo.daysToClear]);
78
+ }, [bonus.dateTimeLastUpdated, bonus.promo.daysToClear]);
79
79
  const remainingTime = useRemainingTime(targetDate);
80
80
  const currentTurnoverRequirementContributionPercentage = parseDecimal(bonus.currentTurnoverRequirementContributionPercentage, 0);
81
81
  const turnoverRequirement = parseDecimal(bonus.turnoverRequirement, 0);
@@ -65,6 +65,7 @@ export function SignUpDefaultForm() {
65
65
  const [branchTipOpen, setBranchTipOpen] = useState(false);
66
66
  const firstNameBaseSchema = z
67
67
  .string()
68
+ .min(1, 'First name is required')
68
69
  .regex(/^[a-z ]+$/gi, 'First name must contain only letters')
69
70
  .transform((val) => val.trim())
70
71
  .refine((val) => val.length >= 2, {
@@ -75,6 +76,7 @@ export function SignUpDefaultForm() {
75
76
  });
76
77
  const lastNameBaseSchema = z
77
78
  .string()
79
+ .min(1, 'Last name is required')
78
80
  .regex(/^[a-z ]+$/gi, 'Last name must contain only letters')
79
81
  .transform((val) => val.trim())
80
82
  .refine((val) => val.length >= 2, {
@@ -84,15 +86,19 @@ export function SignUpDefaultForm() {
84
86
  message: 'Last name must not be more than 50 characters',
85
87
  });
86
88
  const birthdateBaseSchema = z
87
- .date({
88
- invalid_type_error: 'Date of birth is required',
89
- required_error: 'Date of birth is required',
90
- })
89
+ .custom()
91
90
  .superRefine((val, ctx) => {
91
+ if (!(val instanceof Date)) {
92
+ ctx.addIssue({
93
+ code: z.ZodIssueCode.custom,
94
+ message: 'Date of birth is required',
95
+ });
96
+ return;
97
+ }
92
98
  const now = new Date();
93
99
  const age = differenceInYears(now, val);
94
100
  if (age < 21) {
95
- return ctx.addIssue({
101
+ ctx.addIssue({
96
102
  code: z.ZodIssueCode.custom,
97
103
  message: 'You must be at least 21 years old',
98
104
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.1028",
3
+ "version": "0.0.1030",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",