Skip to content

Commit d6132af

Browse files
authored
Merge pull request #656 from webstackdev/feature/resume-and-my-data-style-fixes
Feature/resume and my data style fixes
2 parents 29c1de4 + 4be3bef commit d6132af

474 files changed

Lines changed: 9649 additions & 6495 deletions

File tree

Some content is hidden

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

@types/mjml-template.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
declare module '*.mjml?raw' {
22
const content: string
33
export default content
4-
}
4+
}

@types/pagedjs.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ declare module 'pagedjs' {
1919
}
2020

2121
export const registeredHandlers: PagedJsHandlerConstructor[]
22-
}
22+
}

_TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ https://aws.plainenglish.io/how-to-build-a-chatbot-using-aws-lex-and-lambda-in-2
3030
## Contact Form
3131

3232
- `0/2000` characters should show number of characters left instead
33+
- Workflow right now puts the "Success" toast under the submit button when the submit button returns to normal after a submission. It seems like the button should have some time out after a successful submission to make sure it's not hammered, like five seconds. And it just looks visually odd - maybe the button should be part of the layout of the success toast, or moved down under it.
3334

3435
## Newsletter / MJML Templates
3536

36-
- We need to make sure the images point to the full production URL, not a relative import
3737
- Need to move the unsubscribe link into an Action and handle it entirely within our website instead of on Hubspot
3838
- Need to add a newsletter publishing workflow as an action, using the newsletter static segment imported from Hubspot

cover.jpg

-1.49 KB
Binary file not shown.

public/pdf/resume.pdf

370 KB
Binary file not shown.

src/actions/contact/__tests__/action.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ type ContactSubmitOutput = {
1212
message: string
1313
}
1414

15-
const getMockedHandler = <Input, Output>(action: unknown): ActionConfig<Input, Output>['handler'] => {
15+
const getMockedHandler = <Input, Output>(
16+
action: unknown
17+
): ActionConfig<Input, Output>['handler'] => {
1618
return (action as ActionConfig<Input, Output>).handler
1719
}
1820

@@ -106,7 +108,7 @@ vi.mock('@actions/utils/errors', async () => {
106108
? messageOrError
107109
: messageOrError instanceof Error
108110
? messageOrError.message
109-
: options?.message ?? 'Internal server error'
111+
: (options?.message ?? 'Internal server error')
110112
super(message)
111113
this.name = 'ActionsFunctionError'
112114
this.status = options?.status ?? 500
@@ -239,4 +241,4 @@ describe('contact.submit.handler', () => {
239241
})
240242
)
241243
})
242-
})
244+
})

src/actions/contact/__tests__/domain.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ describe('contact domain validation', () => {
4949
if (result.success) {
5050
throw new Error('Expected schema validation to fail')
5151
}
52-
expect(z.flattenError(result.error).fieldErrors['timeline']).toContain('Invalid project timeline')
52+
expect(z.flattenError(result.error).fieldErrors['timeline']).toContain(
53+
'Invalid project timeline'
54+
)
5355
})
5456

5557
it('rejects messages that appear to contain spam', () => {
@@ -65,6 +67,8 @@ describe('contact domain validation', () => {
6567
if (result.success) {
6668
throw new Error('Expected schema validation to fail')
6769
}
68-
expect(z.flattenError(result.error).fieldErrors['message']).toContain('Message appears to contain spam')
70+
expect(z.flattenError(result.error).fieldErrors['message']).toContain(
71+
'Message appears to contain spam'
72+
)
6973
})
7074
})

src/actions/contact/__tests__/responder.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ describe('contact responder', () => {
107107
{ label: 'Budget', value: '$5k-$10k' },
108108
{ label: 'Timeline', value: '2-3-months' },
109109
])
110-
expect(templateData.attachments).toEqual([
111-
{ filename: 'brief.pdf', sizeLabel: '1.21 KB' },
112-
])
110+
expect(templateData.attachments).toEqual([{ filename: 'brief.pdf', sizeLabel: '1.21 KB' }])
113111
expect(templateData.consentGiven).toBe('Yes')
114112
expect(templateData.messageHtml).toContain('&lt;ASAP&gt;')
115113
expect(templateData.messageHtml).toContain('&amp;')

src/actions/contact/action.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import {
88
getResendApiKey,
99
isProd,
1010
} from '@actions/utils/environment/environmentActions'
11-
import { ActionsFunctionError, handleActionsFunctionError, throwActionError } from '@actions/utils/errors'
11+
import {
12+
ActionsFunctionError,
13+
handleActionsFunctionError,
14+
throwActionError,
15+
} from '@actions/utils/errors'
1216
import { contactFormSender, contactInbox, contactReplyTo } from '@actions/utils/email/resendSenders'
1317
import { createConsentRecord } from '@actions/gdpr/entities/consent'
1418
import { createOrUpdateContact, setMarketingOptIn } from '@actions/utils/hubspot'
@@ -121,7 +125,8 @@ export const contact = {
121125
userAgent,
122126
ipAddress: ip !== 'unknown' ? ip : null,
123127
privacyPolicyVersion: getPrivacyPolicyVersion(),
124-
consentText: null,
128+
consentText:
129+
'I consent to Webstack Builders processing my personal data for responding to your inquiry. See our Privacy Policy and Cookie Policy.',
125130
verified: true,
126131
})
127132
}
@@ -189,9 +194,13 @@ export const contact = {
189194
throw error
190195
}
191196

192-
throwActionError(error, { route, operation: 'submit' }, {
193-
fallbackMessage: 'Failed to send email. Please try again later.',
194-
})
197+
throwActionError(
198+
error,
199+
{ route, operation: 'submit' },
200+
{
201+
fallbackMessage: 'Failed to send email. Please try again later.',
202+
}
203+
)
195204
}
196205
},
197206
}),

src/actions/contact/utils.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
import { z } from 'astro/zod'
2-
import type {
3-
ContactTimeline,
4-
RequiredStringOptions,
5-
} from '@actions/contact/@types'
2+
import type { ContactTimeline, RequiredStringOptions } from '@actions/contact/@types'
63
import { isAllowedTimeline } from './responder'
74

8-
const requiredStringError = (
9-
requiredMessage: string,
10-
invalidTypeMessage: string
11-
) => (issue: { input?: unknown }): string =>
12-
issue.input === undefined ? requiredMessage : invalidTypeMessage
5+
const requiredStringError =
6+
(requiredMessage: string, invalidTypeMessage: string) =>
7+
(issue: { input?: unknown }): string =>
8+
issue.input === undefined ? requiredMessage : invalidTypeMessage
139

1410
export function escapeHtml(text: string): string {
1511
const map: Record<string, string> = {
@@ -39,7 +35,8 @@ export function readString(form: FormData, key: string): string {
3935
return typeof value === 'string' ? value : ''
4036
}
4137

42-
export const trimString = (value: unknown): unknown => (typeof value === 'string' ? value.trim() : value)
38+
export const trimString = (value: unknown): unknown =>
39+
typeof value === 'string' ? value.trim() : value
4340

4441
export const emptyStringToUndefined = (value: unknown): unknown => {
4542
if (value === null) return undefined
@@ -66,8 +63,8 @@ export const requiredString = (options: RequiredStringOptions) => {
6663
)
6764
}
6865

69-
export const isFile = (value: unknown): value is File => typeof File !== 'undefined' && value instanceof File
70-
66+
export const isFile = (value: unknown): value is File =>
67+
typeof File !== 'undefined' && value instanceof File
7168

7269
export const optionalFile = () => z.custom<File>(isFile).optional()
7370

0 commit comments

Comments
 (0)