@emailens/engine 0.9.3 → 0.9.5

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.
@@ -1,5 +1,5 @@
1
- import { u as InputFormat } from '../types-Duj14jTL.cjs';
2
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-BFwlVmzZ.cjs';
1
+ import { u as InputFormat } from '../types-p9e1n-G_.cjs';
2
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-WFdbEleP.cjs';
3
3
 
4
4
  /**
5
5
  * Compile an MJML source string into an HTML email string.
@@ -1,5 +1,5 @@
1
- import { u as InputFormat } from '../types-Duj14jTL.js';
2
- export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-BENS7LIn.js';
1
+ import { u as InputFormat } from '../types-p9e1n-G_.js';
2
+ export { C as CompileError, a as CompileReactEmailOptions, S as SandboxStrategy, c as compileReactEmail } from '../react-email-CkBByvBK.js';
3
3
 
4
4
  /**
5
5
  * Compile an MJML source string into an HTML email string.
package/dist/index.cjs CHANGED
@@ -8406,7 +8406,8 @@ function generateFixPrompt(options) {
8406
8406
  scores,
8407
8407
  scope,
8408
8408
  selectedClientId,
8409
- format = "html"
8409
+ format = "html",
8410
+ intent
8410
8411
  } = options;
8411
8412
  const filteredWarnings = scope === "current" && selectedClientId ? warnings.filter((w) => w.client === selectedClientId) : warnings;
8412
8413
  const filteredScores = scope === "current" && selectedClientId ? { [selectedClientId]: scores[selectedClientId] } : scores;
@@ -8429,6 +8430,16 @@ function generateFixPrompt(options) {
8429
8430
  - **Scope:** ${clientLabel}
8430
8431
  - **Issues found:** ${errorCount} error${errorCount !== 1 ? "s" : ""}, ${warnCount} warning${warnCount !== 1 ? "s" : ""}, ${infoCount} info`
8431
8432
  );
8433
+ const trimmedIntent = intent == null ? void 0 : intent.trim();
8434
+ if (trimmedIntent) {
8435
+ sections.push(
8436
+ `## User Intent
8437
+
8438
+ The user described what they want this email to achieve. Honor it where possible, but never at the cost of breaking email-client compatibility:
8439
+
8440
+ ` + trimmedIntent
8441
+ );
8442
+ }
8432
8443
  sections.push(
8433
8444
  `## Original Email Code
8434
8445
 
@@ -8996,13 +9007,17 @@ Href: ${href}`
8996
9007
  });
8997
9008
  return issues;
8998
9009
  }
8999
- var STREET_ADDRESS_PATTERN = /\b\d{1,5}\s+[A-Za-z]+\s+(St(reet)?|Ave(nue)?|Blvd|Boulevard|Dr(ive)?|Rd|Road|Ln|Lane|Way|Ct|Court|Pl(ace)?|Pkwy|Parkway|Cir(cle)?|Terr(ace)?|Loop)\b/i;
9010
+ var STREET_ADDRESS_PATTERN = /\b\d{1,5}[A-Za-z]?\s+[A-Za-z]+\s+(St(reet)?|Ave(nue)?|Blvd|Boulevard|Dr(ive)?|Rd|Road|Ln|Lane|Way|Ct|Court|Pl(ace)?|Pkwy|Parkway|Cir(cle)?|Terr(ace)?|Loop)\b/i;
9011
+ var STREET_TYPE_FIRST_PATTERN = /\b\d{1,5}\s+(rue|chemin|avenue|av|boulevard|bd|impasse|all[ée]e|place|route|quai|cours|via|viale|piazza|strada)\b/i;
9012
+ var STREET_TYPE_LEADING_PATTERN = /\b(calle|avenida|avda|plaza|paseo|carrer|rua|travessa)\s+[A-Za-zÀ-ÿ]+.{0,30}?\d{1,4}\b/i;
9013
+ var STREET_TYPE_SUFFIX_PATTERN = /\b[A-Za-zÀ-ÿ]+(stra(ss|ß)e|straat|weg|gasse|allee|platz|vej|gata|gate)\s+\d{1,4}\b/i;
9000
9014
  var PO_BOX_PATTERN = /\bP\.?\s*O\.?\s*Box\s+\d+/i;
9001
- var ZIP_CODE_PATTERN = /\b\d{5}(-\d{4})?\b/;
9015
+ var ZIP_CODE_PATTERN = /\b(\d{5}(-\d{4})?|[A-Z]{1,2}\d[A-Z\d]?\s*\d[A-Z]{2}|\d{4}\s*[A-Z]{2})\b/i;
9002
9016
  var ADDRESS_CLASS_PATTERN = /address|mailing|postal|footer-address|physical-address/i;
9003
9017
  function checkPhysicalAddress($, text, options) {
9004
9018
  if ((options == null ? void 0 : options.emailType) === "transactional") return null;
9005
- if (STREET_ADDRESS_PATTERN.test(text) && ZIP_CODE_PATTERN.test(text)) return null;
9019
+ const hasStreet = STREET_ADDRESS_PATTERN.test(text) || STREET_TYPE_FIRST_PATTERN.test(text) || STREET_TYPE_LEADING_PATTERN.test(text) || STREET_TYPE_SUFFIX_PATTERN.test(text);
9020
+ if (hasStreet && ZIP_CODE_PATTERN.test(text)) return null;
9006
9021
  if (PO_BOX_PATTERN.test(text) && ZIP_CODE_PATTERN.test(text)) return null;
9007
9022
  let foundByClass = false;
9008
9023
  $("[class]").each((_, el) => {