@sharadox/form-web-library 0.8.0-polish.35 → 0.8.0-polish.37

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/CHANGELOG.md CHANGED
@@ -4,12 +4,12 @@ What changed in each version of `@sharadox/form-web-library`, newest first.
4
4
 
5
5
  ## 0.8.0
6
6
 
7
- - The company's email comes from the company by name (or `senderName`), no longer "<company> Web Application".
8
- - Its subject is the form's name and the visitor's: "Contact · Ana (Café)".
9
- - It is in the language the visitor used the form in: built-in English and Portuguese words (`CONTACT_LABELS`), `labels` by language, and choices and fields named in each language.
10
- - The automatic reply's subject starts with the form's name too: "Contact · We received your message".
11
- - The emails use email-web-library's one layout, the same in every mail app: no background, the text, logo and button in the theme's foreground (black, or white in dark mode); `darkLogo` is the white logo for dark themes; a site's `design` brings only its name, logo size, wordmark and signature.
12
- - `contactAcknowledgement(site)` (`…/contact-acknowledgement`): the automatic reply with the same words for every site, in English and Portuguese, and a button to the site in the visitor's language.
7
+ - **Breaking:** the contact form sends one email, to both the visitor and the company (`to`), so they share one conversation: replies go to the company (`Reply-To`), so replying the visitor reaches it, and replying to all the company reaches the visitor, never the sending address. The automatic reply and its `acknowledgement` option are gone.
8
+ - Its subject is "Contact · Name (Organization) · <conversation identifier>", a UUID version 7 (`identifier`), in the language the visitor used the form in ("Contacto · …").
9
+ - It thanks the visitor by name, says the company will answer within a working day and that replying adds to the conversation, lists every detail (name, organization, email, phone, the site's fields, the needs one per line, the message keeping its lines, the conversation identifier), and signs off "Best regards, <Company>." The form page, language, time and IP are no longer shown (the visitor sees the email too).
10
+ - Built-in English and Portuguese words (`CONTACT_LABELS`), `labels` by language, choices and fields named in each language. **Breaking:** `ContactLabels` has new words; `site`, `languageNames`, `now`, `formPage` and `LANGUAGE_NAMES` are gone.
11
+ - It comes from the company by name (or `senderName`), no longer "<company> Web Application".
12
+ - The email uses email-web-library's one layout, the same in every mail app; `darkLogo` is the white logo for dark themes.
13
13
 
14
14
  ## 0.6.1
15
15
 
package/README.md CHANGED
@@ -43,25 +43,25 @@ pnpm add @sharadox/form-web-library
43
43
  ```ts
44
44
  // the site's library
45
45
  export const sendContact = createContactAction({
46
- to: "contact@example.com",
47
- company: "Example", // from "Example", subject "Contact · Ana (Café)" ("Contacto · …" when the visitor used Portuguese)
48
- site: "example.com",
46
+ to: "contact@example.com", // the email goes here and to the visitor; replies come here
47
+ company: "Example", // from "Example", signed "Best regards, Example."
49
48
  choices: { website: "Website", logo: "Logo", other: "Others" },
50
49
  logo: async () => ({ content: await readFile(LOGO), contentType: "image/png", filename: "logo.png" }),
51
50
  darkLogo: async () => ({ content: await readFile(LOGO_DARK), contentType: "image/png", filename: "logo-dark.png" }), // white, for dark themes
52
51
  design: EXAMPLE_EMAIL, // the company's EmailDesign (email-web-library): name, logo size, wordmark, signature
53
- acknowledgement: contactAcknowledgement("https://example.com"), // the automatic reply every site sends
54
52
  });
55
53
  ```
56
54
 
57
- Every email has the same layout, so every mail app shows it alike: no background, the text, logo and button in the
58
- theme's foreground (black, or white in dark mode), the company's logo at the top left, the visitor's name (and company),, every detail they gave, their message, and at the bottom the page the form was sent from, the
59
- language, the time and the IP address. Replying answers the visitor. With `acknowledgement`, a visitor who left an
60
- email also gets an automatic reply in their language, with their message, and replying to it reaches the company.
61
- `contactAcknowledgement(site)` (`…/contact-acknowledgement`) gives every site's reply the same words, in English and
62
- Portuguese: "Contact · We received your message" ("Contacto · Recebemos a sua mensagem"), thanks by name, a reply
63
- within one working day, the message back and a button to the site.
64
- The emails are laid out by email-web-library's `emailLayout` in the brand's `design` (its `EmailDesign`), which a site also uses for any other email it sends.
55
+ The form sends one email, to both the visitor and the company, so they share one conversation. It comes from the
56
+ company by name, from the sending address (`EMAIL_SENDER_ADDRESS`), with replies set to go to the company: replying,
57
+ the visitor reaches the company, and replying to all, the company reaches the visitor (the sending address never
58
+ appears). The subject is "Contact · Ana (Café) · <conversation identifier>", a UUID version 7. The email thanks the
59
+ visitor by name, says the company will answer within a working day and that replying adds to the conversation, lists
60
+ every detail they gave (name, organization, email, phone, the site's fields, their needs one per line, their message
61
+ keeping its lines) and the conversation's identifier, and signs off with the company's name, all in the language the
62
+ visitor used the form in (English and Portuguese built in, `labels` for more). A visitor who left only a phone isn't
63
+ sent anything; the company still is. The email is laid out by email-web-library's `emailLayout`, which a site also
64
+ uses for any other email it sends.
65
65
 
66
66
  ```ts
67
67
  // the application's server action
@@ -83,17 +83,17 @@ The email server comes from `EMAIL_SERVER_*` and `EMAIL_SENDER_ADDRESS`.
83
83
 
84
84
  ## API
85
85
 
86
- | Import | Export |
87
- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
- | `…/contact-problem` | `contactProblems({ name, email, phone })`: what a form's contact details still lack |
89
- | `…/choice-request` | `requestChoices(event, choices)`, `useChoiceRequests(event, onRequest)`: a button elsewhere asks the form to tick choices |
90
- | `…/bot-field` | `<BotFields />`: the honeypot and fill-time fields `isLikelyBot` reads |
91
- | `…/contact-action` | `createContactAction(options)` → `(form, ip) => Promise<ContactState>`; `ENGLISH_LABELS`, `PLAIN_THEME`, `LANGUAGE_NAMES`, `formPage(value, site)`; `ContactState`, `ContactActionOptions`, `ContactLabels`, `ContactAcknowledgement` and `EmailLogo` in `…/contact-action/type` |
92
- | `…/parse-contact` | `parseContact(form, { choices?, choiceField?, reach?, requireMessage?, minimumMessageLength?, requireChoice?, fields?, now? })` → `bot`, `invalid` or `valid` |
93
- | `…/contact-check` | `isEmail(text)`, `isPhone(text)`: the rules the action uses, safe in the browser for checks before sending |
94
- | `…/bot-check` | `isLikelyBot(form, { honeypotField?, startedAtField?, minimumFillTime?, now? })` |
95
- | `…/rate-limit` | `createRateLimiter({ window, maximum })` → `(key, now?) => boolean` (kept in memory, per server instance) |
96
- | `…/field` | `readField(form, name, maximumLength)` |
86
+ | Import | Export |
87
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | `…/contact-problem` | `contactProblems({ name, email, phone })`: what a form's contact details still lack |
89
+ | `…/choice-request` | `requestChoices(event, choices)`, `useChoiceRequests(event, onRequest)`: a button elsewhere asks the form to tick choices |
90
+ | `…/bot-field` | `<BotFields />`: the honeypot and fill-time fields `isLikelyBot` reads |
91
+ | `…/contact-action` | `createContactAction(options)` → `(form, ip) => Promise<ContactState>`; `ENGLISH_LABELS`, `PORTUGUESE_LABELS`, `CONTACT_LABELS`, `plainDesign(company)`, `textIn(text, locale)`; `ContactState`, `ContactActionOptions`, `ContactLabels`, `ContactText` and `EmailLogo` in `…/contact-action/type` |
92
+ | `…/parse-contact` | `parseContact(form, { choices?, choiceField?, reach?, requireMessage?, minimumMessageLength?, requireChoice?, fields?, now? })` → `bot`, `invalid` or `valid` |
93
+ | `…/contact-check` | `isEmail(text)`, `isPhone(text)`: the rules the action uses, safe in the browser for checks before sending |
94
+ | `…/bot-check` | `isLikelyBot(form, { honeypotField?, startedAtField?, minimumFillTime?, now? })` |
95
+ | `…/rate-limit` | `createRateLimiter({ window, maximum })` → `(key, now?) => boolean` (kept in memory, per server instance) |
96
+ | `…/field` | `readField(form, name, maximumLength)` |
97
97
 
98
98
  ## Develop
99
99
 
@@ -10,29 +10,22 @@ export declare const CONTACT_LABELS: Readonly<Record<string, ContactLabels>>;
10
10
  export declare function textIn(text: ContactText, locale: string): string;
11
11
  /** The logo (when the site gives one) and the company's name beside it, when the site gives no design of its own. */
12
12
  export declare const plainDesign: (company: string) => EmailDesign;
13
- /** Common languages' names, when the site gives none. */
14
- export declare const LANGUAGE_NAMES: Readonly<Record<string, string>>;
15
- /**
16
- * The page the form was sent from, when it is a web address on the site's domain (or a subdomain of it); anything
17
- * else is left out, so a forged field can't put a link of someone else's in the inbox.
18
- */
19
- export declare function formPage(value: ReturnType<FormData["get"]>, site: string): string | undefined;
20
13
  /**
21
14
  * Builds the work of a contact form's server action: checks for bots (they get a fake success), validates, limits
22
- * each address and everyone together per day (`dailyMaximum`, so a flood can't run up the email bill), then emails
23
- * the company in its own design (`design`): its logo at the top, every detail the visitor gave, their message, a
24
- * button to answer them, and the page, language, time and IP at the bottom, all in the language the visitor used the
25
- * form in. It comes from the company by name, with the subject "Contact · Name (Company)" ("Contacto · …" in
26
- * Portuguese), and replying answers the visitor. When the visitor left an
27
- * email and the site gives an `acknowledgement`, they get an automatic reply in their language with their message
28
- * (its subject also starting with the form's name: "Contact · We received your message"),
29
- * which the company can be reached by replying to. Sites can accept a phone instead of an email (`reach`), make the
15
+ * each address and everyone together per day (`dailyMaximum`, so a flood can't run up the email bill), then sends one
16
+ * email to both the visitor and the company (`to`), so they share one conversation: replying, the visitor reaches the
17
+ * company; replying to all, the company reaches the visitor (the sending address is never in the way: replies go to
18
+ * `to`). It thanks the visitor by name, says what happens next, lists every detail they gave (their needs one per
19
+ * line, their message keeping its lines) and the conversation's identifier (a UUID version 7), and signs off with the
20
+ * company's name, all in the language the visitor used the form in. It comes from the company by name, with the
21
+ * subject "Contact · Name (Organization) · <identifier>" ("Contacto · …" in Portuguese). A visitor who left only a
22
+ * phone isn't sent anything; the company still is. Sites can accept a phone instead of an email (`reach`), make the
30
23
  * message optional, add fields and give the email's words in more languages (`labels`).
31
24
  *
32
25
  * @example
33
- * const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox", site: "sharadox.com" });
26
+ * const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox" });
34
27
  * // in a "use server" file:
35
28
  * export async function sendContactAction(_: ContactState, form: FormData) { return sendContact(form, ip); }
36
29
  */
37
- export declare function createContactAction({ to, company, senderName, senderAddress, logo, darkLogo, design: givenDesign, languageNames, acknowledgement, choices, site, reach, requireMessage, minimumMessageLength, requireChoice, fields, labels: givenLabels, rateLimit, dailyMaximum, readConfiguration, createSender, reportError, now, }: ContactActionOptions): (form: FormData, ip: string) => Promise<ContactState>;
30
+ export declare function createContactAction({ to, company, senderName, senderAddress, logo, darkLogo, design: givenDesign, choices, reach, requireMessage, minimumMessageLength, requireChoice, fields, labels: givenLabels, rateLimit, dailyMaximum, readConfiguration, createSender, reportError, identifier, }: ContactActionOptions): (form: FormData, ip: string) => Promise<ContactState>;
38
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-action/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,6BAA6B,CAAC;AAItF,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,gDAAgD,CAAC;AAIxD,oCAAoC;AACpC,eAAO,MAAM,cAAc,EAAE,aAa5B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,EAAE,aAa/B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAiD,CAAC;AAErH,6GAA6G;AAC7G,wBAAgB,MAAM,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,qHAAqH;AACrH,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,WAI5C,CAAC;AAEH,yDAAyD;AACzD,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO3D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAS7F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,EAAE,EACF,OAAO,EACP,UAAoB,EACpB,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,MAAM,EAAE,WAAW,EACnB,aAA8B,EAC9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BAAgD,EAChD,YAAgC,EAChC,WAA+D,EAC/D,UAAiC,GAClC,EAAE,oBAAoB,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAC,CA8F9E"}
@@ -1,37 +1,42 @@
1
1
  import { createEmailSender, EmailError, emailLayout, readEmailServerConfiguration } from "@sharadox/email-web-library";
2
+ import { uuidVersion7 } from "@sharadox/web-library/identifier/uuid-version-7";
2
3
  import { separated } from "@sharadox/web-library/text/separated";
3
4
  import { createRateLimiter } from "@sharadox/form-web-library/rate-limit";
4
5
  import { parseContact } from "@sharadox/form-web-library/parse-contact";
5
6
  const oneLine = (text) => text.replace(/[\r\n]+/g, " ");
6
7
  /** The email's words in English. */
7
8
  export const ENGLISH_LABELS = {
9
+ contact: "Contact",
10
+ thanks: "Thank you",
11
+ paragraphs: [
12
+ "Your message has reached us and we will get back to you as soon as possible, usually within a working day.",
13
+ "Feel free to reply to this email, in case you would like to add anything else to the conversation.",
14
+ ],
8
15
  name: "Name",
16
+ organization: "Organization",
9
17
  email: "Email",
10
18
  phone: "Phone",
11
- company: "Company",
12
19
  needs: "Needs",
13
- language: "Language",
14
- contact: "Contact",
15
20
  message: "Message",
16
- page: "Form",
17
- sent: "Sent",
18
- reply: "Reply to",
19
- call: "Call",
21
+ conversation: "Conversation identifier",
22
+ closing: "Best regards,",
20
23
  };
21
24
  /** The email's words in Portuguese. */
22
25
  export const PORTUGUESE_LABELS = {
26
+ contact: "Contacto",
27
+ thanks: "Obrigado",
28
+ paragraphs: [
29
+ "A sua mensagem chegou até nós e responderemos o mais brevemente possível, normalmente dentro de um dia útil.",
30
+ "Caso queira acrescentar algo à conversa, basta responder a este email.",
31
+ ],
23
32
  name: "Nome",
33
+ organization: "Organização",
24
34
  email: "Email",
25
35
  phone: "Telefone",
26
- company: "Empresa",
27
- needs: "Pedido",
28
- language: "Idioma",
29
- contact: "Contacto",
36
+ needs: "Necessidades",
30
37
  message: "Mensagem",
31
- page: "Formulário",
32
- sent: "Enviado",
33
- reply: "Responder a",
34
- call: "Ligar a",
38
+ conversation: "Identificador da conversa",
39
+ closing: "Cumprimentos,",
35
40
  };
36
41
  /** The built-in words, by language. */
37
42
  export const CONTACT_LABELS = { en: ENGLISH_LABELS, pt: PORTUGUESE_LABELS };
@@ -47,49 +52,24 @@ export const plainDesign = (company) => ({
47
52
  logo: { width: 44, height: 44 },
48
53
  wordmark: true,
49
54
  });
50
- /** Common languages' names, when the site gives none. */
51
- export const LANGUAGE_NAMES = {
52
- en: "English",
53
- pt: "Português",
54
- es: "Español",
55
- fr: "Français",
56
- de: "Deutsch",
57
- it: "Italiano",
58
- };
59
- /**
60
- * The page the form was sent from, when it is a web address on the site's domain (or a subdomain of it); anything
61
- * else is left out, so a forged field can't put a link of someone else's in the inbox.
62
- */
63
- export function formPage(value, site) {
64
- if (typeof value !== "string" || value.length > 500)
65
- return undefined;
66
- try {
67
- const url = new URL(value);
68
- const host = url.hostname;
69
- return url.protocol === "https:" && (host === site || host.endsWith(`.${site}`)) ? url.href : undefined;
70
- }
71
- catch {
72
- return undefined;
73
- }
74
- }
75
55
  /**
76
56
  * Builds the work of a contact form's server action: checks for bots (they get a fake success), validates, limits
77
- * each address and everyone together per day (`dailyMaximum`, so a flood can't run up the email bill), then emails
78
- * the company in its own design (`design`): its logo at the top, every detail the visitor gave, their message, a
79
- * button to answer them, and the page, language, time and IP at the bottom, all in the language the visitor used the
80
- * form in. It comes from the company by name, with the subject "Contact · Name (Company)" ("Contacto · …" in
81
- * Portuguese), and replying answers the visitor. When the visitor left an
82
- * email and the site gives an `acknowledgement`, they get an automatic reply in their language with their message
83
- * (its subject also starting with the form's name: "Contact · We received your message"),
84
- * which the company can be reached by replying to. Sites can accept a phone instead of an email (`reach`), make the
57
+ * each address and everyone together per day (`dailyMaximum`, so a flood can't run up the email bill), then sends one
58
+ * email to both the visitor and the company (`to`), so they share one conversation: replying, the visitor reaches the
59
+ * company; replying to all, the company reaches the visitor (the sending address is never in the way: replies go to
60
+ * `to`). It thanks the visitor by name, says what happens next, lists every detail they gave (their needs one per
61
+ * line, their message keeping its lines) and the conversation's identifier (a UUID version 7), and signs off with the
62
+ * company's name, all in the language the visitor used the form in. It comes from the company by name, with the
63
+ * subject "Contact · Name (Organization) · <identifier>" ("Contacto · …" in Portuguese). A visitor who left only a
64
+ * phone isn't sent anything; the company still is. Sites can accept a phone instead of an email (`reach`), make the
85
65
  * message optional, add fields and give the email's words in more languages (`labels`).
86
66
  *
87
67
  * @example
88
- * const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox", site: "sharadox.com" });
68
+ * const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox" });
89
69
  * // in a "use server" file:
90
70
  * export async function sendContactAction(_: ContactState, form: FormData) { return sendContact(form, ip); }
91
71
  */
92
- export function createContactAction({ to, company, senderName = company, senderAddress, logo, darkLogo, design: givenDesign, languageNames = LANGUAGE_NAMES, acknowledgement, choices = {}, site, reach = "email", requireMessage = true, minimumMessageLength = 1, requireChoice = false, fields = {}, labels: givenLabels = {}, rateLimit = { window: 60 * 60 * 1000, maximum: 5 }, dailyMaximum = 50, readConfiguration = readEmailServerConfiguration, createSender = createEmailSender, reportError = (message, error) => console.error(message, error), now = () => new Date(), }) {
72
+ export function createContactAction({ to, company, senderName = company, senderAddress, logo, darkLogo, design: givenDesign, choices = {}, reach = "email", requireMessage = true, minimumMessageLength = 1, requireChoice = false, fields = {}, labels: givenLabels = {}, rateLimit = { window: 60 * 60 * 1000, maximum: 5 }, dailyMaximum = 50, readConfiguration = readEmailServerConfiguration, createSender = createEmailSender, reportError = (message, error) => console.error(message, error), identifier = () => uuidVersion7(), }) {
93
73
  const allow = createRateLimiter(rateLimit);
94
74
  const allowToday = createRateLimiter({ window: 24 * 60 * 60 * 1000, maximum: dailyMaximum });
95
75
  const design = givenDesign ?? plainDesign(company);
@@ -110,42 +90,38 @@ export function createContactAction({ to, company, senderName = company, senderA
110
90
  if (!allow(ip) || !allowToday("everyone"))
111
91
  return { status: "rate-limited" };
112
92
  const message = parsed.value;
113
- // The company reads the email in the language the visitor used the form in.
93
+ // The email is in the language the visitor used the form in.
114
94
  const locale = message.locale;
115
95
  const labels = { ...(CONTACT_LABELS[locale] ?? ENGLISH_LABELS), ...givenLabels[locale] };
116
- const page = formPage(form.get("page"), site);
117
- const language = languageNames[message.locale] ?? message.locale;
118
- const sent = `${now().toISOString().slice(0, 16).replace("T", " ")} UTC`;
119
- const named = message.choices.map((choice) => textIn(choices[choice], locale));
96
+ const conversation = identifier();
97
+ const needs = message.choices.map((choice) => textIn(choices[choice], locale));
120
98
  const who = message.company ? `${message.name} (${message.company})` : message.name;
121
- const firstName = message.name.split(/\s+/)[0];
122
- // The one thing to do: answer by email, or call when only a phone was left.
123
- const answer = message.email
124
- ? { label: `${labels.reply} ${firstName}`, href: `mailto:${message.email}` }
125
- : { label: `${labels.call} ${firstName}`, href: `tel:${message.phone.replace(/[^\d+]/g, "")}` };
99
+ const heading = `${labels.thanks}, ${message.name}.`;
126
100
  const rows = [
127
101
  { label: labels.name, value: message.name },
102
+ ...(message.company ? [{ label: labels.organization, value: message.company }] : []),
128
103
  ...(message.email ? [{ label: labels.email, value: message.email, href: `mailto:${message.email}` }] : []),
129
104
  ...(message.phone
130
105
  ? [{ label: labels.phone, value: message.phone, href: `tel:${message.phone.replace(/[^\d+]/g, "")}` }]
131
106
  : []),
132
- ...(message.company ? [{ label: labels.company, value: message.company }] : []),
133
107
  ...Object.entries(fields)
134
108
  .filter(([field]) => message.fields[field])
135
109
  .map(([field, label]) => ({ label: textIn(label, locale), value: message.fields[field] })),
136
- ...(named.length ? [{ label: labels.needs, value: named.join(", ") }] : []),
137
- ];
138
- const footer = [
139
- ...(page ? [{ label: labels.page, value: page, href: page }] : [{ label: labels.page, value: site }]),
140
- { label: labels.language, value: language },
141
- { label: labels.sent, value: sent },
142
- { label: "IP", value: ip },
110
+ ...(needs.length ? [{ label: labels.needs, value: needs }] : []),
111
+ ...(message.message ? [{ label: labels.message, value: message.message, keepLines: true }] : []),
112
+ { label: labels.conversation, value: conversation },
143
113
  ];
144
114
  const text = [
145
- ...rows.map((row) => `${row.label}: ${row.value}`),
146
- ...(message.message ? ["", `${labels.message}:`, message.message] : []),
115
+ heading,
116
+ "",
117
+ ...labels.paragraphs,
118
+ "",
119
+ ...rows.map((row) => typeof row.value === "string"
120
+ ? `${row.label}:${row.keepLines ? "\n" : " "}${row.value}`
121
+ : [`${row.label}:`, ...row.value.map((item) => `- ${item}`)].join("\n")),
147
122
  "",
148
- ...footer.map((row) => `${row.label}: ${row.value}`),
123
+ labels.closing,
124
+ `${company}.`,
149
125
  ].join("\n");
150
126
  try {
151
127
  const image = logo ? await logo() : undefined;
@@ -154,76 +130,29 @@ export function createContactAction({ to, company, senderName = company, senderA
154
130
  ...(image ? [{ id: "logo", ...image }] : []),
155
131
  ...(darkImage ? [{ id: "logo-dark", ...darkImage }] : []),
156
132
  ];
157
- const logos = { light: Boolean(image), dark: Boolean(darkImage) };
158
133
  const configuration = readConfiguration();
159
- const sender = createSender(configuration);
160
- const from = {
161
- name: senderName,
162
- address: senderAddress || process.env.EMAIL_SENDER_ADDRESS || configuration.username,
163
- };
164
- await sender.send({
165
- from,
166
- to,
167
- // Replying to the email answers the visitor at the address they typed.
168
- ...(message.email ? { replyTo: { name: oneLine(message.name), address: message.email } } : {}),
169
- subject: oneLine(separated(labels.contact, who)).slice(0, 300),
134
+ await createSender(configuration).send({
135
+ from: {
136
+ name: senderName,
137
+ address: senderAddress || process.env.EMAIL_SENDER_ADDRESS || configuration.username,
138
+ },
139
+ // One email to both: the visitor (when they left an email) and the company, in one conversation.
140
+ to: [...(message.email ? [{ name: oneLine(message.name), address: message.email }] : []), to],
141
+ // Replies go to the company, never to the sending address; replying to all, the company reaches the visitor.
142
+ replyTo: to,
143
+ subject: oneLine(separated(labels.contact, who, conversation)).slice(0, 300),
170
144
  text,
171
145
  html: emailLayout({
172
146
  language: locale,
173
- preview: separated(who, named.join(", ")),
147
+ preview: labels.paragraphs[0] ?? heading,
174
148
  eyebrow: labels.contact,
175
- heading: who,
149
+ heading,
150
+ paragraphs: labels.paragraphs,
176
151
  rows,
177
- ...(message.message ? { quote: { label: labels.message, text: message.message } } : {}),
178
- button: answer,
179
- footer,
180
- }, design, logos),
152
+ closing: labels.closing,
153
+ }, design, { light: Boolean(image), dark: Boolean(darkImage) }),
181
154
  inlineImages,
182
155
  });
183
- // The automatic reply: never stops the message itself from counting as sent.
184
- const reply = acknowledgement?.[message.locale] ?? Object.values(acknowledgement ?? {})[0];
185
- if (reply && message.email) {
186
- try {
187
- await sender.send({
188
- from,
189
- to: { name: oneLine(message.name), address: message.email },
190
- replyTo: to,
191
- // The form's name first, as on every email the form sends: "Contact · We received your message".
192
- subject: oneLine(separated(labels.contact, reply.subject)).slice(0, 300),
193
- text: [
194
- reply.heading(message.name),
195
- "",
196
- ...reply.paragraphs,
197
- ...(message.message ? ["", `${reply.messageLabel}:`, message.message] : []),
198
- ].join("\n"),
199
- html: emailLayout({
200
- language: message.locale,
201
- preview: reply.paragraphs[0] ?? reply.subject,
202
- eyebrow: reply.eyebrow,
203
- heading: reply.heading(message.name),
204
- paragraphs: reply.paragraphs,
205
- ...(message.message ? { quote: { label: reply.messageLabel, text: message.message } } : {}),
206
- ...(reply.button ? { button: reply.button } : {}),
207
- // The company's own signature says where it is; without one, a line to its site does.
208
- ...(design.signature?.length
209
- ? {}
210
- : {
211
- footer: [
212
- {
213
- label: company,
214
- value: page ? new URL(page).origin.replace("https://", "") : site,
215
- href: page ? new URL(page).origin : `https://${site}`,
216
- },
217
- ],
218
- }),
219
- }, design, logos),
220
- inlineImages,
221
- });
222
- }
223
- catch (error) {
224
- reportError("contact: the automatic reply failed", error);
225
- }
226
- }
227
156
  return { status: "sent" };
228
157
  }
229
158
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-action/index.ts"],"names":[],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AAO;oBACP,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,IAAI;oBACJ,OAAO,EAAE,MAAM,CAAC,OAAO;iBACxB,EACD,MAAM,EACN,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE,CACpD;gBACD,YAAY;aACb,CAAC,CAAC;YACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB;gBAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;YAClG,WAAW,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAC;YAC9C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -6,47 +6,24 @@ export interface ContactState {
6
6
  }
7
7
  /** Words the email shows in one language, or in each language by code (`{ en: "Home", pt: "Casa" }`). */
8
8
  export type ContactText = string | Readonly<Record<string, string>>;
9
- /** The words the email uses around the visitor's answers, in one language. */
9
+ /** The email's words around the visitor's answers, in one language. */
10
10
  export interface ContactLabels {
11
+ /** The form's name: first in the subject ("Contact · Ana · …") and in small capitals above the heading. */
12
+ contact: string;
13
+ /** Before the visitor's name in the heading: "Thank you" ("Thank you, Ana."). */
14
+ thanks: string;
15
+ /** Under the heading: what happens next, and that replying adds to the conversation. */
16
+ paragraphs: readonly string[];
11
17
  name: string;
18
+ organization: string;
12
19
  email: string;
13
20
  phone: string;
14
- company: string;
15
21
  needs: string;
16
- language: string;
17
- /** The form's name: in the subject ("Contact · Ana") and in small capitals above the visitor's name. */
18
- contact: string;
19
- /** Above the visitor's message: "Message". */
20
22
  message: string;
21
- /** The page the form was sent from: "Form". */
22
- page: string;
23
- /** When it was sent: "Sent". */
24
- sent: string;
25
- /** The button that answers the visitor, before their first name: "Reply to". */
26
- reply: string;
27
- /** The button that calls a visitor who left only a phone, before their first name: "Call". */
28
- call: string;
29
- }
30
- /** The automatic reply to the visitor, in one language: thanks, what happens next, and their message back. */
31
- export interface ContactAcknowledgement {
32
- /**
33
- * For example "We received your message": the sender already names the company, so the subject doesn't; the
34
- * form's name goes before it ("Contact · We received your message").
35
- */
36
- subject: string;
37
- /** The heading, from the visitor's name, for example `Thank you, ${name}.`. */
38
- heading: (name: string) => string;
39
- /** What happens next. */
40
- paragraphs: readonly string[];
41
- /** Above their message: "Your message". */
42
- messageLabel: string;
43
- /** The small capitals above the heading, for example "Message received". */
44
- eyebrow: string;
45
- /** A button under their message, for example to the site. */
46
- button?: {
47
- label: string;
48
- href: string;
49
- };
23
+ /** Above the conversation's identifier: "Conversation identifier". */
24
+ conversation: string;
25
+ /** Before the company's name at the end: "Best regards,". */
26
+ closing: string;
50
27
  }
51
28
  /** The company's logo at the top of every email: a square image (PNG), sent inside the email. */
52
29
  export interface EmailLogo {
@@ -55,11 +32,15 @@ export interface EmailLogo {
55
32
  filename: string;
56
33
  }
57
34
  export interface ContactActionOptions {
58
- /** Where messages go, for example "contact@sharadox.com". */
35
+ /**
36
+ * The company's address, for example "contact@sharadox.com": the email goes to it and to the visitor, and replies
37
+ * come to it.
38
+ */
59
39
  to: string;
60
40
  /**
61
41
  * The company, for example "Sharadox". Its emails come from it by name (unless `senderName` says otherwise), and
62
- * carry its name beside the logo. The subject is the form's name and the visitor's: "Contact · Name (Company)".
42
+ * sign off with its name. The subject is the form's name, the visitor's and the conversation's identifier:
43
+ * "Contact · Name (Organization) · 019a…".
63
44
  */
64
45
  company: string;
65
46
  /** The name emails come from; the company's by default. */
@@ -75,20 +56,8 @@ export interface ContactActionOptions {
75
56
  * name sits beside the logo, its signature), in the one layout every mail app shows alike.
76
57
  */
77
58
  design?: EmailDesign;
78
- /** Each language's name in the email, by code; English names of common languages by default. */
79
- languageNames?: Readonly<Record<string, string>>;
80
- /**
81
- * The automatic reply to visitors who left an email, by language (the form's locale; the first one otherwise). It
82
- * comes from the same sender, and replying to it reaches `to`. None by default.
83
- */
84
- acknowledgement?: Readonly<Record<string, ContactAcknowledgement>>;
85
59
  /** Choices the form may send, and how each is named in the email (in each language, or one); none by default. */
86
60
  choices?: Readonly<Record<string, ContactText>>;
87
- /**
88
- * The site's domain, for example "sharadox.com". The page the form was sent from (the "page" field) is shown only
89
- * when it is on this domain or one of its subdomains.
90
- */
91
- site: string;
92
61
  /** "email" (the default) requires an email; "email-or-phone" accepts either way of answering. */
93
62
  reach?: ContactReach;
94
63
  /** False lets the message be empty; true by default. */
@@ -99,12 +68,12 @@ export interface ContactActionOptions {
99
68
  requireChoice?: boolean;
100
69
  /**
101
70
  * Extra single-line fields the form sends, and how each is named in the email (in each language, or one), for
102
- * example `{ place: { en: "Home", pt: "Casa" } }`.
71
+ * example `{ place: { en: "Place", pt: "Local" } }`.
103
72
  */
104
73
  fields?: Readonly<Record<string, ContactText>>;
105
74
  /**
106
- * The email's words in each language, by code, over the built-in English and Portuguese ones. The email the company
107
- * gets is in the language the visitor used the form in (English when it has no words for it).
75
+ * The email's words in each language, by code, over the built-in English and Portuguese ones. The email is in the
76
+ * language the visitor used the form in (English when it has no words for it).
108
77
  */
109
78
  labels?: Readonly<Record<string, Partial<ContactLabels>>>;
110
79
  /** Messages per address per window; 5 per hour by default. */
@@ -122,7 +91,7 @@ export interface ContactActionOptions {
122
91
  createSender?: (configuration: EmailServerConfiguration) => EmailSender;
123
92
  /** Where failures are reported; `console.error` by default. */
124
93
  reportError?: (message: string, error: unknown) => void;
125
- /** Now, for the time the email shows (tests). */
126
- now?: () => Date;
94
+ /** A new conversation identifier, a UUID version 7 by default (tests give their own). */
95
+ identifier?: () => string;
127
96
  }
128
97
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/contact-action/type.ts"],"names":[],"mappings":"AAAA,OAAO,K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AC,CAAC;IAC/C;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1D,8DAA8D;IAC9D,SAAS,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,wBAAwB,CAAC;IACnD,YAAY,CAAC,EAAE,CAAC,aAAa,EAAE,wBAAwB,KAAK,WAAW,CAAC;IACxE,+DAA+D;IAC/D,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,yFAAyF;IACzF,UAAU,CAAC,EAAE,MAAM,MAAM,CAAC;CAC3B"}
package/llms.txt CHANGED
@@ -5,7 +5,7 @@
5
5
  - /contact-problem: contactProblems({ name, email, phone }) → ("name" | "reach" | "email" | "phone")[]: a name and a valid way to reply, same rules on page and server
6
6
  - /choice-request: requestChoices(event, choices) and useChoiceRequests(event, onRequest): a button elsewhere on the page asks the form to tick choices
7
7
  - /bot-field: <BotFields honeypotField? startedAtField? honeypotLabel? />: the hidden honeypot and fill-time fields isLikelyBot reads
8
- - /contact-action: createContactAction({ to, company (sender name, unless senderName?; subject "<labels.contact> · Name (Company)", e.g. "Contacto · Ana (Café)"), senderAddress?, site (domain; the form's `page` field is shown only on it or a subdomain), logo?: () => Promise<{ content, contentType, filename }> (inline cid:logo at the top, black with a white outline), darkLogo? (same shape, white: cid:logo-dark shown in dark themes), design? EmailDesign { name, logo? {width,height}, wordmark?, signature? } (default plainDesign(company)), languageNames?, acknowledgement?: { [locale]: { subject, eyebrow, heading(name), paragraphs, messageLabel } } (automatic reply to the visitor's email, in their language, reply-to = to; a failed reply never fails the send), choices?: { key: label | { [locale]: label } }, reach? = 'email' | 'email-or-phone', requireMessage? = true, minimumMessageLength? = 1, requireChoice? = false, fields?: { name: label | { [locale]: label } }, labels?: { [locale]: Partial<ContactLabels> } (over CONTACT_LABELS: ENGLISH_LABELS, PORTUGUESE_LABELS; the company's email is in the visitor's form language, English when unknown); textIn(text, locale), rateLimit? = 5/hour per address, dailyMaximum? = 50 emails/day from everyone (per server instance; caps email cost under a flood), readConfiguration?, createSender?, reportError? }) → (form, ip) => { status: idle|sent|invalid|rate-limited|failed }. Reply-to = visitor when they gave an email; bots get fake 'sent'. The email: email-web-library's one layout (no background, theme foreground black/white, logo top left, Geist else system sans), every detail, the message, then Form (page), Language (name), Sent (UTC), IP.
8
+ - /contact-action: createContactAction({ to (company address: the email goes to it and the visitor; Reply-To), company (sender name unless senderName?; sign-off "Best regards, Company."), senderAddress? (EMAIL_SENDER_ADDRESS), logo?/darkLogo?: () => Promise<{ content, contentType, filename }> (cid:logo black with white outline, cid:logo-dark white), design? EmailDesign (default plainDesign(company)), choices?: { key: label | { [locale]: label } }, reach? = email | email-or-phone, requireMessage? = true, minimumMessageLength? = 1, requireChoice? = false, fields?: { name: label | { [locale]: label } }, labels?: { [locale]: Partial<ContactLabels> } (over CONTACT_LABELS en/pt), rateLimit? = 5/hour per address, dailyMaximum? = 50/day, identifier? = uuidVersion7, readConfiguration?, createSender?, reportError? }) → (form, ip) => { status }. ONE email to [visitor (if email), to], Reply-To: to (visitor replies reach the company; company replies-all reach the visitor; one thread). Subject "<contact> · Name (Organization) · <UUIDv7>" in the visitor's form language. Body: logo, CONTACT eyebrow, "Thank you, Name.", 2 paragraphs, rows Name / Organization / Email / Phone / site fields / Needs (dotted list) / Message (line breaks kept) / Conversation identifier, "Best regards," + bold company. Phone-only visitor: only the company gets it. Bots get a fake "sent".
9
9
  - Form fields: name, email, phone (valid: + digits spaces ().- with ≥7 digits), company, message, extra fields, locale, started-at, page (location.href at sending), website (honeypot), need (checkboxes).
10
10
  - /parse-contact: parseContact(form, { choices, choiceField='need', reach, requireMessage, minimumMessageLength, requireChoice, fields, now }) → value { name, email, phone, company, message, locale, choices, fields }
11
11
  - /contact-check isEmail(text), isPhone(text) (browser-safe, same rules as the server); /bot-check isLikelyBot; /rate-limit createRateLimiter({ window, maximum }); /field readField(form, name, max)
@@ -14,4 +14,3 @@
14
14
  - calling-code: CALLING_CODES (ISO alpha-2 → digits, 245 countries, from libphonenumber metadata, Apache 2.0), MAIN_CALLING_COUNTRY (shared code → main country), type CallingCountry
15
15
  - phone-number: readPhone(text, current) → { country, digits }; fullPhone(country, digits) → "+351 912345678" | ""
16
16
  - Changes by version: CHANGELOG.md (in the package)
17
- - /contact-acknowledgement: contactAcknowledgement(site url) → { en, pt } ContactAcknowledgement with the same words for every site (subject "We received your message" / "Recebemos a sua mensagem", eyebrow "Message received" / "Mensagem recebida", "Thank you, Name." / "Obrigado, Name.", reply within one working day, "Your message" / "A sua mensagem", button "Visit host" / "Visitar host" → site/en, site/pt)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharadox/form-web-library",
3
- "version": "0.8.0-polish.35",
3
+ "version": "0.8.0-polish.37",
4
4
  "description": "Forms: a phone field with every country's flag and calling code, and on the server field reading, honeypot and fill-time bot checks, rate limiting and a contact form action that emails messages with the visitor as reply-to.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENCA.md",
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "homepage": "https://github.com/Sharadox/form-web-library#readme",
52
52
  "devDependencies": {
53
- "@sharadox/es-lint-configuration-web-library": "^0.1.1",
54
- "@sharadox/library-build-web-library": "^0.1.2",
55
- "@sharadox/prettier-configuration-web-library": "^0.1.0",
56
- "@sharadox/turborepo-configuration-web-library": "^0.1.0",
57
- "@sharadox/type-script-configuration-web-library": "^0.2.0",
58
- "@sharadox/vitest-configuration-web-library": "^0.1.2",
53
+ "@sharadox/es-lint-configuration-web-library": "^0.1.2",
54
+ "@sharadox/library-build-web-library": "^0.2.0",
55
+ "@sharadox/prettier-configuration-web-library": "^0.1.1",
56
+ "@sharadox/turborepo-configuration-web-library": "0.1.3",
57
+ "@sharadox/type-script-configuration-web-library": "^0.2.2",
58
+ "@sharadox/vitest-configuration-web-library": "^0.2.0",
59
59
  "@testing-library/dom": "^10.4.2",
60
60
  "@testing-library/react": "^16.3.3",
61
61
  "@types/node": "^24.19.2",
@@ -75,9 +75,9 @@
75
75
  "vitest": "^5.1.0"
76
76
  },
77
77
  "dependencies": {
78
- "@sharadox/email-web-library": "0.6.0-polish.25",
79
- "@sharadox/icon-web-library": "^0.6.0",
80
- "@sharadox/web-library": "^0.9.0"
78
+ "@sharadox/email-web-library": "0.6.0",
79
+ "@sharadox/icon-web-library": "^0.6.1",
80
+ "@sharadox/web-library": "0.10.0"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": ">=19"
@@ -1,11 +0,0 @@
1
- import type { ContactAcknowledgement } from "@sharadox/form-web-library/contact-action/type";
2
- /**
3
- * The automatic reply every site's contact form sends, in English and Portuguese, with the same words everywhere:
4
- * "We received your message", thanks by name, a reply within one working day, the message back, and a button to the
5
- * site (`site`, its address, opened in the visitor's language).
6
- *
7
- * @example
8
- * createContactAction({ ..., acknowledgement: contactAcknowledgement("https://sharadox.com") });
9
- */
10
- export declare function contactAcknowledgement(site: string): Readonly<Record<"en" | "pt", ContactAcknowledgement>>;
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-acknowledgement/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,EAAE,sBAAsB,CAAC,CAAC,CA2B1G"}
@@ -1,37 +0,0 @@
1
- /**
2
- * The automatic reply every site's contact form sends, in English and Portuguese, with the same words everywhere:
3
- * "We received your message", thanks by name, a reply within one working day, the message back, and a button to the
4
- * site (`site`, its address, opened in the visitor's language).
5
- *
6
- * @example
7
- * createContactAction({ ..., acknowledgement: contactAcknowledgement("https://sharadox.com") });
8
- */
9
- export function contactAcknowledgement(site) {
10
- const address = new URL(site);
11
- const page = (locale) => new URL(`/${locale}`, address).href;
12
- return {
13
- en: {
14
- subject: "We received your message",
15
- eyebrow: "Message received",
16
- heading: (name) => `Thank you, ${name}.`,
17
- paragraphs: [
18
- "Your message reached us, and we'll get back to you shortly, usually within one working day.",
19
- "Anything to add? Just reply to this email.",
20
- ],
21
- messageLabel: "Your message",
22
- button: { label: `Visit ${address.host}`, href: page("en") },
23
- },
24
- pt: {
25
- subject: "Recebemos a sua mensagem",
26
- eyebrow: "Mensagem recebida",
27
- heading: (name) => `Obrigado, ${name}.`,
28
- paragraphs: [
29
- "A sua mensagem chegou até nós, e respondemos em breve, normalmente num dia útil.",
30
- "Quer acrescentar alguma coisa? Basta responder a este email.",
31
- ],
32
- messageLabel: "A sua mensagem",
33
- button: { label: `Visitar ${address.host}`, href: page("pt") },
34
- },
35
- };
36
- }
37
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-acknowledgement/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,IAAI,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IACrE,OAAO;QACL,EAAE,EAAE;YACF,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE,kBAAkB;YAC3B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,IAAI,GAAG;YACxC,UAAU,EAAE;gBACV,6FAA6F;gBAC7F,4CAA4C;aAC7C;YACD,YAAY,EAAE,cAAc;YAC5B,MAAM,EAAE,EAAE,KAAK,EAAE,SAAS,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;SAC7D;QACD,EAAE,EAAE;YACF,OAAO,EAAE,0BAA0B;YACnC,OAAO,EAAE,mBAAmB;YAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,IAAI,GAAG;YACvC,UAAU,EAAE;gBACV,kFAAkF;gBAClF,8DAA8D;aAC/D;YACD,YAAY,EAAE,gBAAgB;YAC9B,MAAM,EAAE,EAAE,KAAK,EAAE,WAAW,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE;SAC/D;KACF,CAAC;AACJ,CAAC"}