Skip to content

Commit 47181e9

Browse files
committed
Merge branch 'master' into BA-2357-support-first-and-last-name
2 parents e30224d + c851380 commit 47181e9

File tree

131 files changed

+4234
-2265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+4234
-2265
lines changed

packages/authentication/CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
- Updated form validation to ensure correct input for the revised registration fields.
1010
- If you're using `useSignUp` with name only, you should set `useNameField` to `true` on the hook's option
1111

12+
## 4.1.9
13+
14+
### Patch Changes
15+
16+
- Add password validations to reset and change expired password
17+
18+
## 4.1.8
19+
20+
### Patch Changes
21+
22+
- Fix image path handling for profile images
23+
1224
## 4.1.7
1325

1426
### Patch Changes

packages/authentication/modules/access/useChangeExpiredPassword/__tests__/useChangeExpiredPassword.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import useChangeExpiredPassword from '../index'
1111

1212
describe('useChangeExpiredPassword', () => {
1313
const currentPassword = '1234'
14-
const password = '123456'
14+
const password = '12345#Abcde'
1515
const token = 'fake-token'
1616
const changePasswordUrl = '/change-expired-password'
1717

packages/authentication/modules/access/useChangeExpiredPassword/constants.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ZOD_MESSAGE } from '@baseapp-frontend/utils'
1+
import { PASSWORD_REGEX, ZOD_MESSAGE } from '@baseapp-frontend/utils'
22

33
import { z } from 'zod'
44

@@ -7,7 +7,9 @@ import type { ChangeExpiredPasswordForm } from './types'
77
export const DEFAULT_VALIDATION_SCHEMA = z
88
.object({
99
currentPassword: z.string().nonempty(ZOD_MESSAGE.required),
10-
newPassword: z.string().nonempty(ZOD_MESSAGE.required),
10+
newPassword: z.string().min(1, ZOD_MESSAGE.required).regex(PASSWORD_REGEX, {
11+
message: ZOD_MESSAGE.password,
12+
}),
1113
confirmNewPassword: z.string().nonempty(ZOD_MESSAGE.required),
1214
})
1315
.refine(({ confirmNewPassword, newPassword }) => newPassword === confirmNewPassword, {

packages/authentication/modules/access/useLogin/index.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ const useLogin = ({
6161
if (user) {
6262
// TODO: handle the absolute image path on the backend
6363
const baseUrl = process.env.NEXT_PUBLIC_API_BASE_URL?.replace('/v1', '')
64-
const absoluteImagePath = user?.profile?.image ? `${baseUrl}${user.profile.image}` : null
64+
let absoluteImagePath = null
65+
if (user?.profile?.image) {
66+
absoluteImagePath = user.profile.image.startsWith('http')
67+
? user.profile.image
68+
: `${baseUrl}${user.profile.image}`
69+
}
6570
setCurrentProfile({
6671
...user.profile,
6772
image: absoluteImagePath,

packages/authentication/modules/access/useResetPassword/__tests__/useResetPassword.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { z } from 'zod'
1010
import useResetPassword from '../index'
1111

1212
describe('useResetPassword', () => {
13-
const password = '123456'
13+
const password = '12345#Abcde'
1414
const token = 'fake-token'
1515
const resetPasswordUrl = '/forgot-password/reset'
1616

packages/authentication/modules/access/useResetPassword/constants.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { ZOD_MESSAGE } from '@baseapp-frontend/utils'
1+
import { PASSWORD_REGEX, ZOD_MESSAGE } from '@baseapp-frontend/utils'
22

33
import { z } from 'zod'
44

55
import type { ResetPasswordForm } from './types'
66

77
export const DEFAULT_VALIDATION_SCHEMA = z
88
.object({
9-
newPassword: z.string().nonempty(ZOD_MESSAGE.required),
9+
newPassword: z.string().min(1, ZOD_MESSAGE.required).regex(PASSWORD_REGEX, {
10+
message: ZOD_MESSAGE.password,
11+
}),
1012
confirmNewPassword: z.string().nonempty(ZOD_MESSAGE.required),
1113
})
1214
.refine(({ confirmNewPassword, newPassword }) => newPassword === confirmNewPassword, {
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export { default as withTokenSetup } from './withTokenSetup'
22
export { default as withProviders } from './withProviders'
3+
export { default as withMutationResolver } from './withMutationResolver'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import React, { useEffect } from 'react'
2+
3+
import { createTestEnvironment } from '@baseapp-frontend/graphql'
4+
5+
import type { StoryContext, StoryFn } from '@storybook/react'
6+
import { Observable, OperationDescriptor } from 'relay-runtime'
7+
import { MockPayloadGenerator } from 'relay-test-utils'
8+
import { MockResolvers } from 'relay-test-utils/lib/RelayMockPayloadGenerator'
9+
10+
export type DynamicMockResolvers = (operation: OperationDescriptor) => MockResolvers
11+
12+
const withMutationResolver = (Story: StoryFn, context: StoryContext) => {
13+
const { environment, queueOperationResolver } = context.parameters
14+
.relayMockEnvironment as ReturnType<typeof createTestEnvironment>
15+
16+
const mockResolvers = context.parameters.mockResolvers || undefined
17+
const dynamicMockResolvers: DynamicMockResolvers =
18+
context.parameters.dynamicMockResolvers || undefined
19+
const mutationError: string = context.parameters.mutationError || undefined
20+
21+
useEffect(() => {
22+
const originalExecuteMutation = environment.executeMutation
23+
24+
environment.executeMutation = (request) => {
25+
if (!mutationError) {
26+
if (dynamicMockResolvers) {
27+
environment.mock.queueOperationResolver(() => {
28+
return MockPayloadGenerator.generate(
29+
request.operation,
30+
dynamicMockResolvers(request.operation),
31+
)
32+
})
33+
} else if (mockResolvers) {
34+
environment.mock.queueOperationResolver(() => {
35+
return MockPayloadGenerator.generate(request.operation, mockResolvers)
36+
})
37+
}
38+
}
39+
40+
const observable = originalExecuteMutation.call(environment, request)
41+
42+
return Observable.create((sink) => {
43+
if (mutationError) {
44+
setTimeout(() => {
45+
sink.error(new Error(mutationError))
46+
}, 100)
47+
} else {
48+
observable.subscribe({
49+
complete: () => {
50+
setTimeout(() => {
51+
sink.complete()
52+
}, 100)
53+
},
54+
})
55+
}
56+
})
57+
}
58+
59+
return () => {
60+
environment.executeMutation = originalExecuteMutation
61+
}
62+
}, [environment, queueOperationResolver])
63+
64+
return <Story />
65+
}
66+
67+
export default withMutationResolver

packages/components/CHANGELOG.md

+65
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,70 @@
11
# @baseapp-frontend/components
22

3+
## 1.0.25
4+
5+
### Patch Changes
6+
7+
- Forward LogoProps to make them customizable
8+
9+
## 1.0.24
10+
11+
### Patch Changes
12+
13+
- Add user activities to the Activity Log
14+
- updated dependencies
15+
- @baseapp-frontend/components
16+
17+
## 1.0.23
18+
19+
### Patch Changes
20+
21+
- Refactor AccountPopover and improve some tests
22+
23+
## 1.0.22
24+
25+
### Patch Changes
26+
27+
- Add NotificationsList and NotificationBellWithBadge to native components
28+
- Updated dependencies
29+
- @baseapp-frontend/design-system@1.0.9
30+
31+
## 1.0.21
32+
33+
### Patch Changes
34+
35+
- Change `Link` component in `NavItem`, to use Link from next/link instead of Material UI Link.
36+
- Change `Header` border bottom from dashed to solid
37+
38+
## 1.0.20
39+
40+
### Patch Changes
41+
42+
- Updated dependencies
43+
- @baseapp-frontend/authentication@4.1.9
44+
45+
## 1.0.19
46+
47+
### Patch Changes
48+
49+
- Updated dependencies
50+
- @baseapp-frontend/design-system@1.0.8
51+
52+
## 1.0.18
53+
54+
### Patch Changes
55+
56+
- Moved ProfileSettingsComponent and related queries and mutations from `baseapp-frontend-template`
57+
- Updated dependencies
58+
- @baseapp-frontend/design-system@1.0.7
59+
60+
## 1.0.17
61+
62+
### Patch Changes
63+
64+
- Fix image path handling for profile images
65+
- Updated dependencies
66+
- @baseapp-frontend/authentication@4.1.8
67+
368
## 1.0.16
469

570
### Patch Changes

0 commit comments

Comments
 (0)