@brandlab-digital/site-next 4.2.2 → 4.2.4

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 CHANGED
@@ -150,9 +150,16 @@ A blocked enquiry gets the normal silent success: the visitor sees the usual tha
150
150
  - **Rule:** block only with at least two signals, at least one of them strong. A second hit in the same pitch
151
151
  category counts as another signal. Weak signals never block on their own or together, and a filter fault always
152
152
  delivers.
153
- - **Fill time:** the shared form stamps `formStartedAt` when it renders. A submission under 3 seconds later is dropped
154
- silently (`signals:["fill-time"]`). A form without the stamp is never dropped on time. Scripted live or preview test
155
- enquiries must wait at least 3 seconds after the page loads before sending.
153
+ - **Fill time (weak, 4.2.3):** the shared form stamps `formStartedAt` when it renders. A submission under 3 seconds
154
+ later adds the weak `fill-time` signal. It never blocks on its own (browser autofill and returning visitors send
155
+ real enquiries that fast); it blocks only beside a strong signal, like any other weak one. Before 4.2.3 fill time
156
+ alone dropped the enquiry. A form without the stamp never gets the signal.
157
+
158
+ - **Visitor clocks (4.2.4):** `formStartedAt` and `submittedAt` come from the visitor's clock, so fill time compares
159
+ the two and a clock offset cancels out. The route no longer refuses a `submittedAt` ahead of the server: before
160
+ 4.2.4 a desktop clock running more than 5 minutes fast made the form unsendable (`lead_form_error`,
161
+ `error_reason: request`). Only a `submittedAt` more than a day behind the server is refused, as a stale replay. The
162
+ email's "Submitted" time is the server's receipt time.
156
163
 
157
164
  Site overrides go through `spamFilter` on `createBrandlabContactRouteHandler`: `extraPhrases`, `knownSenderHashes`,
158
165
  `ignoreSignals`, `minFillMs`, or `false` to turn the filter off. There is no bypass word; a genuine test enquiry passes
@@ -3,5 +3,5 @@ export { BRANDLAB_CONTACT_API_KEY_ENV, BRANDLAB_CONTACT_MAX_REQUEST_BYTES, BRAND
3
3
  export { createBrandlabContactRouteHandler, createLazyResendContactSend, type BrandlabContactRouteHandlerOptions, } from './route-handler.js';
4
4
  export { BRANDLAB_CONTACT_DELIVERY_ALERT_FAILED_EVENT, BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT, BRANDLAB_CONTACT_DELIVERY_STATUS_EVENT, BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV, BRANDLAB_CONTACT_SUPPRESSION_CACHE_MS, BRANDLAB_CONTACT_SUPPRESSION_UNAVAILABLE_EVENT, createResendSuppressionCheck, type BrandlabContactDeliveryAlert, type BrandlabContactDeliveryFailure, type BrandlabContactDeliveryFailureCode, type BrandlabContactSuppressionCheck, type BrandlabContactSuppressionStatus, type ResendSuppressionCheckOptions, } from './delivery.js';
5
5
  export { BRANDLAB_RESEND_WEBHOOK_RATE_LIMIT, BRANDLAB_RESEND_WEBHOOK_SECRET_ENV, createBrandlabResendWebhookRoute, verifyResendWebhookSignature, type BrandlabResendWebhookRoute, type BrandlabResendWebhookRouteOptions, } from './resend-webhook.js';
6
- export { BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES, BRANDLAB_CONTACT_MIN_FILL_MS, BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS, BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS, assessBrandlabContactSpam, contactSpamFieldsOf, isClearlyForeignOrRandomSuburb, type BrandlabContactSpamAssessment, type BrandlabContactSpamFilterOptions, type BrandlabContactSpamSignal, } from './spam-filter.js';
6
+ export { BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES, BRANDLAB_CONTACT_MIN_FILL_MS, BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS, BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS, assessBrandlabContactSpam, contactSpamFieldsOf, isClearlyForeignOrRandomSuburb, type BrandlabContactSpamAssessment, type BrandlabContactSpamContext, type BrandlabContactSpamFilterOptions, type BrandlabContactSpamSignal, } from './spam-filter.js';
7
7
  //# sourceMappingURL=server-entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-entry.d.ts","sourceRoot":"","sources":["../../src/contact/server-entry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,EACnC,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,uCAAuC,EAC5C,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,4CAA4C,EAC5C,sCAAsC,EACtC,sCAAsC,EACtC,mCAAmC,EACnC,qCAAqC,EACrC,8CAA8C,EAC9C,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,iCAAiC,GACvC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,yCAAyC,EACzC,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,8BAA8B,EAC9B,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,yBAAyB,GAC/B,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"server-entry.d.ts","sourceRoot":"","sources":["../../src/contact/server-entry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,EACnC,KAAK,+BAA+B,EACpC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,uCAAuC,EAC5C,KAAK,6BAA6B,EAClC,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iCAAiC,EACjC,2BAA2B,EAC3B,KAAK,kCAAkC,GACxC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,4CAA4C,EAC5C,sCAAsC,EACtC,sCAAsC,EACtC,mCAAmC,EACnC,qCAAqC,EACrC,8CAA8C,EAC9C,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,KAAK,+BAA+B,EACpC,KAAK,gCAAgC,EACrC,KAAK,6BAA6B,GACnC,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,EAC5B,KAAK,0BAA0B,EAC/B,KAAK,iCAAiC,GACvC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,yCAAyC,EACzC,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,8BAA8B,EAC9B,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,gCAAgC,EACrC,KAAK,yBAAyB,GAC/B,MAAM,kBAAkB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"server-entry.js","sourceRoot":"","sources":["../../src/contact/server-entry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,GASpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iCAAiC,EACjC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,4CAA4C,EAC5C,sCAAsC,EACtC,sCAAsC,EACtC,mCAAmC,EACnC,qCAAqC,EACrC,8CAA8C,EAC9C,4BAA4B,GAO7B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,GAG7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,yCAAyC,EACzC,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,8BAA8B,GAI/B,MAAM,kBAAkB,CAAA","sourcesContent":["import 'server-only'\n\nexport {\n BRANDLAB_CONTACT_API_KEY_ENV,\n BRANDLAB_CONTACT_MAX_REQUEST_BYTES,\n BRANDLAB_CONTACT_RATE_LIMITS,\n BRANDLAB_CONTACT_RUNTIME,\n BRANDLAB_PREVIEW_CONTACT_HEADER,\n BRANDLAB_PREVIEW_TEST_RECIPIENT,\n createBrandlabContactRateLimiter,\n createBrandlabContactRuntime,\n createResendSdkContactSend,\n detectBrandlabContactDeploymentMode,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimitRule,\n type BrandlabContactRateLimiter,\n type BrandlabContactRuntime,\n type BrandlabContactRuntimeDefinitionOptions,\n type BrandlabContactRuntimeOptions,\n type ResendContactSend,\n type ResendSdkContactClient,\n} from './server.js'\nexport {\n createBrandlabContactRouteHandler,\n createLazyResendContactSend,\n type BrandlabContactRouteHandlerOptions,\n} from './route-handler.js'\nexport {\n BRANDLAB_CONTACT_DELIVERY_ALERT_FAILED_EVENT,\n BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n BRANDLAB_CONTACT_DELIVERY_STATUS_EVENT,\n BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV,\n BRANDLAB_CONTACT_SUPPRESSION_CACHE_MS,\n BRANDLAB_CONTACT_SUPPRESSION_UNAVAILABLE_EVENT,\n createResendSuppressionCheck,\n type BrandlabContactDeliveryAlert,\n type BrandlabContactDeliveryFailure,\n type BrandlabContactDeliveryFailureCode,\n type BrandlabContactSuppressionCheck,\n type BrandlabContactSuppressionStatus,\n type ResendSuppressionCheckOptions,\n} from './delivery.js'\nexport {\n BRANDLAB_RESEND_WEBHOOK_RATE_LIMIT,\n BRANDLAB_RESEND_WEBHOOK_SECRET_ENV,\n createBrandlabResendWebhookRoute,\n verifyResendWebhookSignature,\n type BrandlabResendWebhookRoute,\n type BrandlabResendWebhookRouteOptions,\n} from './resend-webhook.js'\nexport {\n BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES,\n BRANDLAB_CONTACT_MIN_FILL_MS,\n BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS,\n BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS,\n assessBrandlabContactSpam,\n contactSpamFieldsOf,\n isClearlyForeignOrRandomSuburb,\n type BrandlabContactSpamAssessment,\n type BrandlabContactSpamFilterOptions,\n type BrandlabContactSpamSignal,\n} from './spam-filter.js'\n"]}
1
+ {"version":3,"file":"server-entry.js","sourceRoot":"","sources":["../../src/contact/server-entry.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,4BAA4B,EAC5B,wBAAwB,EACxB,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,0BAA0B,EAC1B,mCAAmC,GASpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,iCAAiC,EACjC,2BAA2B,GAE5B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,4CAA4C,EAC5C,sCAAsC,EACtC,sCAAsC,EACtC,mCAAmC,EACnC,qCAAqC,EACrC,8CAA8C,EAC9C,4BAA4B,GAO7B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,GAG7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,yCAAyC,EACzC,4BAA4B,EAC5B,oCAAoC,EACpC,kCAAkC,EAClC,yBAAyB,EACzB,mBAAmB,EACnB,8BAA8B,GAK/B,MAAM,kBAAkB,CAAA","sourcesContent":["import 'server-only'\n\nexport {\n BRANDLAB_CONTACT_API_KEY_ENV,\n BRANDLAB_CONTACT_MAX_REQUEST_BYTES,\n BRANDLAB_CONTACT_RATE_LIMITS,\n BRANDLAB_CONTACT_RUNTIME,\n BRANDLAB_PREVIEW_CONTACT_HEADER,\n BRANDLAB_PREVIEW_TEST_RECIPIENT,\n createBrandlabContactRateLimiter,\n createBrandlabContactRuntime,\n createResendSdkContactSend,\n detectBrandlabContactDeploymentMode,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimitRule,\n type BrandlabContactRateLimiter,\n type BrandlabContactRuntime,\n type BrandlabContactRuntimeDefinitionOptions,\n type BrandlabContactRuntimeOptions,\n type ResendContactSend,\n type ResendSdkContactClient,\n} from './server.js'\nexport {\n createBrandlabContactRouteHandler,\n createLazyResendContactSend,\n type BrandlabContactRouteHandlerOptions,\n} from './route-handler.js'\nexport {\n BRANDLAB_CONTACT_DELIVERY_ALERT_FAILED_EVENT,\n BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n BRANDLAB_CONTACT_DELIVERY_STATUS_EVENT,\n BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV,\n BRANDLAB_CONTACT_SUPPRESSION_CACHE_MS,\n BRANDLAB_CONTACT_SUPPRESSION_UNAVAILABLE_EVENT,\n createResendSuppressionCheck,\n type BrandlabContactDeliveryAlert,\n type BrandlabContactDeliveryFailure,\n type BrandlabContactDeliveryFailureCode,\n type BrandlabContactSuppressionCheck,\n type BrandlabContactSuppressionStatus,\n type ResendSuppressionCheckOptions,\n} from './delivery.js'\nexport {\n BRANDLAB_RESEND_WEBHOOK_RATE_LIMIT,\n BRANDLAB_RESEND_WEBHOOK_SECRET_ENV,\n createBrandlabResendWebhookRoute,\n verifyResendWebhookSignature,\n type BrandlabResendWebhookRoute,\n type BrandlabResendWebhookRouteOptions,\n} from './resend-webhook.js'\nexport {\n BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES,\n BRANDLAB_CONTACT_MIN_FILL_MS,\n BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS,\n BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS,\n assessBrandlabContactSpam,\n contactSpamFieldsOf,\n isClearlyForeignOrRandomSuburb,\n type BrandlabContactSpamAssessment,\n type BrandlabContactSpamContext,\n type BrandlabContactSpamFilterOptions,\n type BrandlabContactSpamSignal,\n} from './spam-filter.js'\n"]}
@@ -28,8 +28,8 @@ export interface BrandlabContactRuntimeOptions {
28
28
  createResendSend: (apiKey: string) => ResendContactSend;
29
29
  botGuard?: ContactBotGuard;
30
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.
31
+ * The shared spam filter (4.1.0), on by default: content signals and the minimum fill time (two or more signals, at
32
+ * least one strong, block silently; fill time is a weak signal and never blocks alone). Pass options to add phrases or relax a rule, or `false` to turn it off.
33
33
  */
34
34
  spamFilter?: BrandlabContactSpamFilterOptions | false;
35
35
  now?: () => Date;
@@ -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,KA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AC,EAAE,4BAA4B,CAAA;IAChD,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AA2LD,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,yBAAyB;;;;EAQ5E;AA8rBD,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"}
@@ -40,8 +40,10 @@ const SAFE_PROVIDER_MESSAGE_ID_PATTERN = /^[A-Za-z0-9._-]{1,256}$/;
40
40
  const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
41
41
  const EMAIL_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/;
42
42
  const ISO_TIMESTAMP_PATTERN = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
43
+ // submittedAt comes from the visitor's clock. It may run ahead of the server by any amount (4.2.4: a
44
+ // fast desktop clock used to make the form unsendable), so only a submission more than a day behind the
45
+ // server is refused, as a stale replay.
43
46
  const MAX_SUBMISSION_AGE_MS = 24 * 60 * 60 * 1_000;
44
- const MAX_CLOCK_SKEW_MS = 5 * 60 * 1_000;
45
47
  const DEFAULT_MAX_ENTRIES = 64;
46
48
  const DEFAULT_MAX_STRING_BYTES = 64 * 1_024;
47
49
  const SUPPORTED_ATTACHMENT_MIME_TYPES = new Set([
@@ -429,7 +431,6 @@ function parseSubmissionMetadata(definition, formData, now) {
429
431
  const submittedMs = Date.parse(submittedAt);
430
432
  const nowMs = now.getTime();
431
433
  if (!Number.isFinite(submittedMs) ||
432
- submittedMs > nowMs + MAX_CLOCK_SKEW_MS ||
433
434
  submittedMs < nowMs - MAX_SUBMISSION_AGE_MS) {
434
435
  return undefined;
435
436
  }
@@ -674,12 +675,10 @@ async function handleSubmission(options, request, formData, outcome, ip) {
674
675
  if (options.spamFilter !== false) {
675
676
  const filter = options.spamFilter ?? {};
676
677
  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
678
  try {
682
- const assessment = await assessBrandlabContactSpam(validated.values, contactSpamFieldsOf(options.definition.fields), filter);
679
+ // Fill time is one weak signal inside the 2+ rule (4.2.3): a fast autofilled enquiry with nothing else is sent.
680
+ const tooFast = submittedTooFast(startedAt, metadata.submittedAt, filter.minFillMs ?? BRANDLAB_CONTACT_MIN_FILL_MS);
681
+ const assessment = await assessBrandlabContactSpam(validated.values, contactSpamFieldsOf(options.definition.fields), filter, { submittedTooFast: tooFast });
683
682
  if (assessment.blocked) {
684
683
  logSpamBlocked(options.definition.projectId, assessment.signals);
685
684
  return fakeSuccess();
@@ -772,7 +771,8 @@ async function handleSubmission(options, request, formData, outcome, ip) {
772
771
  definition: options.definition,
773
772
  values: validated.values,
774
773
  context: metadata.context,
775
- submittedAt: metadata.submittedAt,
774
+ // The time the server received it: the visitor's clock may be wrong.
775
+ submittedAt: now.toISOString(),
776
776
  confirmationId,
777
777
  attachments,
778
778
  });
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/contact/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,iCAAiC,EACjC,sCAAsC,EACtC,oCAAoC,EACpC,+BAA+B,EAC/B,qBAAqB,EACrB,2BAA2B,GAK5B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAA;AACnF,OAAO,EAAE,0BAA0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BAAuB,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,QAAQ,EAAE,QAAQ;QAClB,GAAG,CAAC,UAAU,CAAC,WAAW;YACxB,CAAC,CAAC,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,EAAE;YAChE,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,WAAW,EAAE,wBAAwB;QACrC,UAAU;QACV,mBAAmB;KACpB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import 'server-only'\n\nimport {\n DEFAULT_CONTACT_ATTACHMENT_POLICY,\n deriveContactAttachmentTransportPolicy,\n detectContactTransportAttachmentType,\n createContactAttachmentFilename,\n defineContactContract,\n parseContactEmailRecipients,\n type BrandlabContactContract,\n type ContactActionResult,\n type ContactAttachmentMimeType,\n type ContactAttachmentPolicy,\n} from '@brandlab-digital/site-core/contact'\nimport { isBrandlabCanonicalEntityId } from '@brandlab-digital/site-core/entity-id'\nimport { normalizeBrandlabRoutePath } from '@brandlab-digital/site-core/routes'\nimport { resolveBrandlabDeployment } from '@brandlab-digital/site-core/site'\nimport { normalizeContactAttributionSummary } from './attribution.js'\nimport {\n createContactDefinitionFromContract,\n type ContactRuntimeDefinitionOptions,\n} from './contract.js'\nimport {\n BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV,\n reportContactDeliveryFailure,\n type BrandlabContactDeliveryAlert,\n type BrandlabContactSuppressionCheck,\n type BrandlabContactSuppressionStatus,\n} from './delivery.js'\nimport { renderContactEmail, sanitizeContactEmailSubject } from './email.js'\nimport {\n BRANDLAB_CONTACT_MIN_FILL_MS,\n assessBrandlabContactSpam,\n contactSpamFieldsOf,\n submittedTooFast,\n type BrandlabContactSpamFilterOptions,\n} from './spam-filter.js'\nimport { createBrandlabContactImageSanitizer } from './image-sanitizer.js'\nimport {\n createBrandlabContactRateLimiter,\n isBrandlabContactRateLimiter,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimiter,\n} from './rate-limit.js'\nimport {\n RESEND_ERROR_CODES,\n createContractResendContactTransport,\n type ResendContactSend,\n} from './resend.js'\nimport {\n BRANDLAB_CONTACT_TEST_MARKER,\n CONTACT_CLIENT_SUBMISSION_ID_PATTERN,\n CONTACT_CONFIRMATION_ID_PATTERN,\n CONTACT_FORM_FIELDS,\n type BrandlabContactDefinition,\n type BrandlabContactDeploymentMode,\n type ContactAttachmentProcessor,\n type ContactBotAssessment,\n type ContactBotGuard,\n type ContactDeliveryAttachment,\n type ContactPageContext,\n type ContactRequestContext,\n type ContactTransport,\n} from './shared.js'\n\nexport { createBrandlabContactImageSanitizer } from './image-sanitizer.js'\nexport {\n BRANDLAB_CONTACT_RATE_LIMITS,\n createBrandlabContactRateLimiter,\n type BrandlabContactRateLimitDecision,\n type BrandlabContactRateLimitInput,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimitRule,\n type BrandlabContactRateLimiter,\n} from './rate-limit.js'\nexport { createResendSdkContactSend } from './resend.js'\nexport type { ResendContactSend, ResendSdkContactClient } from './resend.js'\n\nexport const BRANDLAB_CONTACT_RUNTIME = 'brandlab-contact-v4' as const\nexport const BRANDLAB_CONTACT_API_KEY_ENV = 'RESEND_API_KEY' as const\nexport const BRANDLAB_CONTACT_MAX_REQUEST_BYTES = 4_500_000\n\n/**\n * Contact delivery follows the shared deployment gate on the server's own\n * VERCEL_ENV: production and Preview deliver, everything else (including a\n * local `next start`) accepts without sending. NODE_ENV=test adds test mode.\n */\nexport function detectBrandlabContactDeploymentMode(\n environment: Readonly<Record<string, string | undefined>>,\n): BrandlabContactDeploymentMode {\n const deployment = resolveBrandlabDeployment({\n VERCEL_ENV: environment.VERCEL_ENV,\n NODE_ENV: environment.NODE_ENV,\n })\n if (deployment.environment !== 'development') return deployment.environment\n return environment.NODE_ENV === 'test' ? 'test' : 'development'\n}\n\nconst FORM_URLENCODED = 'application/x-www-form-urlencoded'\nconst MULTIPART_FORM = 'multipart/form-data'\nconst MULTIPART_BOUNDARY_PATTERN =\n /(?:^|;)\\s*boundary=(?:\"[0-9A-Za-z'()+_,.\\/:=?-]{1,70}\"|[0-9A-Za-z'()+_,.\\/:=?-]{1,70})(?:;|$)/i\nconst FIELD_NAME_PATTERN = /^[a-z][A-Za-z0-9_-]{0,63}$/\nconst SAFE_PROVIDER_MESSAGE_ID_PATTERN = /^[A-Za-z0-9._-]{1,256}$/\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\nconst EMAIL_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/\nconst ISO_TIMESTAMP_PATTERN =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/\nconst MAX_SUBMISSION_AGE_MS = 24 * 60 * 60 * 1_000\nconst MAX_CLOCK_SKEW_MS = 5 * 60 * 1_000\nconst DEFAULT_MAX_ENTRIES = 64\nconst DEFAULT_MAX_STRING_BYTES = 64 * 1_024\nconst SUPPORTED_ATTACHMENT_MIME_TYPES = new Set([\n 'application/pdf',\n 'image/jpeg',\n 'image/jpg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/heic',\n 'image/heif',\n])\n\nexport type BrandlabContactRuntimeDefinitionOptions = Omit<\n ContactRuntimeDefinitionOptions,\n 'deploymentMode'\n>\n\nexport interface BrandlabContactRuntimeOptions {\n contract: BrandlabContactContract\n runtime: BrandlabContactRuntimeDefinitionOptions\n environment?: Readonly<Record<string, string | undefined>>\n deploymentMode?: BrandlabContactDeploymentMode\n createResendSend: (apiKey: string) => ResendContactSend\n botGuard?: ContactBotGuard\n /**\n * The shared spam filter (4.1.0), on by default: content signals (two or more, at least one strong, block silently)\n * and the minimum fill time. Pass options to add phrases or relax a rule, or `false` to turn it off.\n */\n spamFilter?: BrandlabContactSpamFilterOptions | false\n now?: () => Date\n /**\n * Abuse limits per client IP and per email address on deployments that deliver (production and Preview): the\n * defaults (BRANDLAB_CONTACT_RATE_LIMITS) when omitted, adjusted limits, a limiter shared across runtimes, or\n * `false` to turn them off. Create a runtime once per route module so its limits persist between requests.\n */\n rateLimit?: BrandlabContactRateLimitOptions | BrandlabContactRateLimiter | false\n /**\n * Checks each business inbox against Resend's suppression list before sending (3.14.0), with the runtime's\n * `RESEND_API_KEY`. Pass one check shared across runtimes so its cache outlives each request\n * (`createBrandlabContactRouteHandler` does). The check only records and alerts: when any inbox is suppressed a\n * `recipient_suppressed` failure is logged and alerted, and the enquiry is still sent to the client's own inboxes with\n * the normal sent result. It never blocks a send unless the site opts in with `refuseWhenAllSuppressed: true`.\n * The lookup uses `RESEND_LOOKUP_API_KEY` (full access) when set, otherwise `RESEND_API_KEY`.\n */\n suppressionCheck?: BrandlabContactSuppressionCheck\n /**\n * Opt-in only (default `false`): when every business inbox is suppressed, refuse the enquiry with the non-retryable\n * `delivery_unavailable` answer (the form's call-us fallback) and track no conversion. By default the enquiry is sent\n * to the client's own inboxes as normal, still logging and alerting `recipient_suppressed`.\n */\n refuseWhenAllSuppressed?: boolean\n /** The same-day alert for a delivery failure the route finds before sending (3.14.0). */\n onDeliveryFailure?: BrandlabContactDeliveryAlert\n}\n\nexport interface BrandlabContactRuntime {\n runtimeKind: typeof BRANDLAB_CONTACT_RUNTIME\n definition: ReturnType<typeof createContactDefinitionFromContract>\n contactRouteHandler: (request: Request) => Promise<Response>\n}\n\n/**\n * A transport as the route reads it for the delivery-failure log (internal: the\n * public ContactTransport type is unchanged). The shared Resend transport names\n * itself and adds a failed send's documented provider code and HTTP status.\n */\ntype LoggedContactTransport = ContactTransport & { provider?: string }\n\n/** The pre-send suppression check as the route reads it: the business inboxes and a lookup bound to the API key. */\ninterface RecipientCheck {\n recipients: readonly string[]\n check(address: string): Promise<BrandlabContactSuppressionStatus>\n}\n\ninterface ContactRouteHandlerOptions {\n definition: BrandlabContactDefinition\n transport?: LoggedContactTransport\n /**\n * Preview only (4.2.0): the transport a marked test enquiry (`bl_test=1`) uses, bound to Brandlab's own inbox\n * (BRANDLAB_PREVIEW_TEST_RECIPIENT) whatever the deployment's recipient setting is. Production never has one.\n */\n testTransport?: LoggedContactTransport\n /** The provider the route delivers through, named in the delivery-failure log when it has no transport. */\n provider?: string\n attachmentProcessor?: ContactAttachmentProcessor\n botGuard?: ContactBotGuard\n /** The shared spam filter; on by default (undefined), `false` turns it off. */\n spamFilter?: BrandlabContactSpamFilterOptions | false\n now?: () => Date\n rateLimiter?: BrandlabContactRateLimiter\n recipientCheck?: RecipientCheck\n onDeliveryFailure?: BrandlabContactDeliveryAlert\n refuseWhenAllSuppressed?: boolean\n}\n\n/** What the route adds to the response beyond the result: the wait after a refused, rate-limited enquiry. */\ninterface SubmissionOutcome {\n retryAfterSeconds?: number\n}\n\nconst DELIVERY_FAILED_EVENT = BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT\n\n/** The only values the delivery-failure log writes: anything else is written as `unknown`. */\nconst DELIVERY_LOG_PROVIDERS: ReadonlySet<string> = new Set(['resend'])\nconst DELIVERY_LOG_CODES: ReadonlySet<string> = new Set([\n // The shared Resend transport's own codes.\n 'provider_rejected',\n 'provider_missing_id',\n 'provider_exception',\n 'message_refused',\n // The route's.\n 'provider_invalid_id',\n 'transport_exception',\n 'not_configured',\n // Resend's documented error names.\n ...RESEND_ERROR_CODES,\n])\n\n/**\n * One JSON line on the server's error output for each enquiry the email provider\n * did not accept, for the daily delivery monitor (Vercel logs):\n * `{\"event\":\"brandlab_contact_delivery_failed\",\"provider\":\"resend\",\"status\":429,\"code\":\"rate_limit_exceeded\"}`.\n * Only the provider, its HTTP status and a bounded code are written; a form value,\n * address, name or message never is.\n */\nfunction logDeliveryFailure(failure: { provider?: string; status?: number; code: string }) {\n const known = (allowed: ReadonlySet<string>, value: string | undefined) =>\n value !== undefined && allowed.has(value) ? value : 'unknown'\n const status =\n typeof failure.status === 'number' && Number.isInteger(failure.status) && failure.status >= 100 && failure.status <= 599\n ? failure.status\n : null\n console.error(\n JSON.stringify({\n event: DELIVERY_FAILED_EVENT,\n provider: known(DELIVERY_LOG_PROVIDERS, failure.provider),\n status,\n code: known(DELIVERY_LOG_CODES, failure.code),\n }),\n )\n}\n\nfunction getFieldRole(field: BrandlabContactDefinition['fields'][number]) {\n if (field.role) return field.role\n if (field.name === 'suburb' || field.name === 'location') return 'location' as const\n if (['name', 'email', 'phone', 'message'].includes(field.name)) {\n return field.name as 'name' | 'email' | 'phone' | 'message'\n }\n return 'custom' as const\n}\n\nfunction normalizedHttpsOrigin(value: string) {\n try {\n const url = new URL(value)\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n url.search ||\n url.hash ||\n (url.pathname !== '/' && url.pathname !== '') ||\n value.trim().replace(/\\/$/, '') !== url.origin\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction assertDefinition(definition: BrandlabContactDefinition) {\n if (!isBrandlabCanonicalEntityId(definition.projectId)) {\n throw new Error('projectId must be a canonical Brandlab entity ID.')\n }\n if (\n !definition.brandName.trim() ||\n definition.brandName.trim() !== definition.brandName ||\n definition.brandName.length > 160 ||\n /[\\u0000-\\u001f\\u007f]/.test(definition.brandName)\n ) {\n throw new Error('brandName must contain bounded reviewed text.')\n }\n if (!normalizedHttpsOrigin(definition.siteUrl)) {\n throw new Error('siteUrl must be a canonical HTTPS origin.')\n }\n const mode = definition.deploymentMode ?? 'production'\n if (!['production', 'preview', 'development', 'test'].includes(mode)) {\n throw new Error('deploymentMode is invalid.')\n }\n if (!Array.isArray(definition.fields) || definition.fields.length < 4) {\n throw new Error('Contact fields are unavailable.')\n }\n const honeypotField = definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot\n const reservedFields = new Set<string>(\n Object.values(CONTACT_FORM_FIELDS).filter(\n (fieldName) => fieldName !== CONTACT_FORM_FIELDS.honeypot,\n ),\n )\n if (!FIELD_NAME_PATTERN.test(honeypotField) || reservedFields.has(honeypotField)) {\n throw new Error('The contact honeypot field is invalid.')\n }\n const fieldNames = new Set<string>()\n for (const field of definition.fields) {\n if (\n !FIELD_NAME_PATTERN.test(field.name) ||\n fieldNames.has(field.name) ||\n reservedFields.has(field.name) ||\n field.name === honeypotField ||\n !field.label.trim() ||\n field.label.length > 120\n ) {\n throw new Error(`Contact field \"${field.name}\" is invalid.`)\n }\n fieldNames.add(field.name)\n }\n for (const role of ['name', 'email', 'phone', 'message'] as const) {\n if (definition.fields.filter((field) => getFieldRole(field) === role).length !== 1) {\n throw new Error(`Contact definition requires exactly one \"${role}\" field.`)\n }\n }\n if (definition.fields.filter((field) => getFieldRole(field) === 'location').length > 1) {\n throw new Error('Contact definition allows at most one \"location\" field.')\n }\n if (definition.attachments) {\n const policy = attachmentPolicy(definition)\n if (\n !Number.isSafeInteger(policy.maxFiles) ||\n policy.maxFiles < 1 ||\n policy.maxFiles > 20 ||\n !Number.isSafeInteger(policy.maxFileSizeBytes) ||\n policy.maxFileSizeBytes < 1 ||\n !Number.isSafeInteger(policy.maxTotalSizeBytes) ||\n policy.maxTotalSizeBytes < policy.maxFileSizeBytes ||\n policy.maxTotalSizeBytes > BRANDLAB_CONTACT_MAX_REQUEST_BYTES ||\n policy.allowedTypes.length < 1 ||\n policy.allowedTypes.some((type) => !SUPPORTED_ATTACHMENT_MIME_TYPES.has(type))\n ) {\n throw new Error('The contact attachment policy is invalid.')\n }\n }\n if (\n definition.email?.style &&\n Object.values(definition.email.style).some(\n (value) => !EMAIL_COLOR_PATTERN.test(value),\n )\n ) {\n throw new Error('Contact email colours must use six-digit hexadecimal values.')\n }\n if (definition.email?.logo) {\n const { url, alt, width } = definition.email.logo\n let parsed: URL | undefined\n try {\n parsed = new URL(url)\n } catch {\n parsed = undefined\n }\n if (\n !parsed ||\n parsed.protocol !== 'https:' ||\n parsed.username ||\n parsed.password ||\n parsed.search ||\n parsed.hash ||\n !alt.trim() ||\n alt.length > 160 ||\n (width !== undefined && (!Number.isInteger(width) || width < 32 || width > 240))\n ) {\n throw new Error('The contact email logo must be a reviewed HTTPS asset.')\n }\n }\n}\n\nfunction attachmentPolicy(definition: BrandlabContactDefinition): ContactAttachmentPolicy {\n return deriveContactAttachmentTransportPolicy({\n ...DEFAULT_CONTACT_ATTACHMENT_POLICY,\n ...(definition.attachments || {}),\n })\n}\n\nexport function getContactRequestLimits(definition: BrandlabContactDefinition) {\n return {\n maxRequestBytes:\n definition.limits?.maxRequestBytes ?? BRANDLAB_CONTACT_MAX_REQUEST_BYTES,\n maxEntries: definition.limits?.maxEntries ?? DEFAULT_MAX_ENTRIES,\n maxStringBytes:\n definition.limits?.maxStringBytes ?? DEFAULT_MAX_STRING_BYTES,\n }\n}\n\nfunction isAttachmentField(definition: BrandlabContactDefinition, name: string) {\n if (!definition.attachments) return false\n const prefix = definition.attachments.fieldPrefix ?? 'attachments'\n return name === prefix || new RegExp(`^${prefix}\\\\[\\\\d{1,2}\\\\]$`).test(name)\n}\n\nfunction validateFormShape(\n definition: BrandlabContactDefinition,\n formData: FormData,\n) {\n const limits = getContactRequestLimits(definition)\n const allowedStrings = new Set([\n ...definition.fields.map((field) => field.name),\n ...Object.values(CONTACT_FORM_FIELDS).filter(\n (fieldName) => fieldName !== CONTACT_FORM_FIELDS.honeypot,\n ),\n definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot,\n ])\n const counts = new Map<string, number>()\n let estimatedBytes = 0\n const entries = Array.from(formData.entries())\n if (entries.length < 1 || entries.length > limits.maxEntries) return false\n for (const [name, value] of entries) {\n if (!FIELD_NAME_PATTERN.test(name.replace(/\\[\\d{1,2}\\]$/, ''))) return false\n counts.set(name, (counts.get(name) ?? 0) + 1)\n if (typeof value === 'string') {\n if (!allowedStrings.has(name) || (counts.get(name) ?? 0) > 1) return false\n const bytes = new TextEncoder().encode(value).byteLength\n if (bytes > limits.maxStringBytes) return false\n estimatedBytes += bytes\n } else {\n if (!isAttachmentField(definition, name) || value.size < 0) return false\n estimatedBytes += value.size\n }\n if (estimatedBytes > limits.maxRequestBytes) return false\n }\n return true\n}\n\nfunction stringEntry(formData: FormData, name: string) {\n const value = formData.get(name)\n return typeof value === 'string' ? value : ''\n}\n\nfunction validateFields(definition: BrandlabContactDefinition, formData: FormData) {\n const values: Record<string, string> = {}\n const fieldErrors: Record<string, string[]> = {}\n for (const field of definition.fields) {\n let value = stringEntry(formData, field.name).trim()\n try {\n value = field.normalize ? field.normalize(value) : value\n } catch {\n fieldErrors[field.name] = [`${field.label} is invalid.`]\n continue\n }\n values[field.name] = value\n const role = getFieldRole(field)\n const required = field.required || role !== 'custom'\n if (required && !value) {\n fieldErrors[field.name] = [`${field.label} is required.`]\n continue\n }\n if (!value) continue\n const maximum = field.maxLength ?? (role === 'message' ? 5_000 : role === 'email' ? 254 : 200)\n if (value.length > maximum) {\n fieldErrors[field.name] = [`${field.label} is too long.`]\n continue\n }\n if ((field.kind === 'email' || role === 'email') && !EMAIL_PATTERN.test(value)) {\n fieldErrors[field.name] = ['Enter a valid email address.']\n continue\n }\n if (\n (field.kind === 'phone' || role === 'phone') &&\n !field.validate &&\n value.replace(/\\D/g, '').length < 6\n ) {\n fieldErrors[field.name] = ['Enter a valid phone number.']\n continue\n }\n if (field.options && !field.options.includes(value)) {\n fieldErrors[field.name] = [`Select a valid ${field.label.toLowerCase()}.`]\n continue\n }\n try {\n const issue = field.validate?.(value, values)\n if (issue) fieldErrors[field.name] = [issue]\n } catch {\n fieldErrors[field.name] = [`${field.label} is invalid.`]\n }\n }\n return { values, fieldErrors }\n}\n\nconst EXTENSION_TYPES: Record<string, ContactAttachmentMimeType> = {\n pdf: 'application/pdf',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n webp: 'image/webp',\n heic: 'image/heic',\n heif: 'image/heif',\n}\n\nfunction normalizeMimeType(value: string) {\n const normalized = value.trim().toLowerCase()\n return normalized === 'image/jpg' ? 'image/jpeg' : normalized\n}\n\nasync function readValidatedAttachments(\n definition: BrandlabContactDefinition,\n formData: FormData,\n) {\n if (!definition.attachments) return []\n const policy = attachmentPolicy(definition)\n const allowed = new Set(policy.allowedTypes.map(normalizeMimeType))\n const files = Array.from(formData.entries())\n .filter(\n ([name, value]) =>\n isAttachmentField(definition, name) &&\n typeof value !== 'string' &&\n value.size > 0,\n )\n .map(([, value]) => value as File)\n if (definition.attachments.required && files.length === 0) return undefined\n if (files.length > policy.maxFiles) return undefined\n\n const attachments: ContactDeliveryAttachment[] = []\n let totalBytes = 0\n for (const [index, file] of files.entries()) {\n const extension = file.name.toLowerCase().split('.').pop() ?? ''\n const extensionType = EXTENSION_TYPES[extension]\n const declaredType = normalizeMimeType(file.type)\n if (\n !extensionType ||\n !declaredType ||\n !allowed.has(extensionType) ||\n !allowed.has(declaredType) ||\n normalizeMimeType(extensionType) !== declaredType ||\n file.size > policy.maxFileSizeBytes\n ) {\n return undefined\n }\n totalBytes += file.size\n if (totalBytes > policy.maxTotalSizeBytes) return undefined\n const content = new Uint8Array(await file.arrayBuffer())\n if (normalizeMimeType(detectContactTransportAttachmentType(content.slice(0, 64)) ?? '') !== declaredType) {\n return undefined\n }\n attachments.push({\n filename: createContactAttachmentFilename({ index, contentType: declaredType }),\n content,\n contentType: declaredType,\n })\n }\n return attachments\n}\n\nfunction validateProcessedAttachments(\n definition: BrandlabContactDefinition,\n attachments: readonly ContactDeliveryAttachment[],\n) {\n if (!definition.attachments) return attachments.length === 0\n const policy = attachmentPolicy(definition)\n let totalBytes = 0\n if (attachments.length > policy.maxFiles) return false\n return attachments.every((attachment, index) => {\n totalBytes += attachment.content.byteLength\n return (\n attachment.filename === createContactAttachmentFilename({ index, contentType: attachment.contentType }) &&\n (attachment.contentType === 'image/jpeg' || (attachment.contentType === 'application/pdf' && policy.allowedTypes.includes('application/pdf'))) &&\n attachment.content.byteLength > 0 &&\n attachment.content.byteLength <= policy.maxFileSizeBytes &&\n totalBytes <= policy.maxTotalSizeBytes &&\n detectContactTransportAttachmentType(attachment.content.slice(0, 64)) === attachment.contentType\n )\n })\n}\n\nfunction validationResult(\n fieldErrors?: Record<string, string[]>,\n): ContactActionResult {\n return {\n ok: false,\n code: 'validation',\n retryable: false,\n ...(fieldErrors && Object.keys(fieldErrors).length > 0 ? { fieldErrors } : {}),\n }\n}\n\nfunction deliveryUnavailable(retryable: boolean): ContactActionResult {\n return { ok: false, code: 'delivery_unavailable', retryable }\n}\n\n/** One redacted line per blocked enquiry, so false positives can be reviewed: the site and the signals, nothing else. */\nfunction logSpamBlocked(projectId: string, signals: readonly string[]) {\n console.warn(JSON.stringify({ event: 'brandlab_contact_spam_blocked', site: projectId, signals }))\n}\n\nfunction fakeSuccess(): ContactActionResult {\n return { ok: true, accepted: false, trackConversion: false }\n}\n\n/**\n * Resend accepted the enquiry: it is queued for delivery, not yet delivered. `trackConversion` (and so `contact_form`)\n * keeps its analytics-v4 meaning, provider acceptance. Whether the business inbox actually received it is tracked\n * separately: the pre-send suppression check and the Resend webhook route (`brandlab_contact_delivery_failed`,\n * `brandlab_contact_delivery_status`).\n */\nfunction acceptedResult(confirmationId: string): ContactActionResult {\n return {\n ok: true,\n accepted: true,\n trackConversion: true,\n confirmationId,\n }\n}\n\nfunction parseSubmissionMetadata(\n definition: BrandlabContactDefinition,\n formData: FormData,\n now: Date,\n): {\n clientSubmissionId: string\n submittedAt: string\n context: ContactPageContext\n} | undefined {\n const clientSubmissionId = stringEntry(\n formData,\n CONTACT_FORM_FIELDS.clientSubmissionId,\n )\n .trim()\n .toLowerCase()\n const submittedAt = stringEntry(formData, CONTACT_FORM_FIELDS.submittedAt).trim()\n if (\n !CONTACT_CLIENT_SUBMISSION_ID_PATTERN.test(clientSubmissionId) ||\n !ISO_TIMESTAMP_PATTERN.test(submittedAt)\n ) {\n return undefined\n }\n const submittedMs = Date.parse(submittedAt)\n const nowMs = now.getTime()\n if (\n !Number.isFinite(submittedMs) ||\n submittedMs > nowMs + MAX_CLOCK_SKEW_MS ||\n submittedMs < nowMs - MAX_SUBMISSION_AGE_MS\n ) {\n return undefined\n }\n try {\n const pagePath = normalizeBrandlabRoutePath(\n stringEntry(formData, CONTACT_FORM_FIELDS.pagePath),\n )\n const pageLabel = stringEntry(formData, CONTACT_FORM_FIELDS.pageLabel).trim()\n if (\n pageLabel &&\n (pageLabel.length > 160 || /[\\u0000-\\u001f\\u007f]/.test(pageLabel))\n ) {\n return undefined\n }\n const attribution = normalizeContactAttributionSummary({\n initialLandingPath: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.initialLandingPath,\n ),\n visitSource: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.visitSource,\n ) as Parameters<typeof normalizeContactAttributionSummary>[0]['visitSource'],\n ...(stringEntry(formData, CONTACT_FORM_FIELDS.visitSourceDetail).trim()\n ? {\n visitSourceDetail: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.visitSourceDetail,\n ).trim(),\n }\n : {}),\n })\n return {\n clientSubmissionId,\n submittedAt,\n context: {\n pagePath,\n pageUrl: new URL(pagePath, definition.siteUrl).toString(),\n ...(pageLabel ? { pageLabel } : {}),\n ...attribution,\n },\n }\n } catch {\n return undefined\n }\n}\n\nasync function createConfirmationId(projectId: string, clientSubmissionId: string) {\n if (!globalThis.crypto?.subtle) {\n throw new Error('A secure digest implementation is required.')\n }\n const digest = await globalThis.crypto.subtle.digest(\n 'SHA-256',\n new TextEncoder().encode(`${projectId}:${clientSubmissionId}`),\n )\n return Array.from(new Uint8Array(digest), (byte) =>\n byte.toString(16).padStart(2, '0'),\n ).join('')\n}\n\nfunction createIdempotencyKey(projectId: string, clientSubmissionId: string) {\n const projectKey = projectId.replaceAll('&', '-and-')\n return `brandlab/contact/${projectKey}/${clientSubmissionId}`\n}\n\nfunction defaultBotAssessment(\n definition: BrandlabContactDefinition,\n formData: FormData,\n): ContactBotAssessment {\n const honeypotField = definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot\n return stringEntry(formData, honeypotField).trim()\n ? { status: 'accept-silently' }\n : { status: 'allow' }\n}\n\nfunction normalizedRequestOrigin(\n value: string | null,\n mode: BrandlabContactDeploymentMode,\n) {\n if (!value || value.length > 2_048) return undefined\n try {\n const url = new URL(value)\n const loopback =\n (mode === 'development' || mode === 'test') &&\n url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1')\n if (\n (url.protocol !== 'https:' && !loopback) ||\n url.username ||\n url.password ||\n url.pathname !== '/' ||\n url.search ||\n url.hash ||\n url.origin !== value\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction forwardedOrigin(request: Request) {\n const host = request.headers.get('x-forwarded-host')?.trim()\n const protocol = request.headers.get('x-forwarded-proto')?.trim()\n if (\n !host ||\n host.includes(',') ||\n host.length > 253 ||\n !/^[a-z0-9.-]+(?::\\d{1,5})?$/i.test(host) ||\n (protocol !== 'https' && protocol !== 'http')\n ) {\n return undefined\n }\n try {\n return new URL(`${protocol}://${host}`).origin\n } catch {\n return undefined\n }\n}\n\nfunction requestOriginCandidates(\n request: Request,\n definition: BrandlabContactDefinition,\n) {\n const mode = definition.deploymentMode ?? 'production'\n if (mode === 'production') {\n return new Set([normalizedHttpsOrigin(definition.siteUrl)])\n }\n const candidates = new Set<string>()\n try {\n candidates.add(new URL(request.url).origin)\n } catch {\n return undefined\n }\n const forwarded = forwardedOrigin(request)\n if (forwarded) candidates.add(forwarded)\n return candidates\n}\n\nfunction normalizedReferrerOrigin(\n value: string | null,\n mode: BrandlabContactDeploymentMode,\n) {\n if (!value || value.length > 2_048) return undefined\n try {\n const url = new URL(value)\n const loopback =\n (mode === 'development' || mode === 'test') &&\n url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1')\n if (\n (url.protocol !== 'https:' && !loopback) ||\n url.username ||\n url.password\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction sameOriginRequest(\n request: Request,\n definition: BrandlabContactDefinition,\n) {\n const mode = definition.deploymentMode ?? 'production'\n const candidates = requestOriginCandidates(request, definition)\n if (!candidates) return undefined\n\n const originHeader = request.headers.get('origin')\n if (originHeader !== null) {\n const origin = normalizedRequestOrigin(originHeader, mode)\n return origin && candidates.has(origin) ? origin : undefined\n }\n\n const fetchSite = request.headers.get('sec-fetch-site')\n if (fetchSite !== null && fetchSite !== 'same-origin') return undefined\n const referrerOrigin = normalizedReferrerOrigin(\n request.headers.get('referer'),\n mode,\n )\n return referrerOrigin && candidates.has(referrerOrigin)\n ? referrerOrigin\n : undefined\n}\n\nfunction contentTypeIsAllowed(value: string | null, uploadsEnabled: boolean) {\n if (!value || value.length > 256) return false\n const mediaType = value.split(';', 1)[0]?.trim().toLowerCase()\n if (uploadsEnabled && mediaType !== MULTIPART_FORM) return false\n if (mediaType === FORM_URLENCODED) return true\n return mediaType === MULTIPART_FORM && MULTIPART_BOUNDARY_PATTERN.test(value)\n}\n\nfunction contentLengthIsAllowed(value: string | null, maximum: number) {\n if (value === null) return true\n if (!/^\\d{1,16}$/.test(value)) return false\n const parsed = Number(value)\n return Number.isSafeInteger(parsed) && parsed > 0 && parsed <= maximum\n}\n\nfunction jsonResult(result: ContactActionResult, status: number) {\n return Response.json(result, {\n status,\n headers: {\n 'cache-control': 'no-store, max-age=0',\n pragma: 'no-cache',\n 'x-content-type-options': 'nosniff',\n },\n })\n}\n\nfunction statusForResult(result: ContactActionResult) {\n if (result.ok) return 200\n if (result.code === 'delivery_unavailable') return 503\n return 400\n}\n\nconst RATE_LIMITED_EVENT = 'brandlab_contact_rate_limited'\n\n/**\n * One JSON line on the server's error output for each refused enquiry, for the daily delivery monitor:\n * `{\"event\":\"brandlab_contact_rate_limited\",\"rule\":\"ip\",\"retryAfterSeconds\":540}`. Never an address, IP or form value.\n */\nfunction logRateLimited(rule: 'ip' | 'address', retryAfterSeconds: number) {\n console.error(JSON.stringify({ event: RATE_LIMITED_EVENT, rule, retryAfterSeconds }))\n}\n\n/** A client IP as Vercel sets it: `x-real-ip`, else the first `x-forwarded-for` entry. */\nfunction clientIp(request: Request) {\n const candidate =\n request.headers.get('x-real-ip')?.trim() ||\n request.headers.get('x-forwarded-for')?.split(',', 1)[0]?.trim()\n return candidate && candidate.length <= 64 && /^[0-9A-Fa-f:.]+$/.test(candidate) ? candidate : undefined\n}\n\nasync function rateLimitKey(kind: 'ip' | 'address', value: string | undefined) {\n if (!value) return undefined\n const digest = await globalThis.crypto.subtle.digest(\n 'SHA-256',\n new TextEncoder().encode(`brandlab-contact-${kind}:${value}`),\n )\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('')\n}\n\nasync function handleSubmission(\n options: ContactRouteHandlerOptions,\n request: ContactRequestContext,\n formData: FormData,\n outcome: SubmissionOutcome,\n ip?: string,\n): Promise<ContactActionResult> {\n const now = options.now?.() ?? new Date()\n if (!Number.isFinite(now.getTime()) || !validateFormShape(options.definition, formData)) {\n return validationResult()\n }\n const metadata = parseSubmissionMetadata(options.definition, formData, now)\n if (!metadata) return validationResult()\n\n let confirmationId: string\n try {\n confirmationId = await createConfirmationId(\n options.definition.projectId,\n metadata.clientSubmissionId,\n )\n } catch {\n return deliveryUnavailable(true)\n }\n if (!CONTACT_CONFIRMATION_ID_PATTERN.test(confirmationId)) {\n return deliveryUnavailable(false)\n }\n\n if (defaultBotAssessment(options.definition, formData).status !== 'allow') {\n return fakeSuccess()\n }\n if (options.botGuard) {\n try {\n const result = await options.botGuard.assess({\n formData,\n request,\n projectId: options.definition.projectId,\n confirmationId,\n now: now.getTime(),\n })\n if (result.status !== 'allow') return fakeSuccess()\n } catch {\n return deliveryUnavailable(true)\n }\n }\n\n const validated = validateFields(options.definition, formData)\n if (Object.keys(validated.fieldErrors).length > 0) {\n return validationResult(validated.fieldErrors)\n }\n\n if (options.spamFilter !== false) {\n const filter = options.spamFilter ?? {}\n const startedAt = stringEntry(formData, CONTACT_FORM_FIELDS.formStartedAt).trim()\n if (submittedTooFast(startedAt, metadata.submittedAt, filter.minFillMs ?? BRANDLAB_CONTACT_MIN_FILL_MS)) {\n logSpamBlocked(options.definition.projectId, ['fill-time'])\n return fakeSuccess()\n }\n try {\n const assessment = await assessBrandlabContactSpam(\n validated.values,\n contactSpamFieldsOf(options.definition.fields),\n filter,\n )\n if (assessment.blocked) {\n logSpamBlocked(options.definition.projectId, assessment.signals)\n return fakeSuccess()\n }\n } catch {\n // A filter fault never costs a lead: the enquiry goes through as it would have without the filter.\n }\n }\n\n const mode = options.definition.deploymentMode ?? 'production'\n if (options.rateLimiter && (mode === 'production' || mode === 'preview')) {\n const emailField = options.definition.fields.find((field) => getFieldRole(field) === 'email')\n let decision: ReturnType<BrandlabContactRateLimiter['check']>\n try {\n const [ipKey, addressKey] = await Promise.all([\n rateLimitKey('ip', ip),\n rateLimitKey('address', emailField ? validated.values[emailField.name] : undefined),\n ])\n decision = options.rateLimiter.check({\n ...(ipKey ? { ipKey } : {}),\n ...(addressKey ? { addressKey } : {}),\n submissionId: metadata.clientSubmissionId,\n now: now.getTime(),\n })\n } catch {\n // A limiter fault never costs an enquiry.\n decision = { ok: true }\n }\n if (!decision.ok) {\n logRateLimited(decision.limit, decision.retryAfterSeconds)\n outcome.retryAfterSeconds = decision.retryAfterSeconds\n return deliveryUnavailable(true)\n }\n }\n\n let attachments: readonly ContactDeliveryAttachment[] | undefined\n try {\n attachments = await readValidatedAttachments(options.definition, formData)\n if (attachments && options.attachmentProcessor) {\n const processed = await options.attachmentProcessor.process({ attachments })\n attachments = processed.ok ? processed.attachments : undefined\n }\n } catch {\n attachments = undefined\n }\n if (!attachments || !validateProcessedAttachments(options.definition, attachments)) {\n return {\n ok: false,\n code: 'attachment_rejected',\n retryable: false,\n }\n }\n\n if (mode === 'development' || mode === 'test') {\n return fakeSuccess()\n }\n // A Brandlab test enquiry: delivered like any other, flagged in the subject and never reported as a lead. On a\n // Preview (4.2.0) it goes only to Brandlab's own inbox, never to the client's.\n const testEnquiry =\n stringEntry(formData, CONTACT_FORM_FIELDS.testMarker).trim() === BRANDLAB_CONTACT_TEST_MARKER\n const previewTest = testEnquiry && mode === 'preview'\n const transport = previewTest ? options.testTransport : options.transport\n if (!transport) {\n // Production or Preview without its email key or recipients: every enquiry fails until it is set.\n logDeliveryFailure({ provider: options.provider, code: 'not_configured' })\n return deliveryUnavailable(false)\n }\n const provider = transport.provider ?? options.provider\n\n if (!previewTest && options.recipientCheck && options.recipientCheck.recipients.length > 0) {\n const { recipients, check } = options.recipientCheck\n const statuses = await Promise.all(\n recipients.map((address) =>\n Promise.resolve()\n .then(() => check(address))\n .catch((): BrandlabContactSuppressionStatus => 'unknown'),\n ),\n )\n const suppressed = statuses.filter((status) => status === 'suppressed').length\n if (suppressed > 0) {\n await reportContactDeliveryFailure(\n {\n event: BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n provider: 'resend',\n code: 'recipient_suppressed',\n source: 'pre-send',\n recipients: suppressed === recipients.length ? 'all' : 'some',\n submission: confirmationId.slice(0, 16),\n at: now.toISOString(),\n },\n options.onDeliveryFailure,\n )\n // Record and alert only: the client keeps their own inbox deliverable. A site may opt in to refusing instead.\n if (suppressed === recipients.length && options.refuseWhenAllSuppressed === true) return deliveryUnavailable(false)\n }\n }\n\n const rendered = renderContactEmail({\n definition: options.definition,\n values: validated.values,\n context: metadata.context,\n submittedAt: metadata.submittedAt,\n confirmationId,\n attachments,\n })\n try {\n const transportResult = await transport.send({\n idempotencyKey: createIdempotencyKey(\n options.definition.projectId,\n metadata.clientSubmissionId,\n ),\n confirmationId,\n subject: testEnquiry ? sanitizeContactEmailSubject(`[Test] ${rendered.subject}`) : rendered.subject,\n html: rendered.html,\n text: rendered.text,\n ...(rendered.replyTo ? { replyTo: rendered.replyTo } : {}),\n attachments,\n providerMetadata: {\n project_id: options.definition.projectId,\n submission_hash: confirmationId,\n },\n })\n if (!transportResult.ok) {\n const detail = transportResult as { providerCode?: unknown; status?: unknown }\n logDeliveryFailure({\n provider,\n ...(typeof detail.status === 'number' ? { status: detail.status } : {}),\n code: (typeof detail.providerCode === 'string' ? detail.providerCode : undefined) ?? transportResult.code ?? 'provider_rejected',\n })\n return deliveryUnavailable(transportResult.retryable ?? true)\n }\n if (!SAFE_PROVIDER_MESSAGE_ID_PATTERN.test(transportResult.providerMessageId)) {\n logDeliveryFailure({ provider, code: 'provider_invalid_id' })\n return deliveryUnavailable(true)\n }\n return testEnquiry ? fakeSuccess() : acceptedResult(confirmationId)\n } catch {\n logDeliveryFailure({ provider, code: 'transport_exception' })\n return deliveryUnavailable(true)\n }\n}\n\nexport function createContactRouteHandler(options: ContactRouteHandlerOptions) {\n assertDefinition(options.definition)\n if (\n options.definition.attachments &&\n options.attachmentProcessor?.capability !== 'sanitizes-contact-images-v1'\n ) {\n throw new Error('Upload-enabled contact routes require the shared image sanitizer.')\n }\n if (options.botGuard && typeof options.botGuard.assess !== 'function') {\n throw new Error('The optional contact bot guard is invalid.')\n }\n if (options.rateLimiter !== undefined && !isBrandlabContactRateLimiter(options.rateLimiter)) {\n throw new Error('The contact rate limiter is invalid.')\n }\n const limits = getContactRequestLimits(options.definition)\n const previewMode = (options.definition.deploymentMode ?? 'production') === 'preview'\n const handle = createContactRequestHandler(options, limits)\n if (!previewMode) return handle\n // A Preview's contact route says so on every answer (4.2.0), and that its marked test enquiries reach only\n // Brandlab's inbox, so brandlab-preview-enquiry can confirm both before it sends one. Production never says it.\n return async (request: Request): Promise<Response> => {\n const response = await handle(request)\n const headers = new Headers(response.headers)\n headers.set(BRANDLAB_PREVIEW_CONTACT_HEADER, 'preview; test-inbox=brandlab')\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n }\n}\n\n/** The header a Preview's contact route answers with (4.2.0): `preview; test-inbox=brandlab`. */\nexport const BRANDLAB_PREVIEW_CONTACT_HEADER = 'x-brandlab-contact-mode'\n\nfunction createContactRequestHandler(options: ContactRouteHandlerOptions, limits: ReturnType<typeof getContactRequestLimits>) {\n return async (request: Request): Promise<Response> => {\n if (!(request instanceof Request) || request.method.toUpperCase() !== 'POST') {\n return jsonResult(validationResult(), 405)\n }\n const origin = sameOriginRequest(request, options.definition)\n if (\n !origin ||\n request.headers.has('transfer-encoding') ||\n !contentTypeIsAllowed(\n request.headers.get('content-type'),\n Boolean(options.definition.attachments),\n ) ||\n !contentLengthIsAllowed(\n request.headers.get('content-length'),\n limits.maxRequestBytes,\n )\n ) {\n return jsonResult(validationResult(), 400)\n }\n\n let formData: FormData\n try {\n formData = await request.formData()\n } catch {\n return jsonResult(validationResult(), 400)\n }\n const outcome: SubmissionOutcome = {}\n const result = await handleSubmission(options, { origin }, formData, outcome, clientIp(request))\n if (outcome.retryAfterSeconds !== undefined) {\n const response = jsonResult(result, 429)\n response.headers.set('retry-after', String(outcome.retryAfterSeconds))\n return response\n }\n return jsonResult(result, statusForResult(result))\n }\n}\n\nfunction boundedSecret(value: string | undefined): value is string {\n return (\n typeof value === 'string' &&\n value.length > 0 &&\n value.length <= 8_192 &&\n !/[\\u0000-\\u001f\\u007f]/.test(value)\n )\n}\n\ninterface RuntimeDelivery {\n transport?: LoggedContactTransport\n testTransport?: LoggedContactTransport\n recipientCheck?: RecipientCheck\n}\n\nfunction createRuntimeTransport(\n options: BrandlabContactRuntimeOptions,\n contract: BrandlabContactContract,\n mode: BrandlabContactDeploymentMode,\n): RuntimeDelivery | undefined {\n if (mode === 'development' || mode === 'test') return undefined\n const environment = options.environment ?? {}\n const apiKey = environment[BRANDLAB_CONTACT_API_KEY_ENV]\n try {\n if (!boundedSecret(apiKey)) return undefined\n // Preview (4.2.0): marked test enquiries go to Brandlab's own inbox only, whatever the recipient setting says.\n const testTransport = mode === 'preview'\n ? createContractResendContactTransport({\n contract,\n environment: { ...environment, [contract.delivery.recipientEnv]: BRANDLAB_PREVIEW_TEST_RECIPIENT },\n send: options.createResendSend(apiKey),\n })\n : undefined\n const recipients = parseContactEmailRecipients(\n environment[contract.delivery.recipientEnv],\n )\n if (recipients.length === 0) return testTransport ? { testTransport } : undefined\n const transport = createContractResendContactTransport({\n contract,\n environment,\n send: options.createResendSend(apiKey),\n })\n const suppressionCheck = options.suppressionCheck\n const lookupKey = environment[BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV]\n const lookupApiKey = boundedSecret(lookupKey) ? lookupKey : apiKey\n const recipientCheck: RecipientCheck | undefined = suppressionCheck\n ? { recipients, check: (address) => suppressionCheck.check(address, { apiKey: lookupApiKey }) }\n : undefined\n return { transport, ...(recipientCheck ? { recipientCheck } : {}), ...(testTransport ? { testTransport } : {}) }\n } catch {\n return undefined\n }\n}\n\n/** The only inbox a marked test enquiry from a Preview deployment reaches (4.2.0). */\nexport const BRANDLAB_PREVIEW_TEST_RECIPIENT = 'info@brandlabdigital.com.au'\n\nexport function createBrandlabContactRuntime(\n options: BrandlabContactRuntimeOptions,\n): BrandlabContactRuntime {\n if (!options || typeof options !== 'object') {\n throw new TypeError('Contact runtime options are required.')\n }\n if (!options.runtime || typeof options.runtime !== 'object') {\n throw new TypeError('Contact runtime definition is required.')\n }\n if (typeof options.createResendSend !== 'function') {\n throw new TypeError('A lazy Resend send factory is required.')\n }\n const rateLimiter =\n options.rateLimit === false\n ? undefined\n : isBrandlabContactRateLimiter(options.rateLimit)\n ? options.rateLimit\n : createBrandlabContactRateLimiter(options.rateLimit)\n const mode = options.deploymentMode ?? 'production'\n if (!['production', 'preview', 'development', 'test'].includes(mode)) {\n throw new Error('deploymentMode is invalid.')\n }\n const contract = defineContactContract(options.contract)\n const definition = createContactDefinitionFromContract(contract, {\n ...options.runtime,\n deploymentMode: mode,\n })\n assertDefinition(definition)\n if (options.suppressionCheck !== undefined && typeof options.suppressionCheck?.check !== 'function') {\n throw new TypeError('The contact suppression check is invalid.')\n }\n if (options.onDeliveryFailure !== undefined && typeof options.onDeliveryFailure !== 'function') {\n throw new TypeError('onDeliveryFailure must be a function.')\n }\n const delivery = createRuntimeTransport(options, contract, mode)\n const contactRouteHandler = createContactRouteHandler({\n definition,\n ...(delivery?.transport ? { transport: delivery.transport } : {}),\n ...(delivery?.testTransport ? { testTransport: delivery.testTransport } : {}),\n ...(delivery?.recipientCheck ? { recipientCheck: delivery.recipientCheck } : {}),\n ...(options.onDeliveryFailure ? { onDeliveryFailure: options.onDeliveryFailure } : {}),\n ...(options.refuseWhenAllSuppressed === true ? { refuseWhenAllSuppressed: true } : {}),\n provider: 'resend',\n ...(definition.attachments\n ? { attachmentProcessor: createBrandlabContactImageSanitizer() }\n : {}),\n ...(options.botGuard ? { botGuard: options.botGuard } : {}),\n ...(options.spamFilter !== undefined ? { spamFilter: options.spamFilter } : {}),\n ...(options.now ? { now: options.now } : {}),\n ...(rateLimiter ? { rateLimiter } : {}),\n })\n\n return Object.freeze({\n runtimeKind: BRANDLAB_CONTACT_RUNTIME,\n definition,\n contactRouteHandler,\n })\n}\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/contact/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EACL,iCAAiC,EACjC,sCAAsC,EACtC,oCAAoC,EACpC,+BAA+B,EAC/B,qBAAqB,EACrB,2BAA2B,GAK5B,MAAM,qCAAqC,CAAA;AAC5C,OAAO,E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AE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtF,QAAQ,EAAE,QAAQ;QAClB,GAAG,CAAC,UAAU,CAAC,WAAW;YACxB,CAAC,CAAC,EAAE,mBAAmB,EAAE,mCAAmC,EAAE,EAAE;YAChE,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,WAAW,EAAE,wBAAwB;QACrC,UAAU;QACV,mBAAmB;KACpB,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import 'server-only'\n\nimport {\n DEFAULT_CONTACT_ATTACHMENT_POLICY,\n deriveContactAttachmentTransportPolicy,\n detectContactTransportAttachmentType,\n createContactAttachmentFilename,\n defineContactContract,\n parseContactEmailRecipients,\n type BrandlabContactContract,\n type ContactActionResult,\n type ContactAttachmentMimeType,\n type ContactAttachmentPolicy,\n} from '@brandlab-digital/site-core/contact'\nimport { isBrandlabCanonicalEntityId } from '@brandlab-digital/site-core/entity-id'\nimport { normalizeBrandlabRoutePath } from '@brandlab-digital/site-core/routes'\nimport { resolveBrandlabDeployment } from '@brandlab-digital/site-core/site'\nimport { normalizeContactAttributionSummary } from './attribution.js'\nimport {\n createContactDefinitionFromContract,\n type ContactRuntimeDefinitionOptions,\n} from './contract.js'\nimport {\n BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV,\n reportContactDeliveryFailure,\n type BrandlabContactDeliveryAlert,\n type BrandlabContactSuppressionCheck,\n type BrandlabContactSuppressionStatus,\n} from './delivery.js'\nimport { renderContactEmail, sanitizeContactEmailSubject } from './email.js'\nimport {\n BRANDLAB_CONTACT_MIN_FILL_MS,\n assessBrandlabContactSpam,\n contactSpamFieldsOf,\n submittedTooFast,\n type BrandlabContactSpamFilterOptions,\n} from './spam-filter.js'\nimport { createBrandlabContactImageSanitizer } from './image-sanitizer.js'\nimport {\n createBrandlabContactRateLimiter,\n isBrandlabContactRateLimiter,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimiter,\n} from './rate-limit.js'\nimport {\n RESEND_ERROR_CODES,\n createContractResendContactTransport,\n type ResendContactSend,\n} from './resend.js'\nimport {\n BRANDLAB_CONTACT_TEST_MARKER,\n CONTACT_CLIENT_SUBMISSION_ID_PATTERN,\n CONTACT_CONFIRMATION_ID_PATTERN,\n CONTACT_FORM_FIELDS,\n type BrandlabContactDefinition,\n type BrandlabContactDeploymentMode,\n type ContactAttachmentProcessor,\n type ContactBotAssessment,\n type ContactBotGuard,\n type ContactDeliveryAttachment,\n type ContactPageContext,\n type ContactRequestContext,\n type ContactTransport,\n} from './shared.js'\n\nexport { createBrandlabContactImageSanitizer } from './image-sanitizer.js'\nexport {\n BRANDLAB_CONTACT_RATE_LIMITS,\n createBrandlabContactRateLimiter,\n type BrandlabContactRateLimitDecision,\n type BrandlabContactRateLimitInput,\n type BrandlabContactRateLimitOptions,\n type BrandlabContactRateLimitRule,\n type BrandlabContactRateLimiter,\n} from './rate-limit.js'\nexport { createResendSdkContactSend } from './resend.js'\nexport type { ResendContactSend, ResendSdkContactClient } from './resend.js'\n\nexport const BRANDLAB_CONTACT_RUNTIME = 'brandlab-contact-v4' as const\nexport const BRANDLAB_CONTACT_API_KEY_ENV = 'RESEND_API_KEY' as const\nexport const BRANDLAB_CONTACT_MAX_REQUEST_BYTES = 4_500_000\n\n/**\n * Contact delivery follows the shared deployment gate on the server's own\n * VERCEL_ENV: production and Preview deliver, everything else (including a\n * local `next start`) accepts without sending. NODE_ENV=test adds test mode.\n */\nexport function detectBrandlabContactDeploymentMode(\n environment: Readonly<Record<string, string | undefined>>,\n): BrandlabContactDeploymentMode {\n const deployment = resolveBrandlabDeployment({\n VERCEL_ENV: environment.VERCEL_ENV,\n NODE_ENV: environment.NODE_ENV,\n })\n if (deployment.environment !== 'development') return deployment.environment\n return environment.NODE_ENV === 'test' ? 'test' : 'development'\n}\n\nconst FORM_URLENCODED = 'application/x-www-form-urlencoded'\nconst MULTIPART_FORM = 'multipart/form-data'\nconst MULTIPART_BOUNDARY_PATTERN =\n /(?:^|;)\\s*boundary=(?:\"[0-9A-Za-z'()+_,.\\/:=?-]{1,70}\"|[0-9A-Za-z'()+_,.\\/:=?-]{1,70})(?:;|$)/i\nconst FIELD_NAME_PATTERN = /^[a-z][A-Za-z0-9_-]{0,63}$/\nconst SAFE_PROVIDER_MESSAGE_ID_PATTERN = /^[A-Za-z0-9._-]{1,256}$/\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/\nconst EMAIL_COLOR_PATTERN = /^#[0-9a-fA-F]{6}$/\nconst ISO_TIMESTAMP_PATTERN =\n /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/\n// submittedAt comes from the visitor's clock. It may run ahead of the server by any amount (4.2.4: a\n// fast desktop clock used to make the form unsendable), so only a submission more than a day behind the\n// server is refused, as a stale replay.\nconst MAX_SUBMISSION_AGE_MS = 24 * 60 * 60 * 1_000\nconst DEFAULT_MAX_ENTRIES = 64\nconst DEFAULT_MAX_STRING_BYTES = 64 * 1_024\nconst SUPPORTED_ATTACHMENT_MIME_TYPES = new Set([\n 'application/pdf',\n 'image/jpeg',\n 'image/jpg',\n 'image/png',\n 'image/gif',\n 'image/webp',\n 'image/heic',\n 'image/heif',\n])\n\nexport type BrandlabContactRuntimeDefinitionOptions = Omit<\n ContactRuntimeDefinitionOptions,\n 'deploymentMode'\n>\n\nexport interface BrandlabContactRuntimeOptions {\n contract: BrandlabContactContract\n runtime: BrandlabContactRuntimeDefinitionOptions\n environment?: Readonly<Record<string, string | undefined>>\n deploymentMode?: BrandlabContactDeploymentMode\n createResendSend: (apiKey: string) => ResendContactSend\n botGuard?: ContactBotGuard\n /**\n * The shared spam filter (4.1.0), on by default: content signals and the minimum fill time (two or more signals, at\n * least one strong, block silently; fill time is a weak signal and never blocks alone). Pass options to add phrases or relax a rule, or `false` to turn it off.\n */\n spamFilter?: BrandlabContactSpamFilterOptions | false\n now?: () => Date\n /**\n * Abuse limits per client IP and per email address on deployments that deliver (production and Preview): the\n * defaults (BRANDLAB_CONTACT_RATE_LIMITS) when omitted, adjusted limits, a limiter shared across runtimes, or\n * `false` to turn them off. Create a runtime once per route module so its limits persist between requests.\n */\n rateLimit?: BrandlabContactRateLimitOptions | BrandlabContactRateLimiter | false\n /**\n * Checks each business inbox against Resend's suppression list before sending (3.14.0), with the runtime's\n * `RESEND_API_KEY`. Pass one check shared across runtimes so its cache outlives each request\n * (`createBrandlabContactRouteHandler` does). The check only records and alerts: when any inbox is suppressed a\n * `recipient_suppressed` failure is logged and alerted, and the enquiry is still sent to the client's own inboxes with\n * the normal sent result. It never blocks a send unless the site opts in with `refuseWhenAllSuppressed: true`.\n * The lookup uses `RESEND_LOOKUP_API_KEY` (full access) when set, otherwise `RESEND_API_KEY`.\n */\n suppressionCheck?: BrandlabContactSuppressionCheck\n /**\n * Opt-in only (default `false`): when every business inbox is suppressed, refuse the enquiry with the non-retryable\n * `delivery_unavailable` answer (the form's call-us fallback) and track no conversion. By default the enquiry is sent\n * to the client's own inboxes as normal, still logging and alerting `recipient_suppressed`.\n */\n refuseWhenAllSuppressed?: boolean\n /** The same-day alert for a delivery failure the route finds before sending (3.14.0). */\n onDeliveryFailure?: BrandlabContactDeliveryAlert\n}\n\nexport interface BrandlabContactRuntime {\n runtimeKind: typeof BRANDLAB_CONTACT_RUNTIME\n definition: ReturnType<typeof createContactDefinitionFromContract>\n contactRouteHandler: (request: Request) => Promise<Response>\n}\n\n/**\n * A transport as the route reads it for the delivery-failure log (internal: the\n * public ContactTransport type is unchanged). The shared Resend transport names\n * itself and adds a failed send's documented provider code and HTTP status.\n */\ntype LoggedContactTransport = ContactTransport & { provider?: string }\n\n/** The pre-send suppression check as the route reads it: the business inboxes and a lookup bound to the API key. */\ninterface RecipientCheck {\n recipients: readonly string[]\n check(address: string): Promise<BrandlabContactSuppressionStatus>\n}\n\ninterface ContactRouteHandlerOptions {\n definition: BrandlabContactDefinition\n transport?: LoggedContactTransport\n /**\n * Preview only (4.2.0): the transport a marked test enquiry (`bl_test=1`) uses, bound to Brandlab's own inbox\n * (BRANDLAB_PREVIEW_TEST_RECIPIENT) whatever the deployment's recipient setting is. Production never has one.\n */\n testTransport?: LoggedContactTransport\n /** The provider the route delivers through, named in the delivery-failure log when it has no transport. */\n provider?: string\n attachmentProcessor?: ContactAttachmentProcessor\n botGuard?: ContactBotGuard\n /** The shared spam filter; on by default (undefined), `false` turns it off. */\n spamFilter?: BrandlabContactSpamFilterOptions | false\n now?: () => Date\n rateLimiter?: BrandlabContactRateLimiter\n recipientCheck?: RecipientCheck\n onDeliveryFailure?: BrandlabContactDeliveryAlert\n refuseWhenAllSuppressed?: boolean\n}\n\n/** What the route adds to the response beyond the result: the wait after a refused, rate-limited enquiry. */\ninterface SubmissionOutcome {\n retryAfterSeconds?: number\n}\n\nconst DELIVERY_FAILED_EVENT = BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT\n\n/** The only values the delivery-failure log writes: anything else is written as `unknown`. */\nconst DELIVERY_LOG_PROVIDERS: ReadonlySet<string> = new Set(['resend'])\nconst DELIVERY_LOG_CODES: ReadonlySet<string> = new Set([\n // The shared Resend transport's own codes.\n 'provider_rejected',\n 'provider_missing_id',\n 'provider_exception',\n 'message_refused',\n // The route's.\n 'provider_invalid_id',\n 'transport_exception',\n 'not_configured',\n // Resend's documented error names.\n ...RESEND_ERROR_CODES,\n])\n\n/**\n * One JSON line on the server's error output for each enquiry the email provider\n * did not accept, for the daily delivery monitor (Vercel logs):\n * `{\"event\":\"brandlab_contact_delivery_failed\",\"provider\":\"resend\",\"status\":429,\"code\":\"rate_limit_exceeded\"}`.\n * Only the provider, its HTTP status and a bounded code are written; a form value,\n * address, name or message never is.\n */\nfunction logDeliveryFailure(failure: { provider?: string; status?: number; code: string }) {\n const known = (allowed: ReadonlySet<string>, value: string | undefined) =>\n value !== undefined && allowed.has(value) ? value : 'unknown'\n const status =\n typeof failure.status === 'number' && Number.isInteger(failure.status) && failure.status >= 100 && failure.status <= 599\n ? failure.status\n : null\n console.error(\n JSON.stringify({\n event: DELIVERY_FAILED_EVENT,\n provider: known(DELIVERY_LOG_PROVIDERS, failure.provider),\n status,\n code: known(DELIVERY_LOG_CODES, failure.code),\n }),\n )\n}\n\nfunction getFieldRole(field: BrandlabContactDefinition['fields'][number]) {\n if (field.role) return field.role\n if (field.name === 'suburb' || field.name === 'location') return 'location' as const\n if (['name', 'email', 'phone', 'message'].includes(field.name)) {\n return field.name as 'name' | 'email' | 'phone' | 'message'\n }\n return 'custom' as const\n}\n\nfunction normalizedHttpsOrigin(value: string) {\n try {\n const url = new URL(value)\n if (\n url.protocol !== 'https:' ||\n url.username ||\n url.password ||\n url.search ||\n url.hash ||\n (url.pathname !== '/' && url.pathname !== '') ||\n value.trim().replace(/\\/$/, '') !== url.origin\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction assertDefinition(definition: BrandlabContactDefinition) {\n if (!isBrandlabCanonicalEntityId(definition.projectId)) {\n throw new Error('projectId must be a canonical Brandlab entity ID.')\n }\n if (\n !definition.brandName.trim() ||\n definition.brandName.trim() !== definition.brandName ||\n definition.brandName.length > 160 ||\n /[\\u0000-\\u001f\\u007f]/.test(definition.brandName)\n ) {\n throw new Error('brandName must contain bounded reviewed text.')\n }\n if (!normalizedHttpsOrigin(definition.siteUrl)) {\n throw new Error('siteUrl must be a canonical HTTPS origin.')\n }\n const mode = definition.deploymentMode ?? 'production'\n if (!['production', 'preview', 'development', 'test'].includes(mode)) {\n throw new Error('deploymentMode is invalid.')\n }\n if (!Array.isArray(definition.fields) || definition.fields.length < 4) {\n throw new Error('Contact fields are unavailable.')\n }\n const honeypotField = definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot\n const reservedFields = new Set<string>(\n Object.values(CONTACT_FORM_FIELDS).filter(\n (fieldName) => fieldName !== CONTACT_FORM_FIELDS.honeypot,\n ),\n )\n if (!FIELD_NAME_PATTERN.test(honeypotField) || reservedFields.has(honeypotField)) {\n throw new Error('The contact honeypot field is invalid.')\n }\n const fieldNames = new Set<string>()\n for (const field of definition.fields) {\n if (\n !FIELD_NAME_PATTERN.test(field.name) ||\n fieldNames.has(field.name) ||\n reservedFields.has(field.name) ||\n field.name === honeypotField ||\n !field.label.trim() ||\n field.label.length > 120\n ) {\n throw new Error(`Contact field \"${field.name}\" is invalid.`)\n }\n fieldNames.add(field.name)\n }\n for (const role of ['name', 'email', 'phone', 'message'] as const) {\n if (definition.fields.filter((field) => getFieldRole(field) === role).length !== 1) {\n throw new Error(`Contact definition requires exactly one \"${role}\" field.`)\n }\n }\n if (definition.fields.filter((field) => getFieldRole(field) === 'location').length > 1) {\n throw new Error('Contact definition allows at most one \"location\" field.')\n }\n if (definition.attachments) {\n const policy = attachmentPolicy(definition)\n if (\n !Number.isSafeInteger(policy.maxFiles) ||\n policy.maxFiles < 1 ||\n policy.maxFiles > 20 ||\n !Number.isSafeInteger(policy.maxFileSizeBytes) ||\n policy.maxFileSizeBytes < 1 ||\n !Number.isSafeInteger(policy.maxTotalSizeBytes) ||\n policy.maxTotalSizeBytes < policy.maxFileSizeBytes ||\n policy.maxTotalSizeBytes > BRANDLAB_CONTACT_MAX_REQUEST_BYTES ||\n policy.allowedTypes.length < 1 ||\n policy.allowedTypes.some((type) => !SUPPORTED_ATTACHMENT_MIME_TYPES.has(type))\n ) {\n throw new Error('The contact attachment policy is invalid.')\n }\n }\n if (\n definition.email?.style &&\n Object.values(definition.email.style).some(\n (value) => !EMAIL_COLOR_PATTERN.test(value),\n )\n ) {\n throw new Error('Contact email colours must use six-digit hexadecimal values.')\n }\n if (definition.email?.logo) {\n const { url, alt, width } = definition.email.logo\n let parsed: URL | undefined\n try {\n parsed = new URL(url)\n } catch {\n parsed = undefined\n }\n if (\n !parsed ||\n parsed.protocol !== 'https:' ||\n parsed.username ||\n parsed.password ||\n parsed.search ||\n parsed.hash ||\n !alt.trim() ||\n alt.length > 160 ||\n (width !== undefined && (!Number.isInteger(width) || width < 32 || width > 240))\n ) {\n throw new Error('The contact email logo must be a reviewed HTTPS asset.')\n }\n }\n}\n\nfunction attachmentPolicy(definition: BrandlabContactDefinition): ContactAttachmentPolicy {\n return deriveContactAttachmentTransportPolicy({\n ...DEFAULT_CONTACT_ATTACHMENT_POLICY,\n ...(definition.attachments || {}),\n })\n}\n\nexport function getContactRequestLimits(definition: BrandlabContactDefinition) {\n return {\n maxRequestBytes:\n definition.limits?.maxRequestBytes ?? BRANDLAB_CONTACT_MAX_REQUEST_BYTES,\n maxEntries: definition.limits?.maxEntries ?? DEFAULT_MAX_ENTRIES,\n maxStringBytes:\n definition.limits?.maxStringBytes ?? DEFAULT_MAX_STRING_BYTES,\n }\n}\n\nfunction isAttachmentField(definition: BrandlabContactDefinition, name: string) {\n if (!definition.attachments) return false\n const prefix = definition.attachments.fieldPrefix ?? 'attachments'\n return name === prefix || new RegExp(`^${prefix}\\\\[\\\\d{1,2}\\\\]$`).test(name)\n}\n\nfunction validateFormShape(\n definition: BrandlabContactDefinition,\n formData: FormData,\n) {\n const limits = getContactRequestLimits(definition)\n const allowedStrings = new Set([\n ...definition.fields.map((field) => field.name),\n ...Object.values(CONTACT_FORM_FIELDS).filter(\n (fieldName) => fieldName !== CONTACT_FORM_FIELDS.honeypot,\n ),\n definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot,\n ])\n const counts = new Map<string, number>()\n let estimatedBytes = 0\n const entries = Array.from(formData.entries())\n if (entries.length < 1 || entries.length > limits.maxEntries) return false\n for (const [name, value] of entries) {\n if (!FIELD_NAME_PATTERN.test(name.replace(/\\[\\d{1,2}\\]$/, ''))) return false\n counts.set(name, (counts.get(name) ?? 0) + 1)\n if (typeof value === 'string') {\n if (!allowedStrings.has(name) || (counts.get(name) ?? 0) > 1) return false\n const bytes = new TextEncoder().encode(value).byteLength\n if (bytes > limits.maxStringBytes) return false\n estimatedBytes += bytes\n } else {\n if (!isAttachmentField(definition, name) || value.size < 0) return false\n estimatedBytes += value.size\n }\n if (estimatedBytes > limits.maxRequestBytes) return false\n }\n return true\n}\n\nfunction stringEntry(formData: FormData, name: string) {\n const value = formData.get(name)\n return typeof value === 'string' ? value : ''\n}\n\nfunction validateFields(definition: BrandlabContactDefinition, formData: FormData) {\n const values: Record<string, string> = {}\n const fieldErrors: Record<string, string[]> = {}\n for (const field of definition.fields) {\n let value = stringEntry(formData, field.name).trim()\n try {\n value = field.normalize ? field.normalize(value) : value\n } catch {\n fieldErrors[field.name] = [`${field.label} is invalid.`]\n continue\n }\n values[field.name] = value\n const role = getFieldRole(field)\n const required = field.required || role !== 'custom'\n if (required && !value) {\n fieldErrors[field.name] = [`${field.label} is required.`]\n continue\n }\n if (!value) continue\n const maximum = field.maxLength ?? (role === 'message' ? 5_000 : role === 'email' ? 254 : 200)\n if (value.length > maximum) {\n fieldErrors[field.name] = [`${field.label} is too long.`]\n continue\n }\n if ((field.kind === 'email' || role === 'email') && !EMAIL_PATTERN.test(value)) {\n fieldErrors[field.name] = ['Enter a valid email address.']\n continue\n }\n if (\n (field.kind === 'phone' || role === 'phone') &&\n !field.validate &&\n value.replace(/\\D/g, '').length < 6\n ) {\n fieldErrors[field.name] = ['Enter a valid phone number.']\n continue\n }\n if (field.options && !field.options.includes(value)) {\n fieldErrors[field.name] = [`Select a valid ${field.label.toLowerCase()}.`]\n continue\n }\n try {\n const issue = field.validate?.(value, values)\n if (issue) fieldErrors[field.name] = [issue]\n } catch {\n fieldErrors[field.name] = [`${field.label} is invalid.`]\n }\n }\n return { values, fieldErrors }\n}\n\nconst EXTENSION_TYPES: Record<string, ContactAttachmentMimeType> = {\n pdf: 'application/pdf',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n png: 'image/png',\n gif: 'image/gif',\n webp: 'image/webp',\n heic: 'image/heic',\n heif: 'image/heif',\n}\n\nfunction normalizeMimeType(value: string) {\n const normalized = value.trim().toLowerCase()\n return normalized === 'image/jpg' ? 'image/jpeg' : normalized\n}\n\nasync function readValidatedAttachments(\n definition: BrandlabContactDefinition,\n formData: FormData,\n) {\n if (!definition.attachments) return []\n const policy = attachmentPolicy(definition)\n const allowed = new Set(policy.allowedTypes.map(normalizeMimeType))\n const files = Array.from(formData.entries())\n .filter(\n ([name, value]) =>\n isAttachmentField(definition, name) &&\n typeof value !== 'string' &&\n value.size > 0,\n )\n .map(([, value]) => value as File)\n if (definition.attachments.required && files.length === 0) return undefined\n if (files.length > policy.maxFiles) return undefined\n\n const attachments: ContactDeliveryAttachment[] = []\n let totalBytes = 0\n for (const [index, file] of files.entries()) {\n const extension = file.name.toLowerCase().split('.').pop() ?? ''\n const extensionType = EXTENSION_TYPES[extension]\n const declaredType = normalizeMimeType(file.type)\n if (\n !extensionType ||\n !declaredType ||\n !allowed.has(extensionType) ||\n !allowed.has(declaredType) ||\n normalizeMimeType(extensionType) !== declaredType ||\n file.size > policy.maxFileSizeBytes\n ) {\n return undefined\n }\n totalBytes += file.size\n if (totalBytes > policy.maxTotalSizeBytes) return undefined\n const content = new Uint8Array(await file.arrayBuffer())\n if (normalizeMimeType(detectContactTransportAttachmentType(content.slice(0, 64)) ?? '') !== declaredType) {\n return undefined\n }\n attachments.push({\n filename: createContactAttachmentFilename({ index, contentType: declaredType }),\n content,\n contentType: declaredType,\n })\n }\n return attachments\n}\n\nfunction validateProcessedAttachments(\n definition: BrandlabContactDefinition,\n attachments: readonly ContactDeliveryAttachment[],\n) {\n if (!definition.attachments) return attachments.length === 0\n const policy = attachmentPolicy(definition)\n let totalBytes = 0\n if (attachments.length > policy.maxFiles) return false\n return attachments.every((attachment, index) => {\n totalBytes += attachment.content.byteLength\n return (\n attachment.filename === createContactAttachmentFilename({ index, contentType: attachment.contentType }) &&\n (attachment.contentType === 'image/jpeg' || (attachment.contentType === 'application/pdf' && policy.allowedTypes.includes('application/pdf'))) &&\n attachment.content.byteLength > 0 &&\n attachment.content.byteLength <= policy.maxFileSizeBytes &&\n totalBytes <= policy.maxTotalSizeBytes &&\n detectContactTransportAttachmentType(attachment.content.slice(0, 64)) === attachment.contentType\n )\n })\n}\n\nfunction validationResult(\n fieldErrors?: Record<string, string[]>,\n): ContactActionResult {\n return {\n ok: false,\n code: 'validation',\n retryable: false,\n ...(fieldErrors && Object.keys(fieldErrors).length > 0 ? { fieldErrors } : {}),\n }\n}\n\nfunction deliveryUnavailable(retryable: boolean): ContactActionResult {\n return { ok: false, code: 'delivery_unavailable', retryable }\n}\n\n/** One redacted line per blocked enquiry, so false positives can be reviewed: the site and the signals, nothing else. */\nfunction logSpamBlocked(projectId: string, signals: readonly string[]) {\n console.warn(JSON.stringify({ event: 'brandlab_contact_spam_blocked', site: projectId, signals }))\n}\n\nfunction fakeSuccess(): ContactActionResult {\n return { ok: true, accepted: false, trackConversion: false }\n}\n\n/**\n * Resend accepted the enquiry: it is queued for delivery, not yet delivered. `trackConversion` (and so `contact_form`)\n * keeps its analytics-v4 meaning, provider acceptance. Whether the business inbox actually received it is tracked\n * separately: the pre-send suppression check and the Resend webhook route (`brandlab_contact_delivery_failed`,\n * `brandlab_contact_delivery_status`).\n */\nfunction acceptedResult(confirmationId: string): ContactActionResult {\n return {\n ok: true,\n accepted: true,\n trackConversion: true,\n confirmationId,\n }\n}\n\nfunction parseSubmissionMetadata(\n definition: BrandlabContactDefinition,\n formData: FormData,\n now: Date,\n): {\n clientSubmissionId: string\n submittedAt: string\n context: ContactPageContext\n} | undefined {\n const clientSubmissionId = stringEntry(\n formData,\n CONTACT_FORM_FIELDS.clientSubmissionId,\n )\n .trim()\n .toLowerCase()\n const submittedAt = stringEntry(formData, CONTACT_FORM_FIELDS.submittedAt).trim()\n if (\n !CONTACT_CLIENT_SUBMISSION_ID_PATTERN.test(clientSubmissionId) ||\n !ISO_TIMESTAMP_PATTERN.test(submittedAt)\n ) {\n return undefined\n }\n const submittedMs = Date.parse(submittedAt)\n const nowMs = now.getTime()\n if (\n !Number.isFinite(submittedMs) ||\n submittedMs < nowMs - MAX_SUBMISSION_AGE_MS\n ) {\n return undefined\n }\n try {\n const pagePath = normalizeBrandlabRoutePath(\n stringEntry(formData, CONTACT_FORM_FIELDS.pagePath),\n )\n const pageLabel = stringEntry(formData, CONTACT_FORM_FIELDS.pageLabel).trim()\n if (\n pageLabel &&\n (pageLabel.length > 160 || /[\\u0000-\\u001f\\u007f]/.test(pageLabel))\n ) {\n return undefined\n }\n const attribution = normalizeContactAttributionSummary({\n initialLandingPath: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.initialLandingPath,\n ),\n visitSource: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.visitSource,\n ) as Parameters<typeof normalizeContactAttributionSummary>[0]['visitSource'],\n ...(stringEntry(formData, CONTACT_FORM_FIELDS.visitSourceDetail).trim()\n ? {\n visitSourceDetail: stringEntry(\n formData,\n CONTACT_FORM_FIELDS.visitSourceDetail,\n ).trim(),\n }\n : {}),\n })\n return {\n clientSubmissionId,\n submittedAt,\n context: {\n pagePath,\n pageUrl: new URL(pagePath, definition.siteUrl).toString(),\n ...(pageLabel ? { pageLabel } : {}),\n ...attribution,\n },\n }\n } catch {\n return undefined\n }\n}\n\nasync function createConfirmationId(projectId: string, clientSubmissionId: string) {\n if (!globalThis.crypto?.subtle) {\n throw new Error('A secure digest implementation is required.')\n }\n const digest = await globalThis.crypto.subtle.digest(\n 'SHA-256',\n new TextEncoder().encode(`${projectId}:${clientSubmissionId}`),\n )\n return Array.from(new Uint8Array(digest), (byte) =>\n byte.toString(16).padStart(2, '0'),\n ).join('')\n}\n\nfunction createIdempotencyKey(projectId: string, clientSubmissionId: string) {\n const projectKey = projectId.replaceAll('&', '-and-')\n return `brandlab/contact/${projectKey}/${clientSubmissionId}`\n}\n\nfunction defaultBotAssessment(\n definition: BrandlabContactDefinition,\n formData: FormData,\n): ContactBotAssessment {\n const honeypotField = definition.bot?.honeypotField ?? CONTACT_FORM_FIELDS.honeypot\n return stringEntry(formData, honeypotField).trim()\n ? { status: 'accept-silently' }\n : { status: 'allow' }\n}\n\nfunction normalizedRequestOrigin(\n value: string | null,\n mode: BrandlabContactDeploymentMode,\n) {\n if (!value || value.length > 2_048) return undefined\n try {\n const url = new URL(value)\n const loopback =\n (mode === 'development' || mode === 'test') &&\n url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1')\n if (\n (url.protocol !== 'https:' && !loopback) ||\n url.username ||\n url.password ||\n url.pathname !== '/' ||\n url.search ||\n url.hash ||\n url.origin !== value\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction forwardedOrigin(request: Request) {\n const host = request.headers.get('x-forwarded-host')?.trim()\n const protocol = request.headers.get('x-forwarded-proto')?.trim()\n if (\n !host ||\n host.includes(',') ||\n host.length > 253 ||\n !/^[a-z0-9.-]+(?::\\d{1,5})?$/i.test(host) ||\n (protocol !== 'https' && protocol !== 'http')\n ) {\n return undefined\n }\n try {\n return new URL(`${protocol}://${host}`).origin\n } catch {\n return undefined\n }\n}\n\nfunction requestOriginCandidates(\n request: Request,\n definition: BrandlabContactDefinition,\n) {\n const mode = definition.deploymentMode ?? 'production'\n if (mode === 'production') {\n return new Set([normalizedHttpsOrigin(definition.siteUrl)])\n }\n const candidates = new Set<string>()\n try {\n candidates.add(new URL(request.url).origin)\n } catch {\n return undefined\n }\n const forwarded = forwardedOrigin(request)\n if (forwarded) candidates.add(forwarded)\n return candidates\n}\n\nfunction normalizedReferrerOrigin(\n value: string | null,\n mode: BrandlabContactDeploymentMode,\n) {\n if (!value || value.length > 2_048) return undefined\n try {\n const url = new URL(value)\n const loopback =\n (mode === 'development' || mode === 'test') &&\n url.protocol === 'http:' &&\n (url.hostname === 'localhost' || url.hostname === '127.0.0.1')\n if (\n (url.protocol !== 'https:' && !loopback) ||\n url.username ||\n url.password\n ) {\n return undefined\n }\n return url.origin\n } catch {\n return undefined\n }\n}\n\nfunction sameOriginRequest(\n request: Request,\n definition: BrandlabContactDefinition,\n) {\n const mode = definition.deploymentMode ?? 'production'\n const candidates = requestOriginCandidates(request, definition)\n if (!candidates) return undefined\n\n const originHeader = request.headers.get('origin')\n if (originHeader !== null) {\n const origin = normalizedRequestOrigin(originHeader, mode)\n return origin && candidates.has(origin) ? origin : undefined\n }\n\n const fetchSite = request.headers.get('sec-fetch-site')\n if (fetchSite !== null && fetchSite !== 'same-origin') return undefined\n const referrerOrigin = normalizedReferrerOrigin(\n request.headers.get('referer'),\n mode,\n )\n return referrerOrigin && candidates.has(referrerOrigin)\n ? referrerOrigin\n : undefined\n}\n\nfunction contentTypeIsAllowed(value: string | null, uploadsEnabled: boolean) {\n if (!value || value.length > 256) return false\n const mediaType = value.split(';', 1)[0]?.trim().toLowerCase()\n if (uploadsEnabled && mediaType !== MULTIPART_FORM) return false\n if (mediaType === FORM_URLENCODED) return true\n return mediaType === MULTIPART_FORM && MULTIPART_BOUNDARY_PATTERN.test(value)\n}\n\nfunction contentLengthIsAllowed(value: string | null, maximum: number) {\n if (value === null) return true\n if (!/^\\d{1,16}$/.test(value)) return false\n const parsed = Number(value)\n return Number.isSafeInteger(parsed) && parsed > 0 && parsed <= maximum\n}\n\nfunction jsonResult(result: ContactActionResult, status: number) {\n return Response.json(result, {\n status,\n headers: {\n 'cache-control': 'no-store, max-age=0',\n pragma: 'no-cache',\n 'x-content-type-options': 'nosniff',\n },\n })\n}\n\nfunction statusForResult(result: ContactActionResult) {\n if (result.ok) return 200\n if (result.code === 'delivery_unavailable') return 503\n return 400\n}\n\nconst RATE_LIMITED_EVENT = 'brandlab_contact_rate_limited'\n\n/**\n * One JSON line on the server's error output for each refused enquiry, for the daily delivery monitor:\n * `{\"event\":\"brandlab_contact_rate_limited\",\"rule\":\"ip\",\"retryAfterSeconds\":540}`. Never an address, IP or form value.\n */\nfunction logRateLimited(rule: 'ip' | 'address', retryAfterSeconds: number) {\n console.error(JSON.stringify({ event: RATE_LIMITED_EVENT, rule, retryAfterSeconds }))\n}\n\n/** A client IP as Vercel sets it: `x-real-ip`, else the first `x-forwarded-for` entry. */\nfunction clientIp(request: Request) {\n const candidate =\n request.headers.get('x-real-ip')?.trim() ||\n request.headers.get('x-forwarded-for')?.split(',', 1)[0]?.trim()\n return candidate && candidate.length <= 64 && /^[0-9A-Fa-f:.]+$/.test(candidate) ? candidate : undefined\n}\n\nasync function rateLimitKey(kind: 'ip' | 'address', value: string | undefined) {\n if (!value) return undefined\n const digest = await globalThis.crypto.subtle.digest(\n 'SHA-256',\n new TextEncoder().encode(`brandlab-contact-${kind}:${value}`),\n )\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('')\n}\n\nasync function handleSubmission(\n options: ContactRouteHandlerOptions,\n request: ContactRequestContext,\n formData: FormData,\n outcome: SubmissionOutcome,\n ip?: string,\n): Promise<ContactActionResult> {\n const now = options.now?.() ?? new Date()\n if (!Number.isFinite(now.getTime()) || !validateFormShape(options.definition, formData)) {\n return validationResult()\n }\n const metadata = parseSubmissionMetadata(options.definition, formData, now)\n if (!metadata) return validationResult()\n\n let confirmationId: string\n try {\n confirmationId = await createConfirmationId(\n options.definition.projectId,\n metadata.clientSubmissionId,\n )\n } catch {\n return deliveryUnavailable(true)\n }\n if (!CONTACT_CONFIRMATION_ID_PATTERN.test(confirmationId)) {\n return deliveryUnavailable(false)\n }\n\n if (defaultBotAssessment(options.definition, formData).status !== 'allow') {\n return fakeSuccess()\n }\n if (options.botGuard) {\n try {\n const result = await options.botGuard.assess({\n formData,\n request,\n projectId: options.definition.projectId,\n confirmationId,\n now: now.getTime(),\n })\n if (result.status !== 'allow') return fakeSuccess()\n } catch {\n return deliveryUnavailable(true)\n }\n }\n\n const validated = validateFields(options.definition, formData)\n if (Object.keys(validated.fieldErrors).length > 0) {\n return validationResult(validated.fieldErrors)\n }\n\n if (options.spamFilter !== false) {\n const filter = options.spamFilter ?? {}\n const startedAt = stringEntry(formData, CONTACT_FORM_FIELDS.formStartedAt).trim()\n try {\n // Fill time is one weak signal inside the 2+ rule (4.2.3): a fast autofilled enquiry with nothing else is sent.\n const tooFast = submittedTooFast(startedAt, metadata.submittedAt, filter.minFillMs ?? BRANDLAB_CONTACT_MIN_FILL_MS)\n const assessment = await assessBrandlabContactSpam(\n validated.values,\n contactSpamFieldsOf(options.definition.fields),\n filter,\n { submittedTooFast: tooFast },\n )\n if (assessment.blocked) {\n logSpamBlocked(options.definition.projectId, assessment.signals)\n return fakeSuccess()\n }\n } catch {\n // A filter fault never costs a lead: the enquiry goes through as it would have without the filter.\n }\n }\n\n const mode = options.definition.deploymentMode ?? 'production'\n if (options.rateLimiter && (mode === 'production' || mode === 'preview')) {\n const emailField = options.definition.fields.find((field) => getFieldRole(field) === 'email')\n let decision: ReturnType<BrandlabContactRateLimiter['check']>\n try {\n const [ipKey, addressKey] = await Promise.all([\n rateLimitKey('ip', ip),\n rateLimitKey('address', emailField ? validated.values[emailField.name] : undefined),\n ])\n decision = options.rateLimiter.check({\n ...(ipKey ? { ipKey } : {}),\n ...(addressKey ? { addressKey } : {}),\n submissionId: metadata.clientSubmissionId,\n now: now.getTime(),\n })\n } catch {\n // A limiter fault never costs an enquiry.\n decision = { ok: true }\n }\n if (!decision.ok) {\n logRateLimited(decision.limit, decision.retryAfterSeconds)\n outcome.retryAfterSeconds = decision.retryAfterSeconds\n return deliveryUnavailable(true)\n }\n }\n\n let attachments: readonly ContactDeliveryAttachment[] | undefined\n try {\n attachments = await readValidatedAttachments(options.definition, formData)\n if (attachments && options.attachmentProcessor) {\n const processed = await options.attachmentProcessor.process({ attachments })\n attachments = processed.ok ? processed.attachments : undefined\n }\n } catch {\n attachments = undefined\n }\n if (!attachments || !validateProcessedAttachments(options.definition, attachments)) {\n return {\n ok: false,\n code: 'attachment_rejected',\n retryable: false,\n }\n }\n\n if (mode === 'development' || mode === 'test') {\n return fakeSuccess()\n }\n // A Brandlab test enquiry: delivered like any other, flagged in the subject and never reported as a lead. On a\n // Preview (4.2.0) it goes only to Brandlab's own inbox, never to the client's.\n const testEnquiry =\n stringEntry(formData, CONTACT_FORM_FIELDS.testMarker).trim() === BRANDLAB_CONTACT_TEST_MARKER\n const previewTest = testEnquiry && mode === 'preview'\n const transport = previewTest ? options.testTransport : options.transport\n if (!transport) {\n // Production or Preview without its email key or recipients: every enquiry fails until it is set.\n logDeliveryFailure({ provider: options.provider, code: 'not_configured' })\n return deliveryUnavailable(false)\n }\n const provider = transport.provider ?? options.provider\n\n if (!previewTest && options.recipientCheck && options.recipientCheck.recipients.length > 0) {\n const { recipients, check } = options.recipientCheck\n const statuses = await Promise.all(\n recipients.map((address) =>\n Promise.resolve()\n .then(() => check(address))\n .catch((): BrandlabContactSuppressionStatus => 'unknown'),\n ),\n )\n const suppressed = statuses.filter((status) => status === 'suppressed').length\n if (suppressed > 0) {\n await reportContactDeliveryFailure(\n {\n event: BRANDLAB_CONTACT_DELIVERY_FAILED_EVENT,\n provider: 'resend',\n code: 'recipient_suppressed',\n source: 'pre-send',\n recipients: suppressed === recipients.length ? 'all' : 'some',\n submission: confirmationId.slice(0, 16),\n at: now.toISOString(),\n },\n options.onDeliveryFailure,\n )\n // Record and alert only: the client keeps their own inbox deliverable. A site may opt in to refusing instead.\n if (suppressed === recipients.length && options.refuseWhenAllSuppressed === true) return deliveryUnavailable(false)\n }\n }\n\n const rendered = renderContactEmail({\n definition: options.definition,\n values: validated.values,\n context: metadata.context,\n // The time the server received it: the visitor's clock may be wrong.\n submittedAt: now.toISOString(),\n confirmationId,\n attachments,\n })\n try {\n const transportResult = await transport.send({\n idempotencyKey: createIdempotencyKey(\n options.definition.projectId,\n metadata.clientSubmissionId,\n ),\n confirmationId,\n subject: testEnquiry ? sanitizeContactEmailSubject(`[Test] ${rendered.subject}`) : rendered.subject,\n html: rendered.html,\n text: rendered.text,\n ...(rendered.replyTo ? { replyTo: rendered.replyTo } : {}),\n attachments,\n providerMetadata: {\n project_id: options.definition.projectId,\n submission_hash: confirmationId,\n },\n })\n if (!transportResult.ok) {\n const detail = transportResult as { providerCode?: unknown; status?: unknown }\n logDeliveryFailure({\n provider,\n ...(typeof detail.status === 'number' ? { status: detail.status } : {}),\n code: (typeof detail.providerCode === 'string' ? detail.providerCode : undefined) ?? transportResult.code ?? 'provider_rejected',\n })\n return deliveryUnavailable(transportResult.retryable ?? true)\n }\n if (!SAFE_PROVIDER_MESSAGE_ID_PATTERN.test(transportResult.providerMessageId)) {\n logDeliveryFailure({ provider, code: 'provider_invalid_id' })\n return deliveryUnavailable(true)\n }\n return testEnquiry ? fakeSuccess() : acceptedResult(confirmationId)\n } catch {\n logDeliveryFailure({ provider, code: 'transport_exception' })\n return deliveryUnavailable(true)\n }\n}\n\nexport function createContactRouteHandler(options: ContactRouteHandlerOptions) {\n assertDefinition(options.definition)\n if (\n options.definition.attachments &&\n options.attachmentProcessor?.capability !== 'sanitizes-contact-images-v1'\n ) {\n throw new Error('Upload-enabled contact routes require the shared image sanitizer.')\n }\n if (options.botGuard && typeof options.botGuard.assess !== 'function') {\n throw new Error('The optional contact bot guard is invalid.')\n }\n if (options.rateLimiter !== undefined && !isBrandlabContactRateLimiter(options.rateLimiter)) {\n throw new Error('The contact rate limiter is invalid.')\n }\n const limits = getContactRequestLimits(options.definition)\n const previewMode = (options.definition.deploymentMode ?? 'production') === 'preview'\n const handle = createContactRequestHandler(options, limits)\n if (!previewMode) return handle\n // A Preview's contact route says so on every answer (4.2.0), and that its marked test enquiries reach only\n // Brandlab's inbox, so brandlab-preview-enquiry can confirm both before it sends one. Production never says it.\n return async (request: Request): Promise<Response> => {\n const response = await handle(request)\n const headers = new Headers(response.headers)\n headers.set(BRANDLAB_PREVIEW_CONTACT_HEADER, 'preview; test-inbox=brandlab')\n return new Response(response.body, { status: response.status, statusText: response.statusText, headers })\n }\n}\n\n/** The header a Preview's contact route answers with (4.2.0): `preview; test-inbox=brandlab`. */\nexport const BRANDLAB_PREVIEW_CONTACT_HEADER = 'x-brandlab-contact-mode'\n\nfunction createContactRequestHandler(options: ContactRouteHandlerOptions, limits: ReturnType<typeof getContactRequestLimits>) {\n return async (request: Request): Promise<Response> => {\n if (!(request instanceof Request) || request.method.toUpperCase() !== 'POST') {\n return jsonResult(validationResult(), 405)\n }\n const origin = sameOriginRequest(request, options.definition)\n if (\n !origin ||\n request.headers.has('transfer-encoding') ||\n !contentTypeIsAllowed(\n request.headers.get('content-type'),\n Boolean(options.definition.attachments),\n ) ||\n !contentLengthIsAllowed(\n request.headers.get('content-length'),\n limits.maxRequestBytes,\n )\n ) {\n return jsonResult(validationResult(), 400)\n }\n\n let formData: FormData\n try {\n formData = await request.formData()\n } catch {\n return jsonResult(validationResult(), 400)\n }\n const outcome: SubmissionOutcome = {}\n const result = await handleSubmission(options, { origin }, formData, outcome, clientIp(request))\n if (outcome.retryAfterSeconds !== undefined) {\n const response = jsonResult(result, 429)\n response.headers.set('retry-after', String(outcome.retryAfterSeconds))\n return response\n }\n return jsonResult(result, statusForResult(result))\n }\n}\n\nfunction boundedSecret(value: string | undefined): value is string {\n return (\n typeof value === 'string' &&\n value.length > 0 &&\n value.length <= 8_192 &&\n !/[\\u0000-\\u001f\\u007f]/.test(value)\n )\n}\n\ninterface RuntimeDelivery {\n transport?: LoggedContactTransport\n testTransport?: LoggedContactTransport\n recipientCheck?: RecipientCheck\n}\n\nfunction createRuntimeTransport(\n options: BrandlabContactRuntimeOptions,\n contract: BrandlabContactContract,\n mode: BrandlabContactDeploymentMode,\n): RuntimeDelivery | undefined {\n if (mode === 'development' || mode === 'test') return undefined\n const environment = options.environment ?? {}\n const apiKey = environment[BRANDLAB_CONTACT_API_KEY_ENV]\n try {\n if (!boundedSecret(apiKey)) return undefined\n // Preview (4.2.0): marked test enquiries go to Brandlab's own inbox only, whatever the recipient setting says.\n const testTransport = mode === 'preview'\n ? createContractResendContactTransport({\n contract,\n environment: { ...environment, [contract.delivery.recipientEnv]: BRANDLAB_PREVIEW_TEST_RECIPIENT },\n send: options.createResendSend(apiKey),\n })\n : undefined\n const recipients = parseContactEmailRecipients(\n environment[contract.delivery.recipientEnv],\n )\n if (recipients.length === 0) return testTransport ? { testTransport } : undefined\n const transport = createContractResendContactTransport({\n contract,\n environment,\n send: options.createResendSend(apiKey),\n })\n const suppressionCheck = options.suppressionCheck\n const lookupKey = environment[BRANDLAB_CONTACT_LOOKUP_API_KEY_ENV]\n const lookupApiKey = boundedSecret(lookupKey) ? lookupKey : apiKey\n const recipientCheck: RecipientCheck | undefined = suppressionCheck\n ? { recipients, check: (address) => suppressionCheck.check(address, { apiKey: lookupApiKey }) }\n : undefined\n return { transport, ...(recipientCheck ? { recipientCheck } : {}), ...(testTransport ? { testTransport } : {}) }\n } catch {\n return undefined\n }\n}\n\n/** The only inbox a marked test enquiry from a Preview deployment reaches (4.2.0). */\nexport const BRANDLAB_PREVIEW_TEST_RECIPIENT = 'info@brandlabdigital.com.au'\n\nexport function createBrandlabContactRuntime(\n options: BrandlabContactRuntimeOptions,\n): BrandlabContactRuntime {\n if (!options || typeof options !== 'object') {\n throw new TypeError('Contact runtime options are required.')\n }\n if (!options.runtime || typeof options.runtime !== 'object') {\n throw new TypeError('Contact runtime definition is required.')\n }\n if (typeof options.createResendSend !== 'function') {\n throw new TypeError('A lazy Resend send factory is required.')\n }\n const rateLimiter =\n options.rateLimit === false\n ? undefined\n : isBrandlabContactRateLimiter(options.rateLimit)\n ? options.rateLimit\n : createBrandlabContactRateLimiter(options.rateLimit)\n const mode = options.deploymentMode ?? 'production'\n if (!['production', 'preview', 'development', 'test'].includes(mode)) {\n throw new Error('deploymentMode is invalid.')\n }\n const contract = defineContactContract(options.contract)\n const definition = createContactDefinitionFromContract(contract, {\n ...options.runtime,\n deploymentMode: mode,\n })\n assertDefinition(definition)\n if (options.suppressionCheck !== undefined && typeof options.suppressionCheck?.check !== 'function') {\n throw new TypeError('The contact suppression check is invalid.')\n }\n if (options.onDeliveryFailure !== undefined && typeof options.onDeliveryFailure !== 'function') {\n throw new TypeError('onDeliveryFailure must be a function.')\n }\n const delivery = createRuntimeTransport(options, contract, mode)\n const contactRouteHandler = createContactRouteHandler({\n definition,\n ...(delivery?.transport ? { transport: delivery.transport } : {}),\n ...(delivery?.testTransport ? { testTransport: delivery.testTransport } : {}),\n ...(delivery?.recipientCheck ? { recipientCheck: delivery.recipientCheck } : {}),\n ...(options.onDeliveryFailure ? { onDeliveryFailure: options.onDeliveryFailure } : {}),\n ...(options.refuseWhenAllSuppressed === true ? { refuseWhenAllSuppressed: true } : {}),\n provider: 'resend',\n ...(definition.attachments\n ? { attachmentProcessor: createBrandlabContactImageSanitizer() }\n : {}),\n ...(options.botGuard ? { botGuard: options.botGuard } : {}),\n ...(options.spamFilter !== undefined ? { spamFilter: options.spamFilter } : {}),\n ...(options.now ? { now: options.now } : {}),\n ...(rateLimiter ? { rateLimiter } : {}),\n })\n\n return Object.freeze({\n runtimeKind: BRANDLAB_CONTACT_RUNTIME,\n definition,\n contactRouteHandler,\n })\n}\n"]}
@@ -11,12 +11,19 @@
11
11
  * thank-you, nothing is sent and `contact_form` does not fire. The route logs one redacted line (site and signals).
12
12
  *
13
13
  * The suburb signal reads only a location field whose key is `suburb`: a full street address is never scored.
14
+ *
15
+ * A form sent under the minimum fill time is the weak `fill-time` signal (4.2.3; Romie, 18 November 2026). Browser
16
+ * autofill and returning visitors send real enquiries that fast, so fill time alone never blocks; it adds to a strong
17
+ * signal like any other weak one.
14
18
  */
15
19
  import type { ContactFieldDefinition } from './shared.js';
16
20
  export declare const BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS: readonly ["pitch-marketing", "pitch-reviews", "pitch-estimating", "pitch-outreach", "pitch-email-lure", "pitch-lure", "pitch-site", "messaging-link", "lookalike-letters", "known-sender"];
17
- export declare const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS: readonly ["link", "overseas-phone", "foreign-suburb"];
21
+ export declare const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS: readonly ["link", "overseas-phone", "foreign-suburb", "fill-time"];
18
22
  export type BrandlabContactSpamSignal = (typeof BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS)[number] | (typeof BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS)[number];
19
- /** The fewest milliseconds between the form rendering and its submission (3 s); anything faster is dropped silently. */
23
+ /**
24
+ * The fewest milliseconds between the form rendering and its submission (3 s). Anything faster is the weak `fill-time`
25
+ * signal: never blocked on its own, only together with a strong signal.
26
+ */
20
27
  export declare const BRANDLAB_CONTACT_MIN_FILL_MS = 3000;
21
28
  /**
22
29
  * SHA-256 of known spam sender addresses (trimmed, lower case). Hashes only: never store a raw address.
@@ -30,9 +37,14 @@ export interface BrandlabContactSpamFilterOptions {
30
37
  readonly knownSenderHashes?: readonly string[];
31
38
  /** Signals this site does not count (to relax a rule). */
32
39
  readonly ignoreSignals?: readonly BrandlabContactSpamSignal[];
33
- /** The minimum fill time in milliseconds; 0 turns the check off. Defaults to BRANDLAB_CONTACT_MIN_FILL_MS. */
40
+ /** The minimum fill time in milliseconds (the weak `fill-time` signal); 0 turns it off. Defaults to BRANDLAB_CONTACT_MIN_FILL_MS. */
34
41
  readonly minFillMs?: number;
35
42
  }
43
+ /** What the route knows about the submission itself, beside its field values. */
44
+ export interface BrandlabContactSpamContext {
45
+ /** The form was sent under the minimum fill time (submittedTooFast): the weak `fill-time` signal. */
46
+ readonly submittedTooFast?: boolean;
47
+ }
36
48
  export interface BrandlabContactSpamAssessment {
37
49
  readonly blocked: boolean;
38
50
  /** Every signal found, strong ones first, in a fixed order. */
@@ -55,7 +67,7 @@ export declare function contactSpamFieldsOf(fields: readonly Pick<ContactFieldDe
55
67
  * Scores one enquiry. `values` are the validated field values by field name; `fields` names which to read
56
68
  * (contactSpamFieldsOf). Pure apart from hashing the sender address.
57
69
  */
58
- export declare function assessBrandlabContactSpam(values: Readonly<Record<string, string | undefined>>, fields: ReturnType<typeof contactSpamFieldsOf>, options?: BrandlabContactSpamFilterOptions): Promise<BrandlabContactSpamAssessment>;
70
+ export declare function assessBrandlabContactSpam(values: Readonly<Record<string, string | undefined>>, fields: ReturnType<typeof contactSpamFieldsOf>, options?: BrandlabContactSpamFilterOptions, context?: BrandlabContactSpamContext): Promise<BrandlabContactSpamAssessment>;
59
71
  /**
60
72
  * Whether the form was sent too soon after it rendered: both stamps are the visitor's own clock (`formStartedAt` when
61
73
  * the form's submission controller was created, `submittedAt` when it was sent), so clock skew cancels out. A form
@@ -1 +1 @@
1
- {"version":3,"file":"spam-filter.d.ts","sourceRoot":"","sources":["../../src/contact/spam-filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGzD,eAAO,MAAM,oCAAoC,4LAWvC,CAAA;AAEV,eAAO,MAAM,kCAAkC,uDAAwD,CAAA;AAEvG,MAAM,MAAM,yBAAyB,GACjC,CAAC,OAAO,oCAAoC,CAAC,CAAC,MAAM,CAAC,GACrD,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,wHAAwH;AACxH,eAAO,MAAM,4BAA4B,OAAQ,CAAA;AAEjD;;;GAGG;AACH,eAAO,MAAM,yCAAyC,EAAE,SAAS,MAAM,EAGrE,CAAA;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,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG;IAC9G,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAaA;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,EACpD,MAAM,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,EAC9C,OAAO,GAAE,gCAAqC,EAC9C,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,6BAA6B,CAAC,CA2CxC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAOnG"}
@@ -11,8 +11,11 @@ export const BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS = [
11
11
  'lookalike-letters',
12
12
  'known-sender',
13
13
  ];
14
- export const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS = ['link', 'overseas-phone', 'foreign-suburb'];
15
- /** The fewest milliseconds between the form rendering and its submission (3 s); anything faster is dropped silently. */
14
+ export const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS = ['link', 'overseas-phone', 'foreign-suburb', 'fill-time'];
15
+ /**
16
+ * The fewest milliseconds between the form rendering and its submission (3 s). Anything faster is the weak `fill-time`
17
+ * signal: never blocked on its own, only together with a strong signal.
18
+ */
16
19
  export const BRANDLAB_CONTACT_MIN_FILL_MS = 3_000;
17
20
  /**
18
21
  * SHA-256 of known spam sender addresses (trimmed, lower case). Hashes only: never store a raw address.
@@ -280,7 +283,7 @@ export function contactSpamFieldsOf(fields) {
280
283
  * Scores one enquiry. `values` are the validated field values by field name; `fields` names which to read
281
284
  * (contactSpamFieldsOf). Pure apart from hashing the sender address.
282
285
  */
283
- export async function assessBrandlabContactSpam(values, fields, options = {}) {
286
+ export async function assessBrandlabContactSpam(values, fields, options = {}, context = {}) {
284
287
  const found = new Set();
285
288
  const raw = fields.text.map((name) => values[name] ?? '').filter(Boolean).join('\n');
286
289
  const text = normalizedText(raw);
@@ -317,6 +320,8 @@ export async function assessBrandlabContactSpam(values, fields, options = {}) {
317
320
  const suburb = fields.suburb ? values[fields.suburb] : undefined;
318
321
  if (suburb && isClearlyForeignOrRandomSuburb(suburb))
319
322
  found.add('foreign-suburb');
323
+ if (context.submittedTooFast)
324
+ found.add('fill-time');
320
325
  for (const ignored of options.ignoreSignals ?? [])
321
326
  found.delete(ignored);
322
327
  if (!PITCH_SIGNALS.some((signal) => found.has(signal)))
@@ -1 +1 @@
1
- {"version":3,"file":"spam-filter.js","sourceRoot":"","sources":["../../src/contact/spam-filter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,gCAAgC,EAAE,MAAM,kBAAkB,CAAA;AAEnE,MAAM,CAAC,MAAM,oCAAoC,GAAG;IAClD,iBAAiB;IACjB,eAAe;IACf,kBAAkB;IAClB,gBAAgB;IAChB,kBAAkB;IAClB,YAAY;IACZ,YAAY;IACZ,gBAAgB;IAChB,mBAAmB;IACnB,cAAc;CACN,CAAA;AAEV,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,CAAU,CAAA;AAMvG,wHAAwH;AACxH,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAEjD;;;GAGG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAsB,MAAM,CAAC,MAAM,CAAC;IACxF,kEAAkE;IAClE,kEAAkE;CACnE,CAAC,CAAA;AAmBF,MAAM,MAAM,GAAG,IAAI,GAAG,CAAS,oCAAoC,CAAC,CAAA;AACpE,MAAM,aAAa,GAAyC;IAC1D,iBAAi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AAE,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,cAAc,IAAI,CAAC;QAC5D,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;KAChC,CAAC,CAAA;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB,EAAE,WAAmB,EAAE,SAAiB;IACxF,IAAI,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAA;IAChD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAA;IACrC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1E,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,OAAO,OAAO,IAAI,CAAC,IAAI,OAAO,GAAG,SAAS,CAAA;AAC5C,CAAC","sourcesContent":["/**\n * The shared contact-form spam filter (4.1.0; Romie, 5 November 2026). Human-typed sales pitches pass the honeypot,\n * same-site and format checks, so the route scores what the enquiry says.\n *\n * Signals are strong (a sales pitch, a messaging link, look-alike letters, a known spam sender) or weak (a link, an\n * overseas number in the message, a suburb that is clearly not Australian or is random characters). An enquiry is\n * blocked only when at least one strong signal and at least two signals in all match (two different pitch phrases\n * count as two): weak signals add to a strong\n * one but never block on their own or together, and a genuine enquiry that trips one signal is delivered exactly as\n * before, with nothing added to the email. A blocked enquiry gets the normal silent success: the visitor sees the\n * thank-you, nothing is sent and `contact_form` does not fire. The route logs one redacted line (site and signals).\n *\n * The suburb signal reads only a location field whose key is `suburb`: a full street address is never scored.\n */\nimport type { ContactFieldDefinition } from './shared.js'\nimport { BRANDLAB_SPAM_FILTER_PLACE_NAMES } from './spam-places.js'\n\nexport const BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS = [\n 'pitch-marketing',\n 'pitch-reviews',\n 'pitch-estimating',\n 'pitch-outreach',\n 'pitch-email-lure',\n 'pitch-lure',\n 'pitch-site',\n 'messaging-link',\n 'lookalike-letters',\n 'known-sender',\n] as const\n\nexport const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS = ['link', 'overseas-phone', 'foreign-suburb'] as const\n\nexport type BrandlabContactSpamSignal =\n | (typeof BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS)[number]\n | (typeof BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS)[number]\n\n/** The fewest milliseconds between the form rendering and its submission (3 s); anything faster is dropped silently. */\nexport const BRANDLAB_CONTACT_MIN_FILL_MS = 3_000\n\n/**\n * SHA-256 of known spam sender addresses (trimmed, lower case). Hashes only: never store a raw address.\n * The first two came from AA Tree's 2 November review-selling wave (its own filter, PR #57, replaced by this one).\n */\nexport const BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES: readonly string[] = Object.freeze([\n '8d1b3f54b80e318ec48be6f7a75fb1d0c04fd9969aa40e2d97057936b2cf4c7c',\n '4afca3f9ea7339d1a9d52029913be62780a99069f06893e414a9b44f254d6d91',\n])\n\nexport interface BrandlabContactSpamFilterOptions {\n /** Extra sales-pitch phrases for this site (case-insensitive text or a RegExp); a match is the strong `pitch-site`. */\n readonly extraPhrases?: readonly (string | RegExp)[]\n /** Extra known spam senders, as SHA-256 hex of the trimmed, lower-case address. */\n readonly knownSenderHashes?: readonly string[]\n /** Signals this site does not count (to relax a rule). */\n readonly ignoreSignals?: readonly BrandlabContactSpamSignal[]\n /** The minimum fill time in milliseconds; 0 turns the check off. Defaults to BRANDLAB_CONTACT_MIN_FILL_MS. */\n readonly minFillMs?: number\n}\n\nexport interface BrandlabContactSpamAssessment {\n readonly blocked: boolean\n /** Every signal found, strong ones first, in a fixed order. */\n readonly signals: readonly BrandlabContactSpamSignal[]\n}\n\nconst STRONG = new Set<string>(BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS)\nconst PITCH_SIGNALS: readonly BrandlabContactSpamSignal[] = [\n 'pitch-marketing', 'pitch-reviews', 'pitch-estimating', 'pitch-outreach', 'pitch-email-lure', 'pitch-lure',\n]\n\n/** Letters with no Australian English use: mathematical, full-width, enclosed and small-capital forms. */\nconst LOOKALIKE_CHARACTERS =\n /[\\u{1D400}-\\u{1D7FF}A-Za-zⒶ-ⓩᴀ-ᴫɐ-ʯℂℊ-ℓℕℙ-ℝℤℬℭℯ-ℱℳℴ]/u\nconst LATIN_LETTER = /[A-Za-z]/\nconst CYRILLIC_OR_GREEK_LETTER = /[Ͱ-ϿЀ-ӿ]/\n\nconst PITCH_PATTERNS: Readonly<Record<string, readonly RegExp[]>> = {\n 'pitch-marketing': [\n /\\bseo\\b/,\n /\\bsearch engine optimi[sz]/,\n /\\b(?:first|1st|top) page (?:of|on) google\\b/,\n /\\bpage (?:1|one) (?:of|on) google\\b/,\n /\\b(?:google|search|website|organic) rankings?\\b/,\n /\\brank(?:ing)? (?:higher|better|#?1|first|on (?:the )?(?:first page|google))/,\n /\\borganic traffic\\b/,\n /\\bbacklinks?\\b/,\n /\\bdomain authority\\b/,\n /\\b(?:website|site|seo|free) audit\\b/,\n /\\bdigital marketing (?:agency|services|expert|specialist|strateg)/,\n /\\blead generation\\b/,\n /\\b(?:more|qualified|exclusive) leads (?:for|to) your\\b/,\n /\\bboost your (?:online |google |local )?(?:presence|visibility|sales|rankings?|traffic)\\b/,\n /\\b(?:redesign|revamp) (?:of )?your (?:website|site)\\b/,\n /\\bai (?:chat ?bot|agent|receptionist|voice|assistant|calling|automation)/,\n /\\b(?:google (?:my )?business|business) profile (?:optimi[sz]|management|ranking)/,\n /\\bsocial media (?:marketing|management)\\b/,\n /\\bweb ?(?:design|development) (?:services|agency|company)\\b/,\n /\\b(?:not (?:well )?optimi[sz]ed|optimi[sz]ed) for google\\b/,\n /\\bissue report (?:with|&|and) screenshot/,\n /\\b(?:seo|ranking) report\\b|\\baudit report (?:&|and) proposal\\b/,\n /\\bup in the (?:google )?rankings\\b/,\n /\\bimprove (?:these|your) search results\\b/,\n /\\bredesign mock-?up\\b/,\n /\\bmock-?up for you\\b/,\n /\\bhow your (?:site|website) could look\\b/,\n ],\n 'pitch-reviews': [\n /\\b(?:buy|purchase|get) (?:real |genuine |positive )?(?:google |5[- ]star |five[- ]star )reviews\\b/,\n /\\b(?:5|five)[- ]star (?:google )?reviews (?:for|to) your\\b/,\n /\\b(?:remove|delete|deleting|removing|removal of) (?:any |all |the |your )?(?:previous |old |bad |negative |fake )+reviews\\b/,\n /\\bnegative reviews (?:removed|deleted|removal)\\b/,\n /\\breviews? expert team\\b/,\n /\\breviews from local guides\\b/,\n /\\blocal guides?\\b.{0,60}\\breviews\\b/,\n /\\bincrease your (?:google )?(?:reviews|rating)\\b/,\n ],\n 'pitch-estimating': [\n /\\b(?:quantity |material |construction )?take-?offs?\\b/,\n /\\bestimating (?:services|firm|company|team|support)\\b/,\n /\\bcost estimat(?:ing|ion|or) (?:services|firm|company)\\b/,\n /\\boutsourced? estimat/,\n /\\bwe (?:provide|assist|offer|deliver|specialise|specialize|convert|prepare)\\b.{0,120}\\b(?:take-?offs?|estimat\\w*|bills? of quantities|material (?:lists?|counts?|breakdowns?)|labou?r (?:cost )?breakdowns?)/,\n /\\b(?:remote|rapid) (?:estimating|estimates|take-?offs?)\\b/,\n /\\bitemi[sz]ed (?:excel )?material lists?\\b|\\bline-item material counts?\\b/,\n /\\bplans into\\b.{0,40}\\bexcel\\b/,\n /\\b(?:assist|support|help) (?:construction businesses|trade contractors)\\b/,\n /\\btender (?:drawings|pricing|quotes)\\b.{0,60}\\b(?:like us to|on your desk|out the door|pricing up)\\b|\\bsupport with project measurements\\b/,\n /\\boverflow during busy\\b/,\n ],\n 'pitch-outreach': [\n /\\bare you the (?:business )?owner\\b/,\n /\\bwho (?:handles|manages|looks after|is in charge of) your (?:marketing|website|seo|online|advertising)\\b/,\n /\\bi(?:'m| am) reaching out (?:to|from|because|on behalf|regarding)\\b/,\n /\\bwe help (?:local |small |australian )?(?:businesses|companies|contractors|tradies|trades(?:people|men)?|plumbers|builders|electricians|roofers|landscapers|arborists)\\b/,\n /\\bwhite[- ]label\\b/,\n /\\boutsourc(?:e|ing) (?:your|services|solutions)\\b/,\n /\\bvirtual assistants?\\b/,\n /\\b(?:our|my) (?:agency|company|team|firm) (?:can help|specialises|specializes|helps|offers|provides)\\b/,\n /\\bfree (?:trial|demo|strategy (?:call|session)|consultation call)\\b/,\n /\\b(?:book|schedule) a (?:quick |short |free )?(?:call|demo|meeting) (?:with me|here|at)\\b/,\n /\\b(?:reply|respond) (?:with )?[\"']?stop[\"']? to (?:opt out|unsubscribe)\\b/,\n /\\bunsubscribe\\b/,\n /\\bnot relevant\\? reply\\b/,\n /\\b(?:i|we) won'?t contact you again\\b/,\n /\\b\\$?\\d+ off your first order\\b/,\n /\\bdomain(?: name)?\\b.{0,60}\\b(?:currently )?available for (?:sale|purchase)\\b/,\n /\\bbefore listing it publicly\\b/,\n ],\n 'pitch-email-lure': [\n /\\breach (?:me|us) (?:via|by|through|at|on) (?:my |our )?e-?mail\\b/,\n /\\bcontact (?:me|us) (?:only )?(?:via|by|through) (?:my |our )?e-?mail\\b/,\n /\\breply (?:to|via|by) (?:this |my |our )?e-?mail (?:for|if|to get|to receive)\\b/,\n /\\be-?mail (?:me|us) (?:for|to get|to receive) (?:more |the |a |our )?(?:details|info|information|pricing|proposal|price list|samples?|portfolio|case stud)/,\n /\\bkindly (?:reply|respond|revert|get back)\\b/,\n /\\bdrop (?:me|us) (?:a line|an e-?mail)\\b/,\n /\\b(?:i'?m|i am) interested in your services\\b.{0,40}\\b(?:reach|contact|e-?mail) me\\b/,\n /\\binformation about your services, design options, pricing\\b/,\n ],\n 'pitch-lure': [\n /\\bon behalf of\\b.{0,40}\\blawyer\\b/,\n /\\bshare with your team for review and assessment\\b/,\n /\\bwhether you are accepting new work\\b/,\n /\\bprovide the details required to prepare a full proposal\\b/,\n ],\n}\n\nconst MESSAGING_LINK = /\\b(?:wa\\.me\\/|api\\.whatsapp\\.com|chat\\.whatsapp\\.com|t\\.me\\/|telegram\\.me\\/)/\nconst MESSAGING_MENTION = /\\b(?:whats ?app|telegram)\\b/\nconst URL_PATTERN =\n /\\bhttps?:\\/\\/|\\bwww\\.|\\b[a-z0-9-]+\\.(?:com|net|org|io|co|agency|biz|info|online|site|xyz|ai|app|me|us|uk|in|pk|bd|ph|ng|store|tech|digital|marketing|solutions|services)\\b/\nconst EMAIL_PATTERN = /[^\\s@]+@[^\\s@]+\\.[^\\s@]+/g\nconst INTERNATIONAL_NUMBER = /(?:\\+|\\b00)\\s?(\\d[\\d\\s().-]{6,18}\\d)/g\n\nconst AUSTRALIAN_STATES = new Set(['nsw', 'vic', 'qld', 'sa', 'wa', 'tas', 'nt', 'act', 'au', 'aus', 'australia'])\nconst ABBREVIATIONS: Readonly<Record<string, string>> = {\n nth: 'north', sth: 'south', st: 'saint', mt: 'mount', pt: 'point', pk: 'park', hts: 'heights', stn: 'station',\n}\n/** Whole values that are clearly not Australian. Only unambiguous names: no place that also exists here (Manila NSW). */\nconst FOREIGN_PLACES = new Set([\n 'india', 'pakistan', 'bangladesh', 'nigeria', 'philippines', 'usa', 'us', 'united states', 'america', 'uk',\n 'united kingdom', 'england', 'scotland', 'ireland', 'canada', 'singapore', 'malaysia', 'indonesia', 'vietnam',\n 'thailand', 'nepal', 'sri lanka', 'kenya', 'ghana', 'egypt', 'uae', 'dubai', 'abu dhabi', 'qatar', 'saudi arabia',\n 'dhaka', 'chittagong', 'karachi', 'lahore', 'islamabad', 'delhi', 'new delhi', 'mumbai', 'bangalore', 'bengaluru',\n 'kolkata', 'chennai', 'hyderabad', 'pune', 'jaipur', 'ahmedabad', 'lagos', 'abuja', 'nairobi', 'cairo', 'cebu',\n 'quezon city', 'makati', 'jakarta', 'kuala lumpur', 'hanoi', 'ho chi minh', 'bangkok', 'kathmandu', 'colombo',\n 'london', 'manchester', 'birmingham', 'new york', 'los angeles', 'chicago', 'houston', 'miami', 'seattle',\n 'san francisco', 'las vegas', 'california', 'florida', 'toronto', 'vancouver', 'new jersey',\n])\n/** Values a real customer types when the suburb does not apply. */\nconst HARMLESS_VALUES = new Set(['na', 'n a', 'nil', 'none', 'tba', 'tbc', 'no', 'ok', 'x'])\nconst KEYBOARD_RUNS = ['qwer', 'wert', 'erty', 'asdf', 'sdfg', 'dfgh', 'fghj', 'ghjk', 'hjkl', 'zxcv', 'xcvb', 'cvbn', 'vbnm']\n\nlet placeIndex: Map<number, string[]> | undefined\nfunction placesByLength(): Map<number, string[]> {\n if (placeIndex) return placeIndex\n placeIndex = new Map()\n for (const name of BRANDLAB_SPAM_FILTER_PLACE_NAMES) {\n const list = placeIndex.get(name.length) ?? []\n list.push(name)\n placeIndex.set(name.length, list)\n }\n return placeIndex\n}\n\nfunction editDistanceWithin(a: string, b: string, limit: number): boolean {\n if (Math.abs(a.length - b.length) > limit) return false\n let previous = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i += 1) {\n const current = [i]\n let rowMin = i\n for (let j = 1; j <= b.length; j += 1) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1\n const value = Math.min(previous[j]! + 1, current[j - 1]! + 1, previous[j - 1]! + cost)\n current.push(value)\n rowMin = Math.min(rowMin, value)\n }\n if (rowMin > limit) return false\n previous = current\n }\n return previous[b.length]! <= limit\n}\n\n/** True when the text is, or is a typo of, a Sydney or Central Coast place. */\nfunction nearKnownPlace(text: string): boolean {\n const limit = text.length >= 8 ? 2 : text.length >= 4 ? 1 : 0\n const index = placesByLength()\n for (let length = text.length - limit; length <= text.length + limit; length += 1) {\n for (const name of index.get(length) ?? []) {\n if (name === text || (limit > 0 && editDistanceWithin(text, name, limit))) return true\n }\n }\n return false\n}\n\nfunction looksRandom(word: string): boolean {\n if (word.length < 4) return false\n if (!/[aeiouy]/.test(word)) return true\n if (/[^aeiouy]{5,}/.test(word)) return true\n if (/(.)\\1{3,}/.test(word)) return true\n if (KEYBOARD_RUNS.some((run) => word.includes(run))) return true\n const vowels = word.replace(/[^aeiouy]/g, '').length\n return word.length >= 6 && vowels / word.length < 0.2\n}\n\n/**\n * Whether a typed suburb is clearly not an Australian place or is random characters. Typos of Sydney and Central\n * Coast places, abbreviations (\"Nth Ryde\", \"St Ives\", \"Mt Druitt\"), postcodes, state names and any ordinary-looking\n * word (an interstate town) all pass: only a foreign place, a two-letter code that is not a state, or keyboard mash\n * counts.\n */\nexport function isClearlyForeignOrRandomSuburb(value: string): boolean {\n const normalized = value\n .normalize('NFKD')\n .replace(/[̀-ͯ]/g, '')\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n if (!normalized || HARMLESS_VALUES.has(normalized)) return false\n if (FOREIGN_PLACES.has(normalized)) return true\n const words = normalized\n .split(' ')\n .filter((word) => !AUSTRALIAN_STATES.has(word) && !/^\\d{3,4}$/.test(word))\n .map((word) => ABBREVIATIONS[word] ?? word)\n if (words.length === 0) return false\n if (words.some((word) => /\\d/.test(word))) return false\n const text = words.join(' ')\n if (FOREIGN_PLACES.has(text)) return true\n if (normalized.length === 2) return !AUSTRALIAN_STATES.has(normalized)\n if (nearKnownPlace(text) || words.some((word) => word.length >= 4 && nearKnownPlace(word))) return false\n return words.every((word) => looksRandom(word) || word.length < 4) && words.some(looksRandom)\n}\n\nfunction normalizedText(value: string): string {\n return value\n .normalize('NFKC')\n .toLowerCase()\n .replace(/[‘’ʼ]/g, \"'\")\n .replace(/\\s+/g, ' ')\n}\n\nfunction hasLookalikeLetters(value: string): boolean {\n if (LOOKALIKE_CHARACTERS.test(value)) return true\n return value.split(/[\\s.,!?;:()\"'/-]+/).some(\n (word) => LATIN_LETTER.test(word) && CYRILLIC_OR_GREEK_LETTER.test(word),\n )\n}\n\nfunction overseasNumber(text: string): boolean {\n for (const match of text.matchAll(INTERNATIONAL_NUMBER)) {\n const digits = (match[1] ?? '').replace(/\\D/g, '')\n if (digits.length >= 8 && !digits.startsWith('61')) return true\n }\n return false\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(value))\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('')\n}\n\n/** The fields the filter reads, by their contract key (the form's field name), never an HTML id. */\nexport function contactSpamFieldsOf(fields: readonly Pick<ContactFieldDefinition, 'name' | 'role' | 'kind'>[]): {\n text: readonly string[]\n email?: string\n suburb?: string\n} {\n const text: string[] = []\n let email: string | undefined\n let suburb: string | undefined\n for (const field of fields) {\n if (field.role === 'email' || field.kind === 'email') email ??= field.name\n else if (field.role === 'location') {\n if (field.name.toLowerCase() === 'suburb') suburb = field.name\n } else if (field.role !== 'phone' && field.kind !== 'phone' && field.kind !== 'checkbox' && field.kind !== 'select') {\n text.push(field.name)\n }\n }\n return { text, ...(email ? { email } : {}), ...(suburb ? { suburb } : {}) }\n}\n\n/**\n * Scores one enquiry. `values` are the validated field values by field name; `fields` names which to read\n * (contactSpamFieldsOf). Pure apart from hashing the sender address.\n */\nexport async function assessBrandlabContactSpam(\n values: Readonly<Record<string, string | undefined>>,\n fields: ReturnType<typeof contactSpamFieldsOf>,\n options: BrandlabContactSpamFilterOptions = {},\n): Promise<BrandlabContactSpamAssessment> {\n const found = new Set<BrandlabContactSpamSignal>()\n const raw = fields.text.map((name) => values[name] ?? '').filter(Boolean).join('\\n')\n const text = normalizedText(raw)\n const withoutEmails = text.replace(EMAIL_PATTERN, ' ')\n\n // A pitch usually trips several distinct phrases; each one past the first in a category counts as one more\n // signal, so a pure pitch with no link or odd suburb is still caught, while one phrase alone never blocks.\n let extraPitchHits = 0\n for (const [signal, patterns] of Object.entries(PITCH_PATTERNS)) {\n const hits = patterns.filter((pattern) => pattern.test(text)).length\n if (hits > 0) found.add(signal as BrandlabContactSpamSignal)\n extraPitchHits += Math.max(0, hits - 1)\n }\n for (const phrase of options.extraPhrases ?? []) {\n if (typeof phrase === 'string' ? text.includes(normalizedText(phrase)) : phrase.test(raw)) found.add('pitch-site')\n }\n if (MESSAGING_LINK.test(withoutEmails) || (MESSAGING_MENTION.test(text) && overseasNumber(text))) {\n found.add('messaging-link')\n }\n if (hasLookalikeLetters(raw)) found.add('lookalike-letters')\n const email = fields.email ? values[fields.email]?.trim().toLowerCase() : undefined\n if (email) {\n const hash = await sha256Hex(email)\n if (BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES.includes(hash) || options.knownSenderHashes?.includes(hash)) {\n found.add('known-sender')\n }\n }\n if (URL_PATTERN.test(withoutEmails)) found.add('link')\n if (overseasNumber(text)) found.add('overseas-phone')\n const suburb = fields.suburb ? values[fields.suburb] : undefined\n if (suburb && isClearlyForeignOrRandomSuburb(suburb)) found.add('foreign-suburb')\n\n for (const ignored of options.ignoreSignals ?? []) found.delete(ignored)\n if (!PITCH_SIGNALS.some((signal) => found.has(signal))) extraPitchHits = 0\n const order = [...BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS, ...BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS] as const\n const signals = order.filter((signal) => found.has(signal))\n const strong = signals.filter((signal) => STRONG.has(signal)).length\n return Object.freeze({\n blocked: strong >= 1 && signals.length + extraPitchHits >= 2,\n signals: Object.freeze(signals),\n })\n}\n\n/**\n * Whether the form was sent too soon after it rendered: both stamps are the visitor's own clock (`formStartedAt` when\n * the form's submission controller was created, `submittedAt` when it was sent), so clock skew cancels out. A form\n * without the start stamp (an older client or a hand-built form) is never dropped by this check.\n */\nexport function submittedTooFast(startedAt: string, submittedAt: string, minFillMs: number): boolean {\n if (!(minFillMs > 0) || !startedAt) return false\n const started = Date.parse(startedAt)\n const submitted = Date.parse(submittedAt)\n if (!Number.isFinite(started) || !Number.isFinite(submitted)) return false\n const elapsed = submitted - started\n return elapsed >= 0 && elapsed < minFillMs\n}\n"]}
1
+ {"version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AK,CAAC,WAAW,CAAC,CAAA;IACzC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,KAAK,CAAA;IAC1E,MAAM,OAAO,GAAG,SAAS,GAAG,OAAO,CAAA;IACnC,OAAO,OAAO,IAAI,CAAC,IAAI,OAAO,GAAG,SAAS,CAAA;AAC5C,CAAC","sourcesContent":["/**\n * The shared contact-form spam filter (4.1.0; Romie, 5 November 2026). Human-typed sales pitches pass the honeypot,\n * same-site and format checks, so the route scores what the enquiry says.\n *\n * Signals are strong (a sales pitch, a messaging link, look-alike letters, a known spam sender) or weak (a link, an\n * overseas number in the message, a suburb that is clearly not Australian or is random characters). An enquiry is\n * blocked only when at least one strong signal and at least two signals in all match (two different pitch phrases\n * count as two): weak signals add to a strong\n * one but never block on their own or together, and a genuine enquiry that trips one signal is delivered exactly as\n * before, with nothing added to the email. A blocked enquiry gets the normal silent success: the visitor sees the\n * thank-you, nothing is sent and `contact_form` does not fire. The route logs one redacted line (site and signals).\n *\n * The suburb signal reads only a location field whose key is `suburb`: a full street address is never scored.\n *\n * A form sent under the minimum fill time is the weak `fill-time` signal (4.2.3; Romie, 18 November 2026). Browser\n * autofill and returning visitors send real enquiries that fast, so fill time alone never blocks; it adds to a strong\n * signal like any other weak one.\n */\nimport type { ContactFieldDefinition } from './shared.js'\nimport { BRANDLAB_SPAM_FILTER_PLACE_NAMES } from './spam-places.js'\n\nexport const BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS = [\n 'pitch-marketing',\n 'pitch-reviews',\n 'pitch-estimating',\n 'pitch-outreach',\n 'pitch-email-lure',\n 'pitch-lure',\n 'pitch-site',\n 'messaging-link',\n 'lookalike-letters',\n 'known-sender',\n] as const\n\nexport const BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS = ['link', 'overseas-phone', 'foreign-suburb', 'fill-time'] as const\n\nexport type BrandlabContactSpamSignal =\n | (typeof BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS)[number]\n | (typeof BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS)[number]\n\n/**\n * The fewest milliseconds between the form rendering and its submission (3 s). Anything faster is the weak `fill-time`\n * signal: never blocked on its own, only together with a strong signal.\n */\nexport const BRANDLAB_CONTACT_MIN_FILL_MS = 3_000\n\n/**\n * SHA-256 of known spam sender addresses (trimmed, lower case). Hashes only: never store a raw address.\n * The first two came from AA Tree's 2 November review-selling wave (its own filter, PR #57, replaced by this one).\n */\nexport const BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES: readonly string[] = Object.freeze([\n '8d1b3f54b80e318ec48be6f7a75fb1d0c04fd9969aa40e2d97057936b2cf4c7c',\n '4afca3f9ea7339d1a9d52029913be62780a99069f06893e414a9b44f254d6d91',\n])\n\nexport interface BrandlabContactSpamFilterOptions {\n /** Extra sales-pitch phrases for this site (case-insensitive text or a RegExp); a match is the strong `pitch-site`. */\n readonly extraPhrases?: readonly (string | RegExp)[]\n /** Extra known spam senders, as SHA-256 hex of the trimmed, lower-case address. */\n readonly knownSenderHashes?: readonly string[]\n /** Signals this site does not count (to relax a rule). */\n readonly ignoreSignals?: readonly BrandlabContactSpamSignal[]\n /** The minimum fill time in milliseconds (the weak `fill-time` signal); 0 turns it off. Defaults to BRANDLAB_CONTACT_MIN_FILL_MS. */\n readonly minFillMs?: number\n}\n\n/** What the route knows about the submission itself, beside its field values. */\nexport interface BrandlabContactSpamContext {\n /** The form was sent under the minimum fill time (submittedTooFast): the weak `fill-time` signal. */\n readonly submittedTooFast?: boolean\n}\n\nexport interface BrandlabContactSpamAssessment {\n readonly blocked: boolean\n /** Every signal found, strong ones first, in a fixed order. */\n readonly signals: readonly BrandlabContactSpamSignal[]\n}\n\nconst STRONG = new Set<string>(BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS)\nconst PITCH_SIGNALS: readonly BrandlabContactSpamSignal[] = [\n 'pitch-marketing', 'pitch-reviews', 'pitch-estimating', 'pitch-outreach', 'pitch-email-lure', 'pitch-lure',\n]\n\n/** Letters with no Australian English use: mathematical, full-width, enclosed and small-capital forms. */\nconst LOOKALIKE_CHARACTERS =\n /[\\u{1D400}-\\u{1D7FF}A-Za-zⒶ-ⓩᴀ-ᴫɐ-ʯℂℊ-ℓℕℙ-ℝℤℬℭℯ-ℱℳℴ]/u\nconst LATIN_LETTER = /[A-Za-z]/\nconst CYRILLIC_OR_GREEK_LETTER = /[Ͱ-ϿЀ-ӿ]/\n\nconst PITCH_PATTERNS: Readonly<Record<string, readonly RegExp[]>> = {\n 'pitch-marketing': [\n /\\bseo\\b/,\n /\\bsearch engine optimi[sz]/,\n /\\b(?:first|1st|top) page (?:of|on) google\\b/,\n /\\bpage (?:1|one) (?:of|on) google\\b/,\n /\\b(?:google|search|website|organic) rankings?\\b/,\n /\\brank(?:ing)? (?:higher|better|#?1|first|on (?:the )?(?:first page|google))/,\n /\\borganic traffic\\b/,\n /\\bbacklinks?\\b/,\n /\\bdomain authority\\b/,\n /\\b(?:website|site|seo|free) audit\\b/,\n /\\bdigital marketing (?:agency|services|expert|specialist|strateg)/,\n /\\blead generation\\b/,\n /\\b(?:more|qualified|exclusive) leads (?:for|to) your\\b/,\n /\\bboost your (?:online |google |local )?(?:presence|visibility|sales|rankings?|traffic)\\b/,\n /\\b(?:redesign|revamp) (?:of )?your (?:website|site)\\b/,\n /\\bai (?:chat ?bot|agent|receptionist|voice|assistant|calling|automation)/,\n /\\b(?:google (?:my )?business|business) profile (?:optimi[sz]|management|ranking)/,\n /\\bsocial media (?:marketing|management)\\b/,\n /\\bweb ?(?:design|development) (?:services|agency|company)\\b/,\n /\\b(?:not (?:well )?optimi[sz]ed|optimi[sz]ed) for google\\b/,\n /\\bissue report (?:with|&|and) screenshot/,\n /\\b(?:seo|ranking) report\\b|\\baudit report (?:&|and) proposal\\b/,\n /\\bup in the (?:google )?rankings\\b/,\n /\\bimprove (?:these|your) search results\\b/,\n /\\bredesign mock-?up\\b/,\n /\\bmock-?up for you\\b/,\n /\\bhow your (?:site|website) could look\\b/,\n ],\n 'pitch-reviews': [\n /\\b(?:buy|purchase|get) (?:real |genuine |positive )?(?:google |5[- ]star |five[- ]star )reviews\\b/,\n /\\b(?:5|five)[- ]star (?:google )?reviews (?:for|to) your\\b/,\n /\\b(?:remove|delete|deleting|removing|removal of) (?:any |all |the |your )?(?:previous |old |bad |negative |fake )+reviews\\b/,\n /\\bnegative reviews (?:removed|deleted|removal)\\b/,\n /\\breviews? expert team\\b/,\n /\\breviews from local guides\\b/,\n /\\blocal guides?\\b.{0,60}\\breviews\\b/,\n /\\bincrease your (?:google )?(?:reviews|rating)\\b/,\n ],\n 'pitch-estimating': [\n /\\b(?:quantity |material |construction )?take-?offs?\\b/,\n /\\bestimating (?:services|firm|company|team|support)\\b/,\n /\\bcost estimat(?:ing|ion|or) (?:services|firm|company)\\b/,\n /\\boutsourced? estimat/,\n /\\bwe (?:provide|assist|offer|deliver|specialise|specialize|convert|prepare)\\b.{0,120}\\b(?:take-?offs?|estimat\\w*|bills? of quantities|material (?:lists?|counts?|breakdowns?)|labou?r (?:cost )?breakdowns?)/,\n /\\b(?:remote|rapid) (?:estimating|estimates|take-?offs?)\\b/,\n /\\bitemi[sz]ed (?:excel )?material lists?\\b|\\bline-item material counts?\\b/,\n /\\bplans into\\b.{0,40}\\bexcel\\b/,\n /\\b(?:assist|support|help) (?:construction businesses|trade contractors)\\b/,\n /\\btender (?:drawings|pricing|quotes)\\b.{0,60}\\b(?:like us to|on your desk|out the door|pricing up)\\b|\\bsupport with project measurements\\b/,\n /\\boverflow during busy\\b/,\n ],\n 'pitch-outreach': [\n /\\bare you the (?:business )?owner\\b/,\n /\\bwho (?:handles|manages|looks after|is in charge of) your (?:marketing|website|seo|online|advertising)\\b/,\n /\\bi(?:'m| am) reaching out (?:to|from|because|on behalf|regarding)\\b/,\n /\\bwe help (?:local |small |australian )?(?:businesses|companies|contractors|tradies|trades(?:people|men)?|plumbers|builders|electricians|roofers|landscapers|arborists)\\b/,\n /\\bwhite[- ]label\\b/,\n /\\boutsourc(?:e|ing) (?:your|services|solutions)\\b/,\n /\\bvirtual assistants?\\b/,\n /\\b(?:our|my) (?:agency|company|team|firm) (?:can help|specialises|specializes|helps|offers|provides)\\b/,\n /\\bfree (?:trial|demo|strategy (?:call|session)|consultation call)\\b/,\n /\\b(?:book|schedule) a (?:quick |short |free )?(?:call|demo|meeting) (?:with me|here|at)\\b/,\n /\\b(?:reply|respond) (?:with )?[\"']?stop[\"']? to (?:opt out|unsubscribe)\\b/,\n /\\bunsubscribe\\b/,\n /\\bnot relevant\\? reply\\b/,\n /\\b(?:i|we) won'?t contact you again\\b/,\n /\\b\\$?\\d+ off your first order\\b/,\n /\\bdomain(?: name)?\\b.{0,60}\\b(?:currently )?available for (?:sale|purchase)\\b/,\n /\\bbefore listing it publicly\\b/,\n ],\n 'pitch-email-lure': [\n /\\breach (?:me|us) (?:via|by|through|at|on) (?:my |our )?e-?mail\\b/,\n /\\bcontact (?:me|us) (?:only )?(?:via|by|through) (?:my |our )?e-?mail\\b/,\n /\\breply (?:to|via|by) (?:this |my |our )?e-?mail (?:for|if|to get|to receive)\\b/,\n /\\be-?mail (?:me|us) (?:for|to get|to receive) (?:more |the |a |our )?(?:details|info|information|pricing|proposal|price list|samples?|portfolio|case stud)/,\n /\\bkindly (?:reply|respond|revert|get back)\\b/,\n /\\bdrop (?:me|us) (?:a line|an e-?mail)\\b/,\n /\\b(?:i'?m|i am) interested in your services\\b.{0,40}\\b(?:reach|contact|e-?mail) me\\b/,\n /\\binformation about your services, design options, pricing\\b/,\n ],\n 'pitch-lure': [\n /\\bon behalf of\\b.{0,40}\\blawyer\\b/,\n /\\bshare with your team for review and assessment\\b/,\n /\\bwhether you are accepting new work\\b/,\n /\\bprovide the details required to prepare a full proposal\\b/,\n ],\n}\n\nconst MESSAGING_LINK = /\\b(?:wa\\.me\\/|api\\.whatsapp\\.com|chat\\.whatsapp\\.com|t\\.me\\/|telegram\\.me\\/)/\nconst MESSAGING_MENTION = /\\b(?:whats ?app|telegram)\\b/\nconst URL_PATTERN =\n /\\bhttps?:\\/\\/|\\bwww\\.|\\b[a-z0-9-]+\\.(?:com|net|org|io|co|agency|biz|info|online|site|xyz|ai|app|me|us|uk|in|pk|bd|ph|ng|store|tech|digital|marketing|solutions|services)\\b/\nconst EMAIL_PATTERN = /[^\\s@]+@[^\\s@]+\\.[^\\s@]+/g\nconst INTERNATIONAL_NUMBER = /(?:\\+|\\b00)\\s?(\\d[\\d\\s().-]{6,18}\\d)/g\n\nconst AUSTRALIAN_STATES = new Set(['nsw', 'vic', 'qld', 'sa', 'wa', 'tas', 'nt', 'act', 'au', 'aus', 'australia'])\nconst ABBREVIATIONS: Readonly<Record<string, string>> = {\n nth: 'north', sth: 'south', st: 'saint', mt: 'mount', pt: 'point', pk: 'park', hts: 'heights', stn: 'station',\n}\n/** Whole values that are clearly not Australian. Only unambiguous names: no place that also exists here (Manila NSW). */\nconst FOREIGN_PLACES = new Set([\n 'india', 'pakistan', 'bangladesh', 'nigeria', 'philippines', 'usa', 'us', 'united states', 'america', 'uk',\n 'united kingdom', 'england', 'scotland', 'ireland', 'canada', 'singapore', 'malaysia', 'indonesia', 'vietnam',\n 'thailand', 'nepal', 'sri lanka', 'kenya', 'ghana', 'egypt', 'uae', 'dubai', 'abu dhabi', 'qatar', 'saudi arabia',\n 'dhaka', 'chittagong', 'karachi', 'lahore', 'islamabad', 'delhi', 'new delhi', 'mumbai', 'bangalore', 'bengaluru',\n 'kolkata', 'chennai', 'hyderabad', 'pune', 'jaipur', 'ahmedabad', 'lagos', 'abuja', 'nairobi', 'cairo', 'cebu',\n 'quezon city', 'makati', 'jakarta', 'kuala lumpur', 'hanoi', 'ho chi minh', 'bangkok', 'kathmandu', 'colombo',\n 'london', 'manchester', 'birmingham', 'new york', 'los angeles', 'chicago', 'houston', 'miami', 'seattle',\n 'san francisco', 'las vegas', 'california', 'florida', 'toronto', 'vancouver', 'new jersey',\n])\n/** Values a real customer types when the suburb does not apply. */\nconst HARMLESS_VALUES = new Set(['na', 'n a', 'nil', 'none', 'tba', 'tbc', 'no', 'ok', 'x'])\nconst KEYBOARD_RUNS = ['qwer', 'wert', 'erty', 'asdf', 'sdfg', 'dfgh', 'fghj', 'ghjk', 'hjkl', 'zxcv', 'xcvb', 'cvbn', 'vbnm']\n\nlet placeIndex: Map<number, string[]> | undefined\nfunction placesByLength(): Map<number, string[]> {\n if (placeIndex) return placeIndex\n placeIndex = new Map()\n for (const name of BRANDLAB_SPAM_FILTER_PLACE_NAMES) {\n const list = placeIndex.get(name.length) ?? []\n list.push(name)\n placeIndex.set(name.length, list)\n }\n return placeIndex\n}\n\nfunction editDistanceWithin(a: string, b: string, limit: number): boolean {\n if (Math.abs(a.length - b.length) > limit) return false\n let previous = Array.from({ length: b.length + 1 }, (_, index) => index)\n for (let i = 1; i <= a.length; i += 1) {\n const current = [i]\n let rowMin = i\n for (let j = 1; j <= b.length; j += 1) {\n const cost = a[i - 1] === b[j - 1] ? 0 : 1\n const value = Math.min(previous[j]! + 1, current[j - 1]! + 1, previous[j - 1]! + cost)\n current.push(value)\n rowMin = Math.min(rowMin, value)\n }\n if (rowMin > limit) return false\n previous = current\n }\n return previous[b.length]! <= limit\n}\n\n/** True when the text is, or is a typo of, a Sydney or Central Coast place. */\nfunction nearKnownPlace(text: string): boolean {\n const limit = text.length >= 8 ? 2 : text.length >= 4 ? 1 : 0\n const index = placesByLength()\n for (let length = text.length - limit; length <= text.length + limit; length += 1) {\n for (const name of index.get(length) ?? []) {\n if (name === text || (limit > 0 && editDistanceWithin(text, name, limit))) return true\n }\n }\n return false\n}\n\nfunction looksRandom(word: string): boolean {\n if (word.length < 4) return false\n if (!/[aeiouy]/.test(word)) return true\n if (/[^aeiouy]{5,}/.test(word)) return true\n if (/(.)\\1{3,}/.test(word)) return true\n if (KEYBOARD_RUNS.some((run) => word.includes(run))) return true\n const vowels = word.replace(/[^aeiouy]/g, '').length\n return word.length >= 6 && vowels / word.length < 0.2\n}\n\n/**\n * Whether a typed suburb is clearly not an Australian place or is random characters. Typos of Sydney and Central\n * Coast places, abbreviations (\"Nth Ryde\", \"St Ives\", \"Mt Druitt\"), postcodes, state names and any ordinary-looking\n * word (an interstate town) all pass: only a foreign place, a two-letter code that is not a state, or keyboard mash\n * counts.\n */\nexport function isClearlyForeignOrRandomSuburb(value: string): boolean {\n const normalized = value\n .normalize('NFKD')\n .replace(/[̀-ͯ]/g, '')\n .toLowerCase()\n .replace(/[^a-z0-9\\s]/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim()\n if (!normalized || HARMLESS_VALUES.has(normalized)) return false\n if (FOREIGN_PLACES.has(normalized)) return true\n const words = normalized\n .split(' ')\n .filter((word) => !AUSTRALIAN_STATES.has(word) && !/^\\d{3,4}$/.test(word))\n .map((word) => ABBREVIATIONS[word] ?? word)\n if (words.length === 0) return false\n if (words.some((word) => /\\d/.test(word))) return false\n const text = words.join(' ')\n if (FOREIGN_PLACES.has(text)) return true\n if (normalized.length === 2) return !AUSTRALIAN_STATES.has(normalized)\n if (nearKnownPlace(text) || words.some((word) => word.length >= 4 && nearKnownPlace(word))) return false\n return words.every((word) => looksRandom(word) || word.length < 4) && words.some(looksRandom)\n}\n\nfunction normalizedText(value: string): string {\n return value\n .normalize('NFKC')\n .toLowerCase()\n .replace(/[‘’ʼ]/g, \"'\")\n .replace(/\\s+/g, ' ')\n}\n\nfunction hasLookalikeLetters(value: string): boolean {\n if (LOOKALIKE_CHARACTERS.test(value)) return true\n return value.split(/[\\s.,!?;:()\"'/-]+/).some(\n (word) => LATIN_LETTER.test(word) && CYRILLIC_OR_GREEK_LETTER.test(word),\n )\n}\n\nfunction overseasNumber(text: string): boolean {\n for (const match of text.matchAll(INTERNATIONAL_NUMBER)) {\n const digits = (match[1] ?? '').replace(/\\D/g, '')\n if (digits.length >= 8 && !digits.startsWith('61')) return true\n }\n return false\n}\n\nasync function sha256Hex(value: string): Promise<string> {\n const digest = await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(value))\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('')\n}\n\n/** The fields the filter reads, by their contract key (the form's field name), never an HTML id. */\nexport function contactSpamFieldsOf(fields: readonly Pick<ContactFieldDefinition, 'name' | 'role' | 'kind'>[]): {\n text: readonly string[]\n email?: string\n suburb?: string\n} {\n const text: string[] = []\n let email: string | undefined\n let suburb: string | undefined\n for (const field of fields) {\n if (field.role === 'email' || field.kind === 'email') email ??= field.name\n else if (field.role === 'location') {\n if (field.name.toLowerCase() === 'suburb') suburb = field.name\n } else if (field.role !== 'phone' && field.kind !== 'phone' && field.kind !== 'checkbox' && field.kind !== 'select') {\n text.push(field.name)\n }\n }\n return { text, ...(email ? { email } : {}), ...(suburb ? { suburb } : {}) }\n}\n\n/**\n * Scores one enquiry. `values` are the validated field values by field name; `fields` names which to read\n * (contactSpamFieldsOf). Pure apart from hashing the sender address.\n */\nexport async function assessBrandlabContactSpam(\n values: Readonly<Record<string, string | undefined>>,\n fields: ReturnType<typeof contactSpamFieldsOf>,\n options: BrandlabContactSpamFilterOptions = {},\n context: BrandlabContactSpamContext = {},\n): Promise<BrandlabContactSpamAssessment> {\n const found = new Set<BrandlabContactSpamSignal>()\n const raw = fields.text.map((name) => values[name] ?? '').filter(Boolean).join('\\n')\n const text = normalizedText(raw)\n const withoutEmails = text.replace(EMAIL_PATTERN, ' ')\n\n // A pitch usually trips several distinct phrases; each one past the first in a category counts as one more\n // signal, so a pure pitch with no link or odd suburb is still caught, while one phrase alone never blocks.\n let extraPitchHits = 0\n for (const [signal, patterns] of Object.entries(PITCH_PATTERNS)) {\n const hits = patterns.filter((pattern) => pattern.test(text)).length\n if (hits > 0) found.add(signal as BrandlabContactSpamSignal)\n extraPitchHits += Math.max(0, hits - 1)\n }\n for (const phrase of options.extraPhrases ?? []) {\n if (typeof phrase === 'string' ? text.includes(normalizedText(phrase)) : phrase.test(raw)) found.add('pitch-site')\n }\n if (MESSAGING_LINK.test(withoutEmails) || (MESSAGING_MENTION.test(text) && overseasNumber(text))) {\n found.add('messaging-link')\n }\n if (hasLookalikeLetters(raw)) found.add('lookalike-letters')\n const email = fields.email ? values[fields.email]?.trim().toLowerCase() : undefined\n if (email) {\n const hash = await sha256Hex(email)\n if (BRANDLAB_CONTACT_KNOWN_SPAM_SENDER_HASHES.includes(hash) || options.knownSenderHashes?.includes(hash)) {\n found.add('known-sender')\n }\n }\n if (URL_PATTERN.test(withoutEmails)) found.add('link')\n if (overseasNumber(text)) found.add('overseas-phone')\n const suburb = fields.suburb ? values[fields.suburb] : undefined\n if (suburb && isClearlyForeignOrRandomSuburb(suburb)) found.add('foreign-suburb')\n if (context.submittedTooFast) found.add('fill-time')\n\n for (const ignored of options.ignoreSignals ?? []) found.delete(ignored)\n if (!PITCH_SIGNALS.some((signal) => found.has(signal))) extraPitchHits = 0\n const order = [...BRANDLAB_CONTACT_STRONG_SPAM_SIGNALS, ...BRANDLAB_CONTACT_WEAK_SPAM_SIGNALS] as const\n const signals = order.filter((signal) => found.has(signal))\n const strong = signals.filter((signal) => STRONG.has(signal)).length\n return Object.freeze({\n blocked: strong >= 1 && signals.length + extraPitchHits >= 2,\n signals: Object.freeze(signals),\n })\n}\n\n/**\n * Whether the form was sent too soon after it rendered: both stamps are the visitor's own clock (`formStartedAt` when\n * the form's submission controller was created, `submittedAt` when it was sent), so clock skew cancels out. A form\n * without the start stamp (an older client or a hand-built form) is never dropped by this check.\n */\nexport function submittedTooFast(startedAt: string, submittedAt: string, minFillMs: number): boolean {\n if (!(minFillMs > 0) || !startedAt) return false\n const started = Date.parse(startedAt)\n const submitted = Date.parse(submittedAt)\n if (!Number.isFinite(started) || !Number.isFinite(submitted)) return false\n const elapsed = submitted - started\n return elapsed >= 0 && elapsed < minFillMs\n}\n"]}
@@ -4,5 +4,5 @@
4
4
  * that is a near miss of a real place ("Wahrooonga", "Nth Ryde") never counts as random characters. Generated from
5
5
  * `nswSuburbCentres` and the registries; regenerate when the registry grows.
6
6
  */
7
- export const BRANDLAB_SPAM_FILTER_PLACE_NAMES = Object.freeze('abbotsbury|abbotsford|acacia gardens|agnes banks|airds|alexandria|alfords point|alison|allambie heights|allawah|ambarvale|angus|annandale|annangrove|appin|arcadia|arncliffe|arndell park|artarmon|ashbury|ashcroft|ashfield|asquith|auburn|audley|austral|avalon beach|avoca beach|badgerys creek|balgowlah|balgowlah heights|balmain|balmain east|bangor|banksia|banksmeadow|bankstown|bankstown aerodrome|bar point|barangaroo|barden ridge|bardia|bardwell park|bardwell valley|bargo|barker|bass hill|bateau bay|baulkham hills|bayside council|bayview|beacon hill|beaconsfield|beaumont hills|beecroft|belfield|belimbla park|bella vista|bellevue hill|belmore|beloon|belrose|bensville|berala|berambing|berkeley vale|berkshire park|berowra|berowra heights|berowra waters|berrilee|beverley park|beverly hills|bexley|bexley north|bickley vale|bidwill|bilgola beach|bilgola plateau|bilpin|bimlow|bindook|birchgrove|birrabang|birrong|blackett|blackheath|blacktown|blacktown city council|blackwall|blair athol|blairmount|blakehurst|blaxland|blaxlands ridge|bligh park|blue bay|blue haven|blue labyrinth|blue mountains|blue mountains city council|blue mountains nsw|bondi|bondi beach|bondi junction|bonnet bay|bonnie vale|bonnyrigg|bonnyrigg heights|booker bay|bossley park|botany|bouddi|bow bowing|bowen mountain|box head|box hill|bradbury|bradfield|breakfast point|brereton|brighton le sands|brightonlesands|bringelly|bronte|brooklyn|brookvale|brownlow hill|budgewoi|budgewoi peninsula|buff point|bullaburra|bundeena|bungarribee|burragorang valley|burramoko|burraneer|burwood|burwood council|burwood heights|busby|bushells ridge|buxton|cabarita|cabramatta|cabramatta west|caddens|calga|cambridge gardens|cambridge park|camden|camden council|camden park|camden south|camellia|cammeray|campbelltown|campbelltown city council|camperdown|campsie|canada bay|canley heights|canley vale|canoelands|canterbury|canterbury bankstown council|canton beach|caringbah|caringbah south|carlingford|carlton|carmarthen|carnes hill|carramar|carss park|cartwright|castle cove|castle hill|castlecrag|castlereagh|casula|catherine field|cattai|cawdor|cecil hills|cecil park|cedar brush creek|centennial park|central coast|central coast council|central colo|central macdonald|central mangrove|chain valley bay|charmhaven|chatswood|chatswood west|cheero point|cheltenham|cherrybrook|chester hill|chifley|chippendale|chipping norton|chiswick|chittaway bay|chittaway point|chullora|church point|city of canada bay council|city of parramatta council|city of ryde|city of sydney|city of sydney council|claremont meadows|clarendon|clareville|claymore|clemton park|clontarf|clovelly|clyde|coasters retreat|cobbitty|cogra bay|colebee|collaroy|collaroy plateau|colo|colo heights|colongra|colyton|como|concord|concord west|condell park|connells point|constitution hill|coogee|copacabana|cornwallis|cottage point|couridjah|cowan|cranebrook|crangan bay|cremorne|cremorne point|cromer|cronulla|crows nest|croydon|croydon park|cumberland council|cumberland reach|curl curl|currans hill|currawong beach|daceyville|daleys point|dangar island|darling point|darlinghurst|darlington|davidson|davistown|dawes point|dean park|dee why|denham court|denistone|denistone east|denistone west|dharruk|dolans bay|dolls point|doonside|dooralong|double bay|douglas park|dover heights|doyalson|doyalson north|drummoyne|duffys forest|dulwich hill|dundas|dundas valley|dural|durren durren|eagle vale|earlwood|east gosford|east hills|east killara|east kurrajong|east lindfield|east ryde|eastern creek|eastern suburbs|eastern suburbs sydney|eastgardens|eastlakes|eastwood|ebenezer|edensor park|edgecliff|edmondson park|elanora heights|elderslie|elizabeth bay|elizabeth hills|ellis lane|elvina bay|emerton|empire bay|emu heights|emu plains|enfield|engadine|englorie park|enmore|epping|erina|erina heights|ermington|erskine park|erskineville|eschol park|ettalong beach|eveleigh|fairfield|fairfield city council|fairfield east|fairfield heights|fairfield west|fairlight|faulconbridge|fernances|fiddletown|five dock|forest glen|forest lodge|forestville|forresters beach|fountaindale|frazer park|freemans|freemans reach|frenchs forest|freshwater|gables|galston|garie|georges hall|georges river council|gilead|girraween|gladesville|glebe|gledswood hills|glen alpine|glenbrook|glendenning|glenfield|glenhaven|glenmore|glenmore park|glenning valley|glenorie|glenwood|glenworth valley|glossodia|goarra|gordon|gorokan|gosford|govetts|grantham farm|granville|grasmere|grays point|great mackerel beach|green point|green valley|greenacre|greendale|greenfield park|greengrove|greenhills beach|greenwich|gregory hills|greystanes|grose vale|grose wold|guildford|guildford west|gunderman|gwandalan|gymea|gymea bay|haberfield|halekulani|halloran|hamlyn terrace|hammondville|hardys bay|harrington park|harris park|hassall grove|hawkesbury city council|hawkesbury heights|haymarket|hazelbrook|heathcote|hebersham|heckenberg|henley|higher macdonald|hills district|hillsdale|hinchinbrook|hobartville|holgate|holroyd|holsworthy|homebush|homebush west|horningsea park|hornsby|hornsby heights|hornsby shire council|horsfield bay|horsley park|hoxton park|hunters hill|hunters hill council|huntingwood|huntleys cove|huntleys point|hurlstone park|hurstville|hurstville grove|illawong|ingar|ingleburn|ingleside|inner city sydney|inner west|inner west council|inner west sydney|jamison valley|jamisontown|jannali|jibbon|jilliby|jooriland|jordan springs|kangaroo point|kangy angy|kanwal|kareela|kariong|kariwoga|katoomba|kearns|kedumba|kellyville|kellyville ridge|kemps creek|kensington|kenthurst|kentlyn|kiar|killara|killarney heights|killarney vale|killcare|killcare heights|kincumber|kincumber south|kingfisher shores|kings langley|kings park|kingsford|kingsgrove|kingswood|kirkham|kirrawee|kirribilli|kogarah|kogarah bay|koolewong|kowmung|ku ring gai chase|kulnura|kuringgai chase|kuringgai council|kurmond|kurnell|kurraba point|kurrajong|kurrajong heights|kurrajong hills|kyeemagh|kyle bay|la perouse|lake haven|lake macquarie city council|lake munmorah|lakemba|lakesland|lalor park|lane cove|lane cove council|lane cove north|lane cove west|lansdowne|lansvale|lapstone|laughtondale|lavender bay|lawson|leets vale|leichhardt|lemon tree|len waters estate|leonay|leppington|lethbridge park|leumeah|leura|lewisham|liberty grove|lidcombe|lilli pilli|lilyfield|linden|lindfield|linley point|lisarow|little bay|little jilliby|little wobby|liverpool|liverpool city council|llandilo|loftus|londonderry|long jetty|long point|longueville|lovett bay|lower macdonald|lower mangrove|lower north shore|lower portland|lucas heights|luddenham|lugarno|lurnea|macarthur|macarthur region|macmasters beach|macquarie fields|macquarie links|macquarie park|magenta|maianbar|malabar|maldon|mangrove creek|mangrove mountain|manly|manly vale|mannering park|maraylya|marayong|mardi|marley|marlow|maroota|maroubra|marrickville|marsden park|marsfield|mascot|massif ridge|matcham|matraville|mays hill|mccarrs creek|mcgraths hill|mcmahons point|meadowbank|medlow bath|megalong valley|mellong|melonba|melrose park|menai|menangle|menangle park|merrylands|merrylands west|middle cove|middle dural|middleton grange|miller|millers point|milperra|milsons passage|milsons point|minchinbury|minto|minto heights|miranda|mogo creek|mona vale|monterey|moonee|mooney mooney|mooney mooney creek|moore park|moorebank|morning bay|mortdale|mortlake|mosman|mosman municipal council|mount annan|mount colah|mount druitt|mount elliot|mount hunter|mount irvine|mount kuring gai|mount kuringgai|mount lewis|mount portal|mount pritchard|mount riverview|mount tomah|mount vernon|mount victoria|mount white|mount wilson|mountain lagoon|mowbray park|mulgoa|mulgrave|narara|narellan|narellan vale|naremburn|narrabeen|narraweena|narrow neck|narwee|nattai|nelson|neutral bay|newington|newport|newtown|niagara park|nirimba fields|norah head|noraville|normanhurst|north avoca|north balgowlah|north bondi|north curl curl|north epping|north gosford|north kellyville|north manly|north narrabeen|north parramatta|north richmond|north rocks|north ryde|north shore|north shore sydney|north st marys|north strathfield|north sydney|north sydney council|north turramurra|north wahroonga|north willoughby|northbridge|northern beaches|northern beaches council|northern beaches sydney|northmead|northwood|norwest|oakdale|oakhurst|oakville|oatlands|oatley|old guildford|old toongabbie|oran park|orangeville|orchard hills|ourimbah|oxford falls|oxley park|oyster bay|paddington|padstow|padstow heights|pagewood|palm beach|palm grove|palmdale|palona|panania|parklea|parramatta|patonga|peakhurst|peakhurst heights|pearl beach|peats ridge|pemulwuy|pendle hill|pennant hills|penrith|penrith city council|penshurst|perrys crossing|petersham|pheasants nest|phegans bay|phillip bay|picketts valley|picnic point|picton|pitt town|pitt town bottoms|pittwater|pleasure point|plumpton|point clare|point frederick|point piper|point wolstoncroft|port botany|port hacking|potts hill|potts point|prairiewood|prestons|pretty beach|prospect|punchbowl|putney|pymble|pyrmont|quakers hill|queens park|queenscliff|raby|ramsgate|ramsgate beach|randwick|randwick city council|ravensdale|razorback|redfern|regents park|regentville|revesby|revesby heights|rhodes|richards|richmond|richmond lowlands|riverstone|riverview|riverwood|rockdale|rocklily ridge|rocky point|rodd point|rookwood|rooty hill|ropes crossing|rose bay|rosebery|rosehill|roselands|rosemeadow|roseville|roseville chase|rossmore|rouse hill|rozelle|ruse|rushcutters bay|russell lea|rydalmere|ryde|ryde and macquarie park|ryde area|sackville|sackville north|sadleir|san remo|sandringham|sandy point|sans souci|saratoga|scheyville|schofields|scotland island|seaforth|sefton|seven hills|shalvey|shanes park|shelly beach|silverdale|silverwater|singletons mill|smeaton grange|smithfield|somersby|south coogee|south granville|south hurstville|south maroota|south penrith|south turramurra|south wentworthville|south west sydney|south western sydney|south windsor|spencer|spring farm|springfield|springwood|st albans|st andrews|st clair|st george|st helens park|st huberts island|st ives|st ives chase|st johns park|st leonards|st marys|st peters|stanhope gardens|stanmore|strathfield|strathfield council|strathfield south|summer hill|summerland point|sun valley|surry hills|sutherland|sutherland shire|sutherland shire council|sydenham|sydney|sydney cbd|sydney city|sydney olympic park|sydney south west|sylvania|sylvania waters|tacoma|tacoma south|tahmoor|tallawong|tamarama|taren point|tascott|telopea|tempe|ten mile hollow|tennyson|tennyson point|terrey hills|terrigal|tesselate hill|the devils wilderness|the entrance|the entrance north|the hills district|the hills shire council|the oaks|the ponds|the rocks|the slopes|theresa park|thirlmere|thornleigh|toongabbie|toowoon bay|toukley|tregear|tuggerah|tuggerawong|tumbi umbi|turramurra|turrella|uloola|ultimo|umina beach|upper colo|upper macdonald|upper mangrove|upper north shore|valley heights|varroville|vaucluse|villawood|vineyard|voyager point|wadalba|wagstaffe|wahroonga|waitara|wakeley|wallacia|wallarah|wamberal|wareemba|warnervale|warragamba|warrawee|warriewood|warrimoo|warumbul|warwick farm|watanobbi|waterfall|waterloo|watsons bay|wattamolla|wattle grove|waverley|waverley council|waverton|webbs creek|wedderburn|wendoree park|wentworth falls|wentworth point|wentworthville|werombi|werrington|werrington county|werrington downs|west gosford|west hoxton|west pennant hills|west pymble|west ryde|western sydney|westleigh|westmead|wetherill park|whalan|whale beach|wheeler heights|wheeny creek|wilberforce|wiley park|willmot|willoughby|willoughby city council|willoughby east|wilton|windsor|windsor downs|winmalee|winston hills|wisemans ferry|wolli creek|wollondilly shire council|wollstonecraft|womerah|wondabyne|woodbine|woodcroft|woodford|woodpark|woollahra|woollahra municipal council|woolloomooloo|woolooware|woolwich|woongarrah|woronora|woronora heights|woy woy|woy woy bay|wrights creek|wybung|wyoming|wyong|wyong creek|wyongah|yagoona|yanderra|yarramalong|yarramundi|yarrawarrah|yattalunga|yellow rock|yenabilli|yennora|yerranderie|yowie bay|zetland'.split('|'));
7
+ export const BRANDLAB_SPAM_FILTER_PLACE_NAMES = Object.freeze('abbotsbury|abbotsford|acacia gardens|agnes banks|airds|alexandria|alfords point|alison|allambie heights|allawah|ambarvale|angus|annandale|annangrove|appin|arcadia|arncliffe|arndell park|artarmon|ashbury|ashcroft|ashfield|asquith|auburn|audley|austral|avalon beach|avoca beach|badgerys creek|balgowlah|balgowlah heights|balmain|balmain east|bangor|banksia|banksmeadow|bankstown|bankstown aerodrome|bar point|barangaroo|barden ridge|bardia|bardwell park|bardwell valley|bargo|barker|bass hill|bateau bay|baulkham hills|bayside council|bayview|beacon hill|beaconsfield|beaumont hills|beecroft|belfield|belimbla park|bella vista|bellevue hill|belmore|beloon|belrose|bensville|berala|berambing|berkeley vale|berkshire park|berowra|berowra heights|berowra waters|berrilee|beverley park|beverly hills|bexley|bexley north|bickley vale|bidwill|bilgola beach|bilgola plateau|bilpin|bimlow|bindook|birchgrove|birrabang|birrong|blackett|blackheath|blacktown|blacktown city council|blackwall|blair athol|blairmount|blakehurst|blaxland|blaxlands ridge|bligh park|blue bay|blue haven|blue labyrinth|blue mountains|blue mountains city council|blue mountains nsw|bondi|bondi beach|bondi junction|bonnet bay|bonnie vale|bonnyrigg|bonnyrigg heights|booker bay|bossley park|botany|bouddi|bow bowing|bowen mountain|box head|box hill|bradbury|bradfield|breakfast point|brereton|brighton le sands|brightonlesands|bringelly|bronte|brooklyn|brookvale|brownlow hill|budgewoi|budgewoi peninsula|buff point|bullaburra|bundeena|bungarribee|burragorang valley|burramoko|burraneer|burwood|burwood council|burwood heights|busby|bushells ridge|buxton|cabarita|cabramatta|cabramatta west|caddens|calga|cambridge gardens|cambridge park|camden|camden council|camden park|camden south|camellia|cammeray|campbelltown|campbelltown city council|camperdown|campsie|canada bay|canley heights|canley vale|canoelands|canterbury|canterbury bankstown council|canton beach|caringbah|caringbah south|carlingford|carlton|carmarthen|carnes hill|carramar|carss park|cartwright|castle cove|castle hill|castlecrag|castlereagh|casula|catherine field|cattai|cawdor|cecil hills|cecil park|cedar brush creek|centennial park|central coast|central coast council|central colo|central macdonald|central mangrove|chain valley bay|charmhaven|chatswood|chatswood west|cheero point|cheltenham|cherrybrook|chester hill|chifley|chippendale|chipping norton|chiswick|chittaway bay|chittaway point|chullora|church point|city of canada bay council|city of parramatta council|city of ryde|city of sydney|city of sydney council|claremont meadows|clarendon|clareville|claymore|clemton park|clontarf|clovelly|clyde|coasters retreat|cobbitty|cogra bay|colebee|collaroy|collaroy plateau|colo|colo heights|colongra|colyton|como|concord|concord west|condell park|connells point|constitution hill|coogee|copacabana|cornwallis|cottage point|couridjah|cowan|cranebrook|crangan bay|cremorne|cremorne point|cromer|cronulla|crows nest|croydon|croydon park|cumberland council|cumberland reach|curl curl|currans hill|currawong beach|daceyville|daleys point|dangar island|darling point|darlinghurst|darlington|davidson|davistown|dawes point|dean park|dee why|denham court|denistone|denistone east|denistone west|dharruk|dolans bay|dolls point|doonside|dooralong|double bay|douglas park|dover heights|doyalson|doyalson north|drummoyne|duffys forest|dulwich hill|dundas|dundas valley|dural|durren durren|eagle vale|earlwood|east gosford|east hills|east killara|east kurrajong|east lindfield|east ryde|eastern creek|eastern suburbs|eastern suburbs sydney|eastgardens|eastlakes|eastwood|ebenezer|edensor park|edgecliff|edmondson park|elanora heights|elderslie|elizabeth bay|elizabeth hills|ellis lane|elvina bay|emerton|empire bay|emu heights|emu plains|enfield|engadine|englorie park|enmore|epping|erina|erina heights|ermington|erskine park|erskineville|eschol park|ettalong beach|eveleigh|fairfield|fairfield city council|fairfield east|fairfield heights|fairfield west|fairlight|faulconbridge|fernances|fiddletown|five dock|forest glen|forest lodge|forestville|forresters beach|fountaindale|frazer park|freemans|freemans reach|frenchs forest|freshwater|gables|galston|garie|georges hall|georges river council|gilead|girraween|gladesville|glebe|gledswood hills|glen alpine|glenbrook|glendenning|glenfield|glenhaven|glenmore|glenmore park|glenning valley|glenorie|glenwood|glenworth valley|glossodia|goarra|gordon|gorokan|gosford|govetts|grantham farm|granville|grasmere|grays point|great mackerel beach|green point|green valley|greenacre|greendale|greenfield park|greengrove|greenhills beach|greenwich|gregory hills|greystanes|grose vale|grose wold|guildford|guildford west|gunderman|gwandalan|gymea|gymea bay|haberfield|halekulani|halloran|hamlyn terrace|hammondville|hardys bay|harrington park|harris park|hassall grove|hawkesbury city council|hawkesbury heights|haymarket|hazelbrook|heathcote|hebersham|heckenberg|henley|higher macdonald|hills district|hillsdale|hinchinbrook|hobartville|holgate|holroyd|holsworthy|homebush|homebush west|horningsea park|hornsby|hornsby heights|hornsby shire council|horsfield bay|horsley park|hoxton park|hunters hill|hunters hill council|huntingwood|huntleys cove|huntleys point|hurlstone park|hurstville|hurstville grove|illawong|ingar|ingleburn|ingleside|inner city sydney|inner west|inner west council|inner west sydney|jamison valley|jamisontown|jannali|jibbon|jilliby|jooriland|jordan springs|kangaroo point|kangy angy|kanwal|kareela|kariong|kariwoga|katoomba|kearns|kedumba|kellyville|kellyville ridge|kemps creek|kensington|kenthurst|kentlyn|kiar|killara|killarney heights|killarney vale|killcare|killcare heights|kincumber|kincumber south|kingfisher shores|kings langley|kings park|kingsford|kingsgrove|kingswood|kirkham|kirrawee|kirribilli|kogarah|kogarah bay|koolewong|kowmung|ku ring gai chase|kulnura|kuringgai chase|kuringgai council|kurmond|kurnell|kurraba point|kurrajong|kurrajong heights|kurrajong hills|kyeemagh|kyle bay|la perouse|lake haven|lake macquarie city council|lake munmorah|lakemba|lakesland|lalor park|lane cove|lane cove council|lane cove north|lane cove west|lansdowne|lansvale|lapstone|laughtondale|lavender bay|lawson|leets vale|leichhardt|lemon tree|len waters estate|leonay|leppington|lethbridge park|leumeah|leura|lewisham|liberty grove|lidcombe|lilli pilli|lilyfield|linden|lindfield|linley point|lisarow|little bay|little jilliby|little wobby|liverpool|liverpool city council|llandilo|loftus|londonderry|long jetty|long point|longueville|lovett bay|lower macdonald|lower mangrove|lower north shore|lower portland|lucas heights|luddenham|lugarno|lurnea|macarthur|macarthur region|macmasters beach|macquarie fields|macquarie links|macquarie park|magenta|maianbar|malabar|maldon|mangrove creek|mangrove mountain|manly|manly vale|mannering park|maraylya|marayong|mardi|marley|marlow|maroota|maroubra|marrickville|marsden park|marsfield|mascot|massif ridge|matcham|matraville|mays hill|mccarrs creek|mcgraths hill|mcmahons point|meadowbank|medlow bath|megalong valley|mellong|melonba|melrose park|menai|menangle|menangle park|merrylands|merrylands west|middle cove|middle dural|middleton grange|miller|millers point|milperra|milsons passage|milsons point|minchinbury|minto|minto heights|miranda|mogo creek|mona vale|monterey|moonee|mooney mooney|mooney mooney creek|moore park|moorebank|morning bay|mortdale|mortlake|mosman|mosman municipal council|mount annan|mount colah|mount druitt|mount elliot|mount hunter|mount irvine|mount kuring gai|mount kuringgai|mount lewis|mount portal|mount pritchard|mount riverview|mount tomah|mount vernon|mount victoria|mount white|mount wilson|mountain lagoon|mowbray park|mulgoa|mulgrave|narara|narellan|narellan vale|naremburn|narrabeen|narraweena|narrow neck|narwee|nattai|nelson|neutral bay|newington|newport|newtown|niagara park|nirimba fields|norah head|noraville|normanhurst|north avoca|north balgowlah|north bondi|north curl curl|north epping|north gosford|north kellyville|north manly|north narrabeen|north parramatta|north richmond|north rocks|north ryde|north shore|north shore sydney|north st marys|north strathfield|north sydney|north sydney council|north turramurra|north wahroonga|north willoughby|northbridge|northern beaches|northern beaches council|northern beaches sydney|northmead|northwood|norwest|oakdale|oakhurst|oakville|oatlands|oatley|old guildford|old toongabbie|oran park|orangeville|orchard hills|ourimbah|oxford falls|oxley park|oyster bay|paddington|padstow|padstow heights|pagewood|palm beach|palm grove|palmdale|palona|panania|parklea|parramatta|patonga|peakhurst|peakhurst heights|pearl beach|peats ridge|pemulwuy|pendle hill|pennant hills|penrith|penrith city council|penshurst|perrys crossing|petersham|pheasants nest|phegans bay|phillip bay|picketts valley|picnic point|picton|pitt town|pitt town bottoms|pittwater|pleasure point|plumpton|point clare|point frederick|point piper|point wolstoncroft|port botany|port hacking|potts hill|potts point|prairiewood|prestons|pretty beach|prospect|punchbowl|putney|pymble|pyrmont|quakers hill|queens park|queenscliff|raby|ramsgate|ramsgate beach|randwick|randwick city council|ravensdale|razorback|redfern|regents park|regentville|revesby|revesby heights|rhodes|richards|richmond|richmond lowlands|riverstone|riverview|riverwood|rockdale|rocklily ridge|rocky point|rodd point|rookwood|rooty hill|ropes crossing|rose bay|rosebery|rosehill|roselands|rosemeadow|roseville|roseville chase|rossmore|rouse hill|rozelle|ruse|rushcutters bay|russell lea|rydalmere|ryde|ryde and macquarie park|ryde area|sackville|sackville north|sadleir|san remo|sandringham|sandy point|sans souci|saratoga|scheyville|schofields|scotland island|seaforth|sefton|seven hills|shalvey|shanes park|shelly beach|silverdale|silverwater|singletons mill|smeaton grange|smithfield|somersby|south coogee|south granville|south hurstville|south maroota|south penrith|south turramurra|south wentworthville|south west sydney|south western sydney|south windsor|spencer|spring farm|springfield|springwood|st albans|st andrews|st clair|st george|st helens park|st huberts island|st ives|st ives chase|st johns park|st leonards|st marys|st peters|stanhope gardens|stanmore|strathfield|strathfield council|strathfield south|summer hill|summerland point|sun valley|surry hills|sutherland|sutherland shire|sutherland shire council|sydenham|sydney|sydney cbd|sydney city|sydney olympic park|sydney south west|sylvania|sylvania waters|tacoma|tacoma south|tahmoor|tallawong|tamarama|taren point|tascott|telopea|tempe|ten mile hollow|tennyson|tennyson point|terrey hills|terrigal|tesselate hill|the devils wilderness|the entrance|the entrance north|the hills district|the hills shire council|the oaks|the ponds|the rocks|the slopes|theresa park|thirlmere|thornleigh|toongabbie|toowoon bay|toukley|tregear|tuggerah|tuggerawong|tumbi umbi|turramurra|turrella|uloola|ultimo|umina beach|upper colo|upper macdonald|upper mangrove|upper north shore|valley heights|varroville|vaucluse|villawood|vineyard|voyager point|wadalba|wagstaffe|wahroonga|waitara|wakeley|wallacia|wallarah|wamberal|wareemba|warnervale|warragamba|warrawee|warriewood|warrimoo|warumbul|warwick farm|watanobbi|waterfall|waterloo|watsons bay|wattamolla|wattle grove|waverley|waverley council|waverton|webbs creek|wedderburn|wendoree park|wentworth falls|wentworth point|wentworthville|werombi|werrington|werrington county|werrington downs|west gosford|west hoxton|west pennant hills|west pymble|west ryde|western sydney|westleigh|westmead|wetherill park|whalan|whale beach|wheeler heights|wheeny creek|wilberforce|wiley park|willmot|willoughby|willoughby city council|willoughby east|wilton|windsor|windsor downs|wingecarribee shire council|winmalee|winston hills|wisemans ferry|wolli creek|wollondilly shire council|wollstonecraft|womerah|wondabyne|woodbine|woodcroft|woodford|woodpark|woollahra|woollahra municipal council|woolloomooloo|woolooware|woolwich|woongarrah|woronora|woronora heights|woy woy|woy woy bay|wrights creek|wybung|wyoming|wyong|wyong creek|wyongah|yagoona|yanderra|yarramalong|yarramundi|yarrawarrah|yattalunga|yellow rock|yenabilli|yennora|yerranderie|yowie bay|zetland'.split('|'));
8
8
  //# sourceMappingURL=spam-places.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spam-places.js","sourceRoot":"","sources":["../../src/contact/spam-places.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAsB,MAAM,CAAC,MAAM,CAC9E,+4XAA+4X,CAAC,KAAK,CAAC,GAAG,CAAC,CAC35X,CAAA","sourcesContent":["/**\n * Sydney and Central Coast place names (suburbs, regions, councils and their alternate names) from site-core's\n * geography registry, lower case with letters and spaces only. The contact spam filter uses them so a typed suburb\n * that is a near miss of a real place (\"Wahrooonga\", \"Nth Ryde\") never counts as random characters. Generated from\n * `nswSuburbCentres` and the registries; regenerate when the registry grows.\n */\nexport const BRANDLAB_SPAM_FILTER_PLACE_NAMES: readonly string[] = Object.freeze(\n 'abbotsbury|abbotsford|acacia gardens|agnes banks|airds|alexandria|alfords point|alison|allambie heights|allawah|ambarvale|angus|annandale|annangrove|appin|arcadia|arncliffe|arndell park|artarmon|ashbury|ashcroft|ashfield|asquith|auburn|audley|austral|avalon beach|avoca beach|badgerys creek|balgowlah|balgowlah heights|balmain|balmain east|bangor|banksia|banksmeadow|bankstown|bankstown aerodrome|bar point|barangaroo|barden ridge|bardia|bardwell park|bardwell valley|bargo|barker|bass hill|bateau bay|baulkham hills|bayside council|bayview|beacon hill|beaconsfield|beaumont hills|beecroft|belfield|belimbla park|bella vista|bellevue hill|belmore|beloon|belrose|bensville|berala|berambing|berkeley vale|berkshire park|berowra|berowra heights|berowra waters|berrilee|beverley park|beverly hills|bexley|bexley north|bickley vale|bidwill|bilgola beach|bilgola plateau|bilpin|bimlow|bindook|birchgrove|birrabang|birrong|blackett|blackheath|blacktown|blacktown city council|blackwall|blair athol|blairmount|blakehurst|blaxland|blaxlands ridge|bligh park|blue bay|blue haven|blue labyrinth|blue mountains|blue mountains city council|blue mountains nsw|bondi|bondi beach|bondi junction|bonnet bay|bonnie vale|bonnyrigg|bonnyrigg heights|booker bay|bossley park|botany|bouddi|bow bowing|bowen mountain|box head|box hill|bradbury|bradfield|breakfast point|brereton|brighton le sands|brightonlesands|bringelly|bronte|brooklyn|brookvale|brownlow hill|budgewoi|budgewoi peninsula|buff point|bullaburra|bundeena|bungarribee|burragorang valley|burramoko|burraneer|burwood|burwood council|burwood heights|busby|bushells ridge|buxton|cabarita|cabramatta|cabramatta west|caddens|calga|cambridge gardens|cambridge park|camden|camden council|camden park|camden south|camellia|cammeray|campbelltown|campbelltown city council|camperdown|campsie|canada bay|canley heights|canley vale|canoelands|canterbury|canterbury bankstown council|canton beach|caringbah|caringbah south|carlingford|carlton|carmarthen|carnes hill|carramar|carss park|cartwright|castle cove|castle hill|castlecrag|castlereagh|casula|catherine field|cattai|cawdor|cecil hills|cecil park|cedar brush creek|centennial park|central coast|central coast council|central colo|central macdonald|central mangrove|chain valley bay|charmhaven|chatswood|chatswood west|cheero point|cheltenham|cherrybrook|chester hill|chifley|chippendale|chipping norton|chiswick|chittaway bay|chittaway point|chullora|church point|city of canada bay council|city of parramatta council|city of ryde|city of sydney|city of sydney council|claremont meadows|clarendon|clareville|claymore|clemton park|clontarf|clovelly|clyde|coasters retreat|cobbitty|cogra bay|colebee|collaroy|collaroy plateau|colo|colo heights|colongra|colyton|como|concord|concord west|condell park|connells point|constitution hill|coogee|copacabana|cornwallis|cottage point|couridjah|cowan|cranebrook|crangan bay|cremorne|cremorne point|cromer|cronulla|crows nest|croydon|croydon park|cumberland council|cumberland reach|curl curl|currans hill|currawong beach|daceyville|daleys point|dangar island|darling point|darlinghurst|darlington|davidson|davistown|dawes point|dean park|dee why|denham court|denistone|denistone east|denistone west|dharruk|dolans bay|dolls point|doonside|dooralong|double bay|douglas park|dover heights|doyalson|doyalson north|drummoyne|duffys forest|dulwich hill|dundas|dundas valley|dural|durren durren|eagle vale|earlwood|east gosford|east hills|east killara|east kurrajong|east lindfield|east ryde|eastern creek|eastern suburbs|eastern suburbs sydney|eastgardens|eastlakes|eastwood|ebenezer|edensor park|edgecliff|edmondson park|elanora heights|elderslie|elizabeth bay|elizabeth hills|ellis lane|elvina bay|emerton|empire bay|emu heights|emu plains|enfield|engadine|englorie park|enmore|epping|erina|erina heights|ermington|erskine park|erskineville|eschol park|ettalong beach|eveleigh|fairfield|fairfield city council|fairfield east|fairfield heights|fairfield west|fairlight|faulconbridge|fernances|fiddletown|five dock|forest glen|forest lodge|forestville|forresters beach|fountaindale|frazer park|freemans|freemans reach|frenchs forest|freshwater|gables|galston|garie|georges hall|georges river council|gilead|girraween|gladesville|glebe|gledswood hills|glen alpine|glenbrook|glendenning|glenfield|glenhaven|glenmore|glenmore park|glenning valley|glenorie|glenwood|glenworth valley|glossodia|goarra|gordon|gorokan|gosford|govetts|grantham farm|granville|grasmere|grays point|great mackerel beach|green point|green valley|greenacre|greendale|greenfield park|greengrove|greenhills beach|greenwich|gregory hills|greystanes|grose vale|grose wold|guildford|guildford west|gunderman|gwandalan|gymea|gymea bay|haberfield|halekulani|halloran|hamlyn terrace|hammondville|hardys bay|harrington park|harris park|hassall grove|hawkesbury city council|hawkesbury heights|haymarket|hazelbrook|heathcote|hebersham|heckenberg|henley|higher macdonald|hills district|hillsdale|hinchinbrook|hobartville|holgate|holroyd|holsworthy|homebush|homebush west|horningsea park|hornsby|hornsby heights|hornsby shire council|horsfield bay|horsley park|hoxton park|hunters hill|hunters hill council|huntingwood|huntleys cove|huntleys point|hurlstone park|hurstville|hurstville grove|illawong|ingar|ingleburn|ingleside|inner city sydney|inner west|inner west council|inner west sydney|jamison valley|jamisontown|jannali|jibbon|jilliby|jooriland|jordan springs|kangaroo point|kangy angy|kanwal|kareela|kariong|kariwoga|katoomba|kearns|kedumba|kellyville|kellyville ridge|kemps creek|kensington|kenthurst|kentlyn|kiar|killara|killarney heights|killarney vale|killcare|killcare heights|kincumber|kincumber south|kingfisher shores|kings langley|kings park|kingsford|kingsgrove|kingswood|kirkham|kirrawee|kirribilli|kogarah|kogarah bay|koolewong|kowmung|ku ring gai chase|kulnura|kuringgai chase|kuringgai council|kurmond|kurnell|kurraba point|kurrajong|kurrajong heights|kurrajong hills|kyeemagh|kyle bay|la perouse|lake haven|lake macquarie city council|lake munmorah|lakemba|lakesland|lalor park|lane cove|lane cove council|lane cove north|lane cove west|lansdowne|lansvale|lapstone|laughtondale|lavender bay|lawson|leets vale|leichhardt|lemon tree|len waters estate|leonay|leppington|lethbridge park|leumeah|leura|lewisham|liberty grove|lidcombe|lilli pilli|lilyfield|linden|lindfield|linley point|lisarow|little bay|little jilliby|little wobby|liverpool|liverpool city council|llandilo|loftus|londonderry|long jetty|long point|longueville|lovett bay|lower macdonald|lower mangrove|lower north shore|lower portland|lucas heights|luddenham|lugarno|lurnea|macarthur|macarthur region|macmasters beach|macquarie fields|macquarie links|macquarie park|magenta|maianbar|malabar|maldon|mangrove creek|mangrove mountain|manly|manly vale|mannering park|maraylya|marayong|mardi|marley|marlow|maroota|maroubra|marrickville|marsden park|marsfield|mascot|massif ridge|matcham|matraville|mays hill|mccarrs creek|mcgraths hill|mcmahons point|meadowbank|medlow bath|megalong valley|mellong|melonba|melrose park|menai|menangle|menangle park|merrylands|merrylands west|middle cove|middle dural|middleton grange|miller|millers point|milperra|milsons passage|milsons point|minchinbury|minto|minto heights|miranda|mogo creek|mona vale|monterey|moonee|mooney mooney|mooney mooney creek|moore park|moorebank|morning bay|mortdale|mortlake|mosman|mosman municipal council|mount annan|mount colah|mount druitt|mount elliot|mount hunter|mount irvine|mount kuring gai|mount kuringgai|mount lewis|mount portal|mount pritchard|mount riverview|mount tomah|mount vernon|mount victoria|mount white|mount wilson|mountain lagoon|mowbray park|mulgoa|mulgrave|narara|narellan|narellan vale|naremburn|narrabeen|narraweena|narrow neck|narwee|nattai|nelson|neutral bay|newington|newport|newtown|niagara park|nirimba fields|norah head|noraville|normanhurst|north avoca|north balgowlah|north bondi|north curl curl|north epping|north gosford|north kellyville|north manly|north narrabeen|north parramatta|north richmond|north rocks|north ryde|north shore|north shore sydney|north st marys|north strathfield|north sydney|north sydney council|north turramurra|north wahroonga|north willoughby|northbridge|northern beaches|northern beaches council|northern beaches sydney|northmead|northwood|norwest|oakdale|oakhurst|oakville|oatlands|oatley|old guildford|old toongabbie|oran park|orangeville|orchard hills|ourimbah|oxford falls|oxley park|oyster bay|paddington|padstow|padstow heights|pagewood|palm beach|palm grove|palmdale|palona|panania|parklea|parramatta|patonga|peakhurst|peakhurst heights|pearl beach|peats ridge|pemulwuy|pendle hill|pennant hills|penrith|penrith city council|penshurst|perrys crossing|petersham|pheasants nest|phegans bay|phillip bay|picketts valley|picnic point|picton|pitt town|pitt town bottoms|pittwater|pleasure point|plumpton|point clare|point frederick|point piper|point wolstoncroft|port botany|port hacking|potts hill|potts point|prairiewood|prestons|pretty beach|prospect|punchbowl|putney|pymble|pyrmont|quakers hill|queens park|queenscliff|raby|ramsgate|ramsgate beach|randwick|randwick city council|ravensdale|razorback|redfern|regents park|regentville|revesby|revesby heights|rhodes|richards|richmond|richmond lowlands|riverstone|riverview|riverwood|rockdale|rocklily ridge|rocky point|rodd point|rookwood|rooty hill|ropes crossing|rose bay|rosebery|rosehill|roselands|rosemeadow|roseville|roseville chase|rossmore|rouse hill|rozelle|ruse|rushcutters bay|russell lea|rydalmere|ryde|ryde and macquarie park|ryde area|sackville|sackville north|sadleir|san remo|sandringham|sandy point|sans souci|saratoga|scheyville|schofields|scotland island|seaforth|sefton|seven hills|shalvey|shanes park|shelly beach|silverdale|silverwater|singletons mill|smeaton grange|smithfield|somersby|south coogee|south granville|south hurstville|south maroota|south penrith|south turramurra|south wentworthville|south west sydney|south western sydney|south windsor|spencer|spring farm|springfield|springwood|st albans|st andrews|st clair|st george|st helens park|st huberts island|st ives|st ives chase|st johns park|st leonards|st marys|st peters|stanhope gardens|stanmore|strathfield|strathfield council|strathfield south|summer hill|summerland point|sun valley|surry hills|sutherland|sutherland shire|sutherland shire council|sydenham|sydney|sydney cbd|sydney city|sydney olympic park|sydney south west|sylvania|sylvania waters|tacoma|tacoma south|tahmoor|tallawong|tamarama|taren point|tascott|telopea|tempe|ten mile hollow|tennyson|tennyson point|terrey hills|terrigal|tesselate hill|the devils wilderness|the entrance|the entrance north|the hills district|the hills shire council|the oaks|the ponds|the rocks|the slopes|theresa park|thirlmere|thornleigh|toongabbie|toowoon bay|toukley|tregear|tuggerah|tuggerawong|tumbi umbi|turramurra|turrella|uloola|ultimo|umina beach|upper colo|upper macdonald|upper mangrove|upper north shore|valley heights|varroville|vaucluse|villawood|vineyard|voyager point|wadalba|wagstaffe|wahroonga|waitara|wakeley|wallacia|wallarah|wamberal|wareemba|warnervale|warragamba|warrawee|warriewood|warrimoo|warumbul|warwick farm|watanobbi|waterfall|waterloo|watsons bay|wattamolla|wattle grove|waverley|waverley council|waverton|webbs creek|wedderburn|wendoree park|wentworth falls|wentworth point|wentworthville|werombi|werrington|werrington county|werrington downs|west gosford|west hoxton|west pennant hills|west pymble|west ryde|western sydney|westleigh|westmead|wetherill park|whalan|whale beach|wheeler heights|wheeny creek|wilberforce|wiley park|willmot|willoughby|willoughby city council|willoughby east|wilton|windsor|windsor downs|winmalee|winston hills|wisemans ferry|wolli creek|wollondilly shire council|wollstonecraft|womerah|wondabyne|woodbine|woodcroft|woodford|woodpark|woollahra|woollahra municipal council|woolloomooloo|woolooware|woolwich|woongarrah|woronora|woronora heights|woy woy|woy woy bay|wrights creek|wybung|wyoming|wyong|wyong creek|wyongah|yagoona|yanderra|yarramalong|yarramundi|yarrawarrah|yattalunga|yellow rock|yenabilli|yennora|yerranderie|yowie bay|zetland'.split('|'),\n)\n"]}
1
+ {"version":3,"file":"spam-places.js","sourceRoot":"","sources":["../../src/contact/spam-places.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAsB,MAAM,CAAC,MAAM,CAC9E,26XAA26X,CAAC,KAAK,CAAC,GAAG,CAAC,CACv7X,CAAA","sourcesContent":["/**\n * Sydney and Central Coast place names (suburbs, regions, councils and their alternate names) from site-core's\n * geography registry, lower case with letters and spaces only. The contact spam filter uses them so a typed suburb\n * that is a near miss of a real place (\"Wahrooonga\", \"Nth Ryde\") never counts as random characters. Generated from\n * `nswSuburbCentres` and the registries; regenerate when the registry grows.\n */\nexport const BRANDLAB_SPAM_FILTER_PLACE_NAMES: readonly string[] = Object.freeze(\n 'abbotsbury|abbotsford|acacia gardens|agnes banks|airds|alexandria|alfords point|alison|allambie heights|allawah|ambarvale|angus|annandale|annangrove|appin|arcadia|arncliffe|arndell park|artarmon|ashbury|ashcroft|ashfield|asquith|auburn|audley|austral|avalon beach|avoca beach|badgerys creek|balgowlah|balgowlah heights|balmain|balmain east|bangor|banksia|banksmeadow|bankstown|bankstown aerodrome|bar point|barangaroo|barden ridge|bardia|bardwell park|bardwell valley|bargo|barker|bass hill|bateau bay|baulkham hills|bayside council|bayview|beacon hill|beaconsfield|beaumont hills|beecroft|belfield|belimbla park|bella vista|bellevue hill|belmore|beloon|belrose|bensville|berala|berambing|berkeley vale|berkshire park|berowra|berowra heights|berowra waters|berrilee|beverley park|beverly hills|bexley|bexley north|bickley vale|bidwill|bilgola beach|bilgola plateau|bilpin|bimlow|bindook|birchgrove|birrabang|birrong|blackett|blackheath|blacktown|blacktown city council|blackwall|blair athol|blairmount|blakehurst|blaxland|blaxlands ridge|bligh park|blue bay|blue haven|blue labyrinth|blue mountains|blue mountains city council|blue mountains nsw|bondi|bondi beach|bondi junction|bonnet bay|bonnie vale|bonnyrigg|bonnyrigg heights|booker bay|bossley park|botany|bouddi|bow bowing|bowen mountain|box head|box hill|bradbury|bradfield|breakfast point|brereton|brighton le sands|brightonlesands|bringelly|bronte|brooklyn|brookvale|brownlow hill|budgewoi|budgewoi peninsula|buff point|bullaburra|bundeena|bungarribee|burragorang valley|burramoko|burraneer|burwood|burwood council|burwood heights|busby|bushells ridge|buxton|cabarita|cabramatta|cabramatta west|caddens|calga|cambridge gardens|cambridge park|camden|camden council|camden park|camden south|camellia|cammeray|campbelltown|campbelltown city council|camperdown|campsie|canada bay|canley heights|canley vale|canoelands|canterbury|canterbury bankstown council|canton beach|caringbah|caringbah south|carlingford|carlton|carmarthen|carnes hill|carramar|carss park|cartwright|castle cove|castle hill|castlecrag|castlereagh|casula|catherine field|cattai|cawdor|cecil hills|cecil park|cedar brush creek|centennial park|central coast|central coast council|central colo|central macdonald|central mangrove|chain valley bay|charmhaven|chatswood|chatswood west|cheero point|cheltenham|cherrybrook|chester hill|chifley|chippendale|chipping norton|chiswick|chittaway bay|chittaway point|chullora|church point|city of canada bay council|city of parramatta council|city of ryde|city of sydney|city of sydney council|claremont meadows|clarendon|clareville|claymore|clemton park|clontarf|clovelly|clyde|coasters retreat|cobbitty|cogra bay|colebee|collaroy|collaroy plateau|colo|colo heights|colongra|colyton|como|concord|concord west|condell park|connells point|constitution hill|coogee|copacabana|cornwallis|cottage point|couridjah|cowan|cranebrook|crangan bay|cremorne|cremorne point|cromer|cronulla|crows nest|croydon|croydon park|cumberland council|cumberland reach|curl curl|currans hill|currawong beach|daceyville|daleys point|dangar island|darling point|darlinghurst|darlington|davidson|davistown|dawes point|dean park|dee why|denham court|denistone|denistone east|denistone west|dharruk|dolans bay|dolls point|doonside|dooralong|double bay|douglas park|dover heights|doyalson|doyalson north|drummoyne|duffys forest|dulwich hill|dundas|dundas valley|dural|durren durren|eagle vale|earlwood|east gosford|east hills|east killara|east kurrajong|east lindfield|east ryde|eastern creek|eastern suburbs|eastern suburbs sydney|eastgardens|eastlakes|eastwood|ebenezer|edensor park|edgecliff|edmondson park|elanora heights|elderslie|elizabeth bay|elizabeth hills|ellis lane|elvina bay|emerton|empire bay|emu heights|emu plains|enfield|engadine|englorie park|enmore|epping|erina|erina heights|ermington|erskine park|erskineville|eschol park|ettalong beach|eveleigh|fairfield|fairfield city council|fairfield east|fairfield heights|fairfield west|fairlight|faulconbridge|fernances|fiddletown|five dock|forest glen|forest lodge|forestville|forresters beach|fountaindale|frazer park|freemans|freemans reach|frenchs forest|freshwater|gables|galston|garie|georges hall|georges river council|gilead|girraween|gladesville|glebe|gledswood hills|glen alpine|glenbrook|glendenning|glenfield|glenhaven|glenmore|glenmore park|glenning valley|glenorie|glenwood|glenworth valley|glossodia|goarra|gordon|gorokan|gosford|govetts|grantham farm|granville|grasmere|grays point|great mackerel beach|green point|green valley|greenacre|greendale|greenfield park|greengrove|greenhills beach|greenwich|gregory hills|greystanes|grose vale|grose wold|guildford|guildford west|gunderman|gwandalan|gymea|gymea bay|haberfield|halekulani|halloran|hamlyn terrace|hammondville|hardys bay|harrington park|harris park|hassall grove|hawkesbury city council|hawkesbury heights|haymarket|hazelbrook|heathcote|hebersham|heckenberg|henley|higher macdonald|hills district|hillsdale|hinchinbrook|hobartville|holgate|holroyd|holsworthy|homebush|homebush west|horningsea park|hornsby|hornsby heights|hornsby shire council|horsfield bay|horsley park|hoxton park|hunters hill|hunters hill council|huntingwood|huntleys cove|huntleys point|hurlstone park|hurstville|hurstville grove|illawong|ingar|ingleburn|ingleside|inner city sydney|inner west|inner west council|inner west sydney|jamison valley|jamisontown|jannali|jibbon|jilliby|jooriland|jordan springs|kangaroo point|kangy angy|kanwal|kareela|kariong|kariwoga|katoomba|kearns|kedumba|kellyville|kellyville ridge|kemps creek|kensington|kenthurst|kentlyn|kiar|killara|killarney heights|killarney vale|killcare|killcare heights|kincumber|kincumber south|kingfisher shores|kings langley|kings park|kingsford|kingsgrove|kingswood|kirkham|kirrawee|kirribilli|kogarah|kogarah bay|koolewong|kowmung|ku ring gai chase|kulnura|kuringgai chase|kuringgai council|kurmond|kurnell|kurraba point|kurrajong|kurrajong heights|kurrajong hills|kyeemagh|kyle bay|la perouse|lake haven|lake macquarie city council|lake munmorah|lakemba|lakesland|lalor park|lane cove|lane cove council|lane cove north|lane cove west|lansdowne|lansvale|lapstone|laughtondale|lavender bay|lawson|leets vale|leichhardt|lemon tree|len waters estate|leonay|leppington|lethbridge park|leumeah|leura|lewisham|liberty grove|lidcombe|lilli pilli|lilyfield|linden|lindfield|linley point|lisarow|little bay|little jilliby|little wobby|liverpool|liverpool city council|llandilo|loftus|londonderry|long jetty|long point|longueville|lovett bay|lower macdonald|lower mangrove|lower north shore|lower portland|lucas heights|luddenham|lugarno|lurnea|macarthur|macarthur region|macmasters beach|macquarie fields|macquarie links|macquarie park|magenta|maianbar|malabar|maldon|mangrove creek|mangrove mountain|manly|manly vale|mannering park|maraylya|marayong|mardi|marley|marlow|maroota|maroubra|marrickville|marsden park|marsfield|mascot|massif ridge|matcham|matraville|mays hill|mccarrs creek|mcgraths hill|mcmahons point|meadowbank|medlow bath|megalong valley|mellong|melonba|melrose park|menai|menangle|menangle park|merrylands|merrylands west|middle cove|middle dural|middleton grange|miller|millers point|milperra|milsons passage|milsons point|minchinbury|minto|minto heights|miranda|mogo creek|mona vale|monterey|moonee|mooney mooney|mooney mooney creek|moore park|moorebank|morning bay|mortdale|mortlake|mosman|mosman municipal council|mount annan|mount colah|mount druitt|mount elliot|mount hunter|mount irvine|mount kuring gai|mount kuringgai|mount lewis|mount portal|mount pritchard|mount riverview|mount tomah|mount vernon|mount victoria|mount white|mount wilson|mountain lagoon|mowbray park|mulgoa|mulgrave|narara|narellan|narellan vale|naremburn|narrabeen|narraweena|narrow neck|narwee|nattai|nelson|neutral bay|newington|newport|newtown|niagara park|nirimba fields|norah head|noraville|normanhurst|north avoca|north balgowlah|north bondi|north curl curl|north epping|north gosford|north kellyville|north manly|north narrabeen|north parramatta|north richmond|north rocks|north ryde|north shore|north shore sydney|north st marys|north strathfield|north sydney|north sydney council|north turramurra|north wahroonga|north willoughby|northbridge|northern beaches|northern beaches council|northern beaches sydney|northmead|northwood|norwest|oakdale|oakhurst|oakville|oatlands|oatley|old guildford|old toongabbie|oran park|orangeville|orchard hills|ourimbah|oxford falls|oxley park|oyster bay|paddington|padstow|padstow heights|pagewood|palm beach|palm grove|palmdale|palona|panania|parklea|parramatta|patonga|peakhurst|peakhurst heights|pearl beach|peats ridge|pemulwuy|pendle hill|pennant hills|penrith|penrith city council|penshurst|perrys crossing|petersham|pheasants nest|phegans bay|phillip bay|picketts valley|picnic point|picton|pitt town|pitt town bottoms|pittwater|pleasure point|plumpton|point clare|point frederick|point piper|point wolstoncroft|port botany|port hacking|potts hill|potts point|prairiewood|prestons|pretty beach|prospect|punchbowl|putney|pymble|pyrmont|quakers hill|queens park|queenscliff|raby|ramsgate|ramsgate beach|randwick|randwick city council|ravensdale|razorback|redfern|regents park|regentville|revesby|revesby heights|rhodes|richards|richmond|richmond lowlands|riverstone|riverview|riverwood|rockdale|rocklily ridge|rocky point|rodd point|rookwood|rooty hill|ropes crossing|rose bay|rosebery|rosehill|roselands|rosemeadow|roseville|roseville chase|rossmore|rouse hill|rozelle|ruse|rushcutters bay|russell lea|rydalmere|ryde|ryde and macquarie park|ryde area|sackville|sackville north|sadleir|san remo|sandringham|sandy point|sans souci|saratoga|scheyville|schofields|scotland island|seaforth|sefton|seven hills|shalvey|shanes park|shelly beach|silverdale|silverwater|singletons mill|smeaton grange|smithfield|somersby|south coogee|south granville|south hurstville|south maroota|south penrith|south turramurra|south wentworthville|south west sydney|south western sydney|south windsor|spencer|spring farm|springfield|springwood|st albans|st andrews|st clair|st george|st helens park|st huberts island|st ives|st ives chase|st johns park|st leonards|st marys|st peters|stanhope gardens|stanmore|strathfield|strathfield council|strathfield south|summer hill|summerland point|sun valley|surry hills|sutherland|sutherland shire|sutherland shire council|sydenham|sydney|sydney cbd|sydney city|sydney olympic park|sydney south west|sylvania|sylvania waters|tacoma|tacoma south|tahmoor|tallawong|tamarama|taren point|tascott|telopea|tempe|ten mile hollow|tennyson|tennyson point|terrey hills|terrigal|tesselate hill|the devils wilderness|the entrance|the entrance north|the hills district|the hills shire council|the oaks|the ponds|the rocks|the slopes|theresa park|thirlmere|thornleigh|toongabbie|toowoon bay|toukley|tregear|tuggerah|tuggerawong|tumbi umbi|turramurra|turrella|uloola|ultimo|umina beach|upper colo|upper macdonald|upper mangrove|upper north shore|valley heights|varroville|vaucluse|villawood|vineyard|voyager point|wadalba|wagstaffe|wahroonga|waitara|wakeley|wallacia|wallarah|wamberal|wareemba|warnervale|warragamba|warrawee|warriewood|warrimoo|warumbul|warwick farm|watanobbi|waterfall|waterloo|watsons bay|wattamolla|wattle grove|waverley|waverley council|waverton|webbs creek|wedderburn|wendoree park|wentworth falls|wentworth point|wentworthville|werombi|werrington|werrington county|werrington downs|west gosford|west hoxton|west pennant hills|west pymble|west ryde|western sydney|westleigh|westmead|wetherill park|whalan|whale beach|wheeler heights|wheeny creek|wilberforce|wiley park|willmot|willoughby|willoughby city council|willoughby east|wilton|windsor|windsor downs|wingecarribee shire council|winmalee|winston hills|wisemans ferry|wolli creek|wollondilly shire council|wollstonecraft|womerah|wondabyne|woodbine|woodcroft|woodford|woodpark|woollahra|woollahra municipal council|woolloomooloo|woolooware|woolwich|woongarrah|woronora|woronora heights|woy woy|woy woy bay|wrights creek|wybung|wyoming|wyong|wyong creek|wyongah|yagoona|yanderra|yarramalong|yarramundi|yarrawarrah|yattalunga|yellow rock|yenabilli|yennora|yerranderie|yowie bay|zetland'.split('|'),\n)\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandlab-digital/site-next",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,7 @@
24
24
  "typecheck": "tsc --noEmit -p tsconfig.json"
25
25
  },
26
26
  "dependencies": {
27
- "@brandlab-digital/site-core": "4.2.2",
27
+ "@brandlab-digital/site-core": "4.2.4",
28
28
  "browser-image-compression": "2.0.2",
29
29
  "pdf-lib": "1.17.1",
30
30
  "server-only": "0.0.1",