@brandlab-digital/site-next 4.0.0 → 4.2.0
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.
- package/README.md +35 -0
- package/dist/contact/client.d.ts +2 -0
- package/dist/contact/client.d.ts.map +1 -1
- package/dist/contact/client.js +6 -0
- package/dist/contact/client.js.map +1 -1
- package/dist/contact/form-client.d.ts.map +1 -1
- package/dist/contact/form-client.js +5 -1
- package/dist/contact/form-client.js.map +1 -1
- package/dist/contact/route-handler.d.ts +5 -0
- package/dist/contact/route-handler.d.ts.map +1 -1
- package/dist/contact/route-handler.js +1 -0
- package/dist/contact/route-handler.js.map +1 -1
- package/dist/contact/server-entry.d.ts +2 -1
- package/dist/contact/server-entry.d.ts.map +1 -1
- package/dist/contact/server-entry.js +2 -1
- package/dist/contact/server-entry.js.map +1 -1
- package/dist/contact/server.d.ts +17 -0
- package/dist/contact/server.d.ts.map +1 -1
- package/dist/contact/server.js +66 -10
- package/dist/contact/server.js.map +1 -1
- package/dist/contact/shared.d.ts +2 -0
- package/dist/contact/shared.d.ts.map +1 -1
- package/dist/contact/shared.js +2 -0
- package/dist/contact/shared.js.map +1 -1
- package/dist/contact/spam-filter.d.ts +65 -0
- package/dist/contact/spam-filter.d.ts.map +1 -0
- package/dist/contact/spam-filter.js +347 -0
- package/dist/contact/spam-filter.js.map +1 -0
- package/dist/contact/spam-places.d.ts +8 -0
- package/dist/contact/spam-places.d.ts.map +1 -0
- package/dist/contact/spam-places.js +8 -0
- package/dist/contact/spam-places.js.map +1 -0
- package/package.json +2 -2
package/dist/contact/server.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import 'server-only';
|
|
|
2
2
|
import { type BrandlabContactContract } from '@brandlab-digital/site-core/contact';
|
|
3
3
|
import { createContactDefinitionFromContract, type ContactRuntimeDefinitionOptions } from './contract.js';
|
|
4
4
|
import { type BrandlabContactDeliveryAlert, type BrandlabContactSuppressionCheck, type BrandlabContactSuppressionStatus } from './delivery.js';
|
|
5
|
+
import { type BrandlabContactSpamFilterOptions } from './spam-filter.js';
|
|
5
6
|
import { type BrandlabContactRateLimitOptions, type BrandlabContactRateLimiter } from './rate-limit.js';
|
|
6
7
|
import { type ResendContactSend } from './resend.js';
|
|
7
8
|
import { type BrandlabContactDefinition, type BrandlabContactDeploymentMode, type ContactAttachmentProcessor, type ContactBotGuard, type ContactTransport } from './shared.js';
|
|
@@ -26,6 +27,11 @@ export interface BrandlabContactRuntimeOptions {
|
|
|
26
27
|
deploymentMode?: BrandlabContactDeploymentMode;
|
|
27
28
|
createResendSend: (apiKey: string) => ResendContactSend;
|
|
28
29
|
botGuard?: ContactBotGuard;
|
|
30
|
+
/**
|
|
31
|
+
* The shared spam filter (4.1.0), on by default: content signals (two or more, at least one strong, block silently)
|
|
32
|
+
* and the minimum fill time. Pass options to add phrases or relax a rule, or `false` to turn it off.
|
|
33
|
+
*/
|
|
34
|
+
spamFilter?: BrandlabContactSpamFilterOptions | false;
|
|
29
35
|
now?: () => Date;
|
|
30
36
|
/**
|
|
31
37
|
* Abuse limits per client IP and per email address on deployments that deliver (production and Preview): the
|
|
@@ -72,10 +78,17 @@ interface RecipientCheck {
|
|
|
72
78
|
interface ContactRouteHandlerOptions {
|
|
73
79
|
definition: BrandlabContactDefinition;
|
|
74
80
|
transport?: LoggedContactTransport;
|
|
81
|
+
/**
|
|
82
|
+
* Preview only (4.2.0): the transport a marked test enquiry (`bl_test=1`) uses, bound to Brandlab's own inbox
|
|
83
|
+
* (BRANDLAB_PREVIEW_TEST_RECIPIENT) whatever the deployment's recipient setting is. Production never has one.
|
|
84
|
+
*/
|
|
85
|
+
testTransport?: LoggedContactTransport;
|
|
75
86
|
/** The provider the route delivers through, named in the delivery-failure log when it has no transport. */
|
|
76
87
|
provider?: string;
|
|
77
88
|
attachmentProcessor?: ContactAttachmentProcessor;
|
|
78
89
|
botGuard?: ContactBotGuard;
|
|
90
|
+
/** The shared spam filter; on by default (undefined), `false` turns it off. */
|
|
91
|
+
spamFilter?: BrandlabContactSpamFilterOptions | false;
|
|
79
92
|
now?: () => Date;
|
|
80
93
|
rateLimiter?: BrandlabContactRateLimiter;
|
|
81
94
|
recipientCheck?: RecipientCheck;
|
|
@@ -88,5 +101,9 @@ export declare function getContactRequestLimits(definition: BrandlabContactDefin
|
|
|
88
101
|
maxStringBytes: number;
|
|
89
102
|
};
|
|
90
103
|
export declare function createContactRouteHandler(options: ContactRouteHandlerOptions): (request: Request) => Promise<Response>;
|
|
104
|
+
/** The header a Preview's contact route answers with (4.2.0): `preview; test-inbox=brandlab`. */
|
|
105
|
+
export declare const BRANDLAB_PREVIEW_CONTACT_HEADER = "x-brandlab-contact-mode";
|
|
106
|
+
/** The only inbox a marked test enquiry from a Preview deployment reaches (4.2.0). */
|
|
107
|
+
export declare const BRANDLAB_PREVIEW_TEST_RECIPIENT = "info@brandlabdigital.com.au";
|
|
91
108
|
export declare function createBrandlabContactRuntime(options: BrandlabContactRuntimeOptions): BrandlabContactRuntime;
|
|
92
109
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/contact/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAOL,KAAK,uBAAuB,EAI7B,MAAM,qCAAqC,CAAA;AAK5C,OAAO,EACL,mCAAmC,EACnC,KAAK,+BAA+B,EACrC,MAAM,eAAe,CAAA;AACtB,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACtC,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/contact/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAOL,KAAK,uBAAuB,EAI7B,MAAM,qCAAqC,CAAA;AAK5C,OAAO,EACL,mCAAmC,EACnC,KAAK,+BAA+B,EACrC,MAA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GAA2G;IAC3G,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mBAAmB,CAAC,EAAE,0BAA0B,CAAA;IAChD,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,gCAAgC,GAAG,KAAK,CAAA;IACrD,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;IAChB,WAAW,CAAC,EAAE,0BAA0B,CAAA;IACxC,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,iBAAiB,CAAC,EAAE,4BAA4B,CAAA;IAChD,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AA2LD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,yBAAyB;;;;EAQ5E;AA+rBD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,0BAA0B,aAgCpD,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CANnD;AAED,iGAAiG;AACjG,eAAO,MAAM,+BAA+B,4BAA4B,CAAA;AA8FxE,sFAAsF;AACtF,eAAO,MAAM,+BAA+B,gCAAgC,CAAA;AAE5E,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,GACrC,sBAAsB,CAuDxB"}
|
package/dist/contact/server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { normalizeContactAttributionSummary } from './attribution.js';
|
|
|
7
7
|
import { createContactDefinitionFromContract, } from './contract.js';
|
|
8
8
|
import { BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT, BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV, reportContactDeliveryFailure, } from './delivery.js';
|
|
9
9
|
import { renderContactEmail, sanitizeContactEmailSubject } from './email.js';
|
|
10
|
+
import { BRANDLAB_CONTACT_MIN_FILL_MS, assessBrandlabContactSpam, contactSpamFieldsOf, submittedTooFast, } from './spam-filter.js';
|
|
10
11
|
import { createBrandlabContactImageSanitizer } from './image-sanitizer.js';
|
|
11
12
|
import { createBrandlabContactRateLimiter, isBrandlabContactRateLimiter, } from './rate-limit.js';
|
|
12
13
|
import { RESEND_ERROR_CODES, createContractResendContactTransport, } from './resend.js';
|
|
@@ -395,6 +396,10 @@ function validationResult(fieldErrors) {
|
|
|
395
396
|
function deliveryUnavailable(retryable) {
|
|
396
397
|
return { ok: false, code: 'delivery_unavailable', retryable };
|
|
397
398
|
}
|
|
399
|
+
/** One redacted line per blocked enquiry, so false positives can be reviewed: the site and the signals, nothing else. */
|
|
400
|
+
function logSpamBlocked(projectId, signals) {
|
|
401
|
+
console.warn(JSON.stringify({ event: 'brandlab_contact_spam_blocked', site: projectId, signals }));
|
|
402
|
+
}
|
|
398
403
|
function fakeSuccess() {
|
|
399
404
|
return { ok: true, accepted: false, trackConversion: false };
|
|
400
405
|
}
|
|
@@ -666,6 +671,24 @@ async function handleSubmission(options, request, formData, outcome, ip) {
|
|
|
666
671
|
if (Object.keys(validated.fieldErrors).length > 0) {
|
|
667
672
|
return validationResult(validated.fieldErrors);
|
|
668
673
|
}
|
|
674
|
+
if (options.spamFilter !== false) {
|
|
675
|
+
const filter = options.spamFilter ?? {};
|
|
676
|
+
const startedAt = stringEntry(formData, CONTACT_FORM_FIELDS.formStartedAt).trim();
|
|
677
|
+
if (submittedTooFast(startedAt, metadata.submittedAt, filter.minFillMs ?? BRANDLAB_CONTACT_MIN_FILL_MS)) {
|
|
678
|
+
logSpamBlocked(options.definition.projectId, ['fill-time']);
|
|
679
|
+
return fakeSuccess();
|
|
680
|
+
}
|
|
681
|
+
try {
|
|
682
|
+
const assessment = await assessBrandlabContactSpam(validated.values, contactSpamFieldsOf(options.definition.fields), filter);
|
|
683
|
+
if (assessment.blocked) {
|
|
684
|
+
logSpamBlocked(options.definition.projectId, assessment.signals);
|
|
685
|
+
return fakeSuccess();
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
catch {
|
|
689
|
+
// A filter fault never costs a lead: the enquiry goes through as it would have without the filter.
|
|
690
|
+
}
|
|
691
|
+
}
|
|
669
692
|
const mode = options.definition.deploymentMode ?? 'production';
|
|
670
693
|
if (options.rateLimiter && (mode === 'production' || mode === 'preview')) {
|
|
671
694
|
const emailField = options.definition.fields.find((field) => getFieldRole(field) === 'email');
|
|
@@ -713,13 +736,18 @@ async function handleSubmission(options, request, formData, outcome, ip) {
|
|
|
713
736
|
if (mode === 'development' || mode === 'test') {
|
|
714
737
|
return fakeSuccess();
|
|
715
738
|
}
|
|
716
|
-
|
|
739
|
+
// A Brandlab test enquiry: delivered like any other, flagged in the subject and never reported as a lead. On a
|
|
740
|
+
// Preview (4.2.0) it goes only to Brandlab's own inbox, never to the client's.
|
|
741
|
+
const testEnquiry = stringEntry(formData, CONTACT_FORM_FIELDS.testMarker).trim() === BRANDLAB_CONTACT_TEST_MARKER;
|
|
742
|
+
const previewTest = testEnquiry && mode === 'preview';
|
|
743
|
+
const transport = previewTest ? options.testTransport : options.transport;
|
|
744
|
+
if (!transport) {
|
|
717
745
|
// Production or Preview without its email key or recipients: every enquiry fails until it is set.
|
|
718
746
|
logDeliveryFailure({ provider: options.provider, code: 'not_configured' });
|
|
719
747
|
return deliveryUnavailable(false);
|
|
720
748
|
}
|
|
721
|
-
const provider =
|
|
722
|
-
if (options.recipientCheck && options.recipientCheck.recipients.length > 0) {
|
|
749
|
+
const provider = transport.provider ?? options.provider;
|
|
750
|
+
if (!previewTest && options.recipientCheck && options.recipientCheck.recipients.length > 0) {
|
|
723
751
|
const { recipients, check } = options.recipientCheck;
|
|
724
752
|
const statuses = await Promise.all(recipients.map((address) => Promise.resolve()
|
|
725
753
|
.then(() => check(address))
|
|
@@ -748,10 +776,8 @@ async function handleSubmission(options, request, formData, outcome, ip) {
|
|
|
748
776
|
confirmationId,
|
|
749
777
|
attachments,
|
|
750
778
|
});
|
|
751
|
-
// A Brandlab test enquiry: delivered like any other, flagged in the subject and never reported as a lead.
|
|
752
|
-
const testEnquiry = stringEntry(formData, CONTACT_FORM_FIELDS.testMarker).trim() === BRANDLAB_CONTACT_TEST_MARKER;
|
|
753
779
|
try {
|
|
754
|
-
const transportResult = await
|
|
780
|
+
const transportResult = await transport.send({
|
|
755
781
|
idempotencyKey: createIdempotencyKey(options.definition.projectId, metadata.clientSubmissionId),
|
|
756
782
|
confirmationId,
|
|
757
783
|
subject: testEnquiry ? sanitizeContactEmailSubject(`[Test] ${rendered.subject}`) : rendered.subject,
|
|
@@ -797,6 +823,22 @@ export function createContactRouteHandler(options) {
|
|
|
797
823
|
throw new Error('The contact rate limiter is invalid.');
|
|
798
824
|
}
|
|
799
825
|
const limits = getContactRequestLimits(options.definition);
|
|
826
|
+
const previewMode = (options.definition.deploymentMode ?? 'production') === 'preview';
|
|
827
|
+
const handle = createContactRequestHandler(options, limits);
|
|
828
|
+
if (!previewMode)
|
|
829
|
+
return handle;
|
|
830
|
+
// A Preview's contact route says so on every answer (4.2.0), and that its marked test enquiries reach only
|
|
831
|
+
// Brandlab's inbox, so brandlab-preview-enquiry can confirm both before it sends one. Production never says it.
|
|
832
|
+
return async (request) => {
|
|
833
|
+
const response = await handle(request);
|
|
834
|
+
const headers = new Headers(response.headers);
|
|
835
|
+
headers.set(BRANDLAB_PREVIEW_CONTACT_HEADER, 'preview; test-inbox=brandlab');
|
|
836
|
+
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
/** The header a Preview's contact route answers with (4.2.0): `preview; test-inbox=brandlab`. */
|
|
840
|
+
export const BRANDLAB_PREVIEW_CONTACT_HEADER = 'x-brandlab-contact-mode';
|
|
841
|
+
function createContactRequestHandler(options, limits) {
|
|
800
842
|
return async (request) => {
|
|
801
843
|
if (!(request instanceof Request) || request.method.toUpperCase() !== 'POST') {
|
|
802
844
|
return jsonResult(validationResult(), 405);
|
|
@@ -837,9 +879,19 @@ function createRuntimeTransport(options, contract, mode) {
|
|
|
837
879
|
const environment = options.environment ?? {};
|
|
838
880
|
const apiKey = environment[BRANDLAB_CONTACT_API_KEY_ENV];
|
|
839
881
|
try {
|
|
840
|
-
|
|
841
|
-
if (!boundedSecret(apiKey) || recipients.length === 0)
|
|
882
|
+
if (!boundedSecret(apiKey))
|
|
842
883
|
return undefined;
|
|
884
|
+
// Preview (4.2.0): marked test enquiries go to Brandlab's own inbox only, whatever the recipient setting says.
|
|
885
|
+
const testTransport = mode === 'preview'
|
|
886
|
+
? createContractResendContactTransport({
|
|
887
|
+
contract,
|
|
888
|
+
environment: { ...environment, [contract.delivery.recipientEnv]: BRANDLAB_PREVIEW_TEST_RECIPIENT },
|
|
889
|
+
send: options.createResendSend(apiKey),
|
|
890
|
+
})
|
|
891
|
+
: undefined;
|
|
892
|
+
const recipients = parseContactEmailRecipients(environment[contract.delivery.recipientEnv]);
|
|
893
|
+
if (recipients.length === 0)
|
|
894
|
+
return testTransport ? { testTransport } : undefined;
|
|
843
895
|
const transport = createContractResendContactTransport({
|
|
844
896
|
contract,
|
|
845
897
|
environment,
|
|
@@ -851,12 +903,14 @@ function createRuntimeTransport(options, contract, mode) {
|
|
|
851
903
|
const recipientCheck = suppressionCheck
|
|
852
904
|
? { recipients, check: (address) => suppressionCheck.check(address, { apiKey: lookupApiKey }) }
|
|
853
905
|
: undefined;
|
|
854
|
-
return { transport, recipientCheck };
|
|
906
|
+
return { transport, ...(recipientCheck ? { recipientCheck } : {}), ...(testTransport ? { testTransport } : {}) };
|
|
855
907
|
}
|
|
856
908
|
catch {
|
|
857
909
|
return undefined;
|
|
858
910
|
}
|
|
859
911
|
}
|
|
912
|
+
/** The only inbox a marked test enquiry from a Preview deployment reaches (4.2.0). */
|
|
913
|
+
export const BRANDLAB_PREVIEW_TEST_RECIPIENT = 'info@brandlabdigital.com.au';
|
|
860
914
|
export function createBrandlabContactRuntime(options) {
|
|
861
915
|
if (!options || typeof options !== 'object') {
|
|
862
916
|
throw new TypeError('Contact runtime options are required.');
|
|
@@ -891,7 +945,8 @@ export function createBrandlabContactRuntime(options) {
|
|
|
891
945
|
const delivery = createRuntimeTransport(options, contract, mode);
|
|
892
946
|
const contactRouteHandler = createContactRouteHandler({
|
|
893
947
|
definition,
|
|
894
|
-
...(delivery ? { transport: delivery.transport } : {}),
|
|
948
|
+
...(delivery?.transport ? { transport: delivery.transport } : {}),
|
|
949
|
+
...(delivery?.testTransport ? { testTransport: delivery.testTransport } : {}),
|
|
895
950
|
...(delivery?.recipientCheck ? { recipientCheck: delivery.recipientCheck } : {}),
|
|
896
951
|
...(options.onDeliveryFailure ? { onDeliveryFailure: options.onDeliveryFailure } : {}),
|
|
897
952
|
...(options.refuseWhenAllSuppressed === true ? { refuseWhenAllSuppressed: true } : {}),
|
|
@@ -900,6 +955,7 @@ export function createBrandlabContactRuntime(options) {
|
|
|
900
955
|
? { attachmentProcessor: createBrandlabContactImageSanitizer() }
|
|
901
956
|
: {}),
|
|
902
957
|
...(options.botGuard ? { botGuard: options.botGuard } : {}),
|
|
958
|
+
...(options.spamFilter !== undefined ? { spamFilter: options.spamFilter } : {}),
|
|
903
959
|
...(options.now ? { now: options.now } : {}),
|
|
904
960
|
...(rateLimiter ? { rateLimiter } : {}),
|
|
905
961
|
});
|