@sharadox/form-web-library 0.8.0-polish.34 → 0.8.0-polish.36
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 +6 -6
- package/README.md +25 -24
- package/distribution/contact-action/index.d.ts +11 -18
- package/distribution/contact-action/index.d.ts.map +1 -1
- package/distribution/contact-action/index.js +68 -135
- package/distribution/contact-action/index.js.map +1 -1
- package/distribution/contact-action/type.d.ts +28 -57
- package/distribution/contact-action/type.d.ts.map +1 -1
- package/llms.txt +1 -2
- package/package.json +4 -4
- package/distribution/contact-acknowledgement/index.d.ts +0 -11
- package/distribution/contact-acknowledgement/index.d.ts.map +0 -1
- package/distribution/contact-acknowledgement/index.js +0 -37
- package/distribution/contact-acknowledgement/index.js.map +0 -1
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
|
-
-
|
|
8
|
-
- Its subject is
|
|
9
|
-
- It
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
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,24 +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",
|
|
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
|
-
|
|
52
|
-
|
|
50
|
+
darkLogo: async () => ({ content: await readFile(LOGO_DARK), contentType: "image/png", filename: "logo-dark.png" }), // white, for dark themes
|
|
51
|
+
design: EXAMPLE_EMAIL, // the company's EmailDesign (email-web-library): name, logo size, wordmark, signature
|
|
53
52
|
});
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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.
|
|
64
65
|
|
|
65
66
|
```ts
|
|
66
67
|
// the application's server action
|
|
@@ -82,17 +83,17 @@ The email server comes from `EMAIL_SERVER_*` and `EMAIL_SENDER_ADDRESS`.
|
|
|
82
83
|
|
|
83
84
|
## API
|
|
84
85
|
|
|
85
|
-
| Import | Export
|
|
86
|
-
| ------------------- |
|
|
87
|
-
| `…/contact-problem` | `contactProblems({ name, email, phone })`: what a form's contact details still lack
|
|
88
|
-
| `…/choice-request` | `requestChoices(event, choices)`, `useChoiceRequests(event, onRequest)`: a button elsewhere asks the form to tick choices
|
|
89
|
-
| `…/bot-field` | `<BotFields />`: the honeypot and fill-time fields `isLikelyBot` reads
|
|
90
|
-
| `…/contact-action` | `createContactAction(options)` → `(form, ip) => Promise<ContactState>`; `ENGLISH_LABELS`, `
|
|
91
|
-
| `…/parse-contact` | `parseContact(form, { choices?, choiceField?, reach?, requireMessage?, minimumMessageLength?, requireChoice?, fields?, now? })` → `bot`, `invalid` or `valid`
|
|
92
|
-
| `…/contact-check` | `isEmail(text)`, `isPhone(text)`: the rules the action uses, safe in the browser for checks before sending
|
|
93
|
-
| `…/bot-check` | `isLikelyBot(form, { honeypotField?, startedAtField?, minimumFillTime?, now? })`
|
|
94
|
-
| `…/rate-limit` | `createRateLimiter({ window, maximum })` → `(key, now?) => boolean` (kept in memory, per server instance)
|
|
95
|
-
| `…/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)` |
|
|
96
97
|
|
|
97
98
|
## Develop
|
|
98
99
|
|
|
@@ -8,31 +8,24 @@ export declare const PORTUGUESE_LABELS: ContactLabels;
|
|
|
8
8
|
export declare const CONTACT_LABELS: Readonly<Record<string, ContactLabels>>;
|
|
9
9
|
/** Words in the given language: the text itself, its translation, the English one, or the first there is. */
|
|
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
|
|
23
|
-
* the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
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"
|
|
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, design: givenDesign,
|
|
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;
|
|
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;AAKtF,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,WAAW,EACZ,MAAM,gDAAgD,CAAC;AAIxD,oCAAoC;AACpC,eAAO,MAAM,cAAc,EAAE,aAe5B,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,iBAAiB,EAAE,aAe/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;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,EAAE,EACF,OAAO,EACP,UAAoB,EACpB,aAAa,EACb,IAAI,EACJ,QAAQ,EACR,MAAM,EAAE,WAAW,EACnB,OAAY,EACZ,KAAe,EACf,cAAqB,EACrB,oBAAwB,EACxB,aAAqB,EACrB,MAAW,EACX,MAAM,EAAE,WAAgB,EACxB,SAAkD,EAClD,YAAiB,EACjB,iBAAgD,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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
27
|
-
needs: "Pedido",
|
|
28
|
-
language: "Idioma",
|
|
29
|
-
contact: "Contacto",
|
|
36
|
+
needs: "Necessidades",
|
|
30
37
|
message: "Mensagem",
|
|
31
|
-
|
|
32
|
-
|
|
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 };
|
|
@@ -41,56 +46,30 @@ export function textIn(text, locale) {
|
|
|
41
46
|
return text;
|
|
42
47
|
return text[locale] ?? text.en ?? Object.values(text)[0];
|
|
43
48
|
}
|
|
44
|
-
/**
|
|
49
|
+
/** The logo (when the site gives one) and the company's name beside it, when the site gives no design of its own. */
|
|
45
50
|
export const plainDesign = (company) => ({
|
|
46
51
|
name: company,
|
|
47
52
|
logo: { width: 44, height: 44 },
|
|
48
53
|
wordmark: true,
|
|
49
|
-
color: "#000000",
|
|
50
54
|
});
|
|
51
|
-
/** Common languages' names, when the site gives none. */
|
|
52
|
-
export const LANGUAGE_NAMES = {
|
|
53
|
-
en: "English",
|
|
54
|
-
pt: "Português",
|
|
55
|
-
es: "Español",
|
|
56
|
-
fr: "Français",
|
|
57
|
-
de: "Deutsch",
|
|
58
|
-
it: "Italiano",
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* The page the form was sent from, when it is a web address on the site's domain (or a subdomain of it); anything
|
|
62
|
-
* else is left out, so a forged field can't put a link of someone else's in the inbox.
|
|
63
|
-
*/
|
|
64
|
-
export function formPage(value, site) {
|
|
65
|
-
if (typeof value !== "string" || value.length > 500)
|
|
66
|
-
return undefined;
|
|
67
|
-
try {
|
|
68
|
-
const url = new URL(value);
|
|
69
|
-
const host = url.hostname;
|
|
70
|
-
return url.protocol === "https:" && (host === site || host.endsWith(`.${site}`)) ? url.href : undefined;
|
|
71
|
-
}
|
|
72
|
-
catch {
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
55
|
/**
|
|
77
56
|
* Builds the work of a contact form's server action: checks for bots (they get a fake success), validates, limits
|
|
78
|
-
* each address and everyone together per day (`dailyMaximum`, so a flood can't run up the email bill), then
|
|
79
|
-
* the
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
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
|
|
86
65
|
* message optional, add fields and give the email's words in more languages (`labels`).
|
|
87
66
|
*
|
|
88
67
|
* @example
|
|
89
|
-
* const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox"
|
|
68
|
+
* const sendContact = createContactAction({ to: "contact@sharadox.com", company: "Sharadox" });
|
|
90
69
|
* // in a "use server" file:
|
|
91
70
|
* export async function sendContactAction(_: ContactState, form: FormData) { return sendContact(form, ip); }
|
|
92
71
|
*/
|
|
93
|
-
export function createContactAction({ to, company, senderName = company, senderAddress, logo, design: givenDesign,
|
|
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(), }) {
|
|
94
73
|
const allow = createRateLimiter(rateLimit);
|
|
95
74
|
const allowToday = createRateLimiter({ window: 24 * 60 * 60 * 1000, maximum: dailyMaximum });
|
|
96
75
|
const design = givenDesign ?? plainDesign(company);
|
|
@@ -111,115 +90,69 @@ export function createContactAction({ to, company, senderName = company, senderA
|
|
|
111
90
|
if (!allow(ip) || !allowToday("everyone"))
|
|
112
91
|
return { status: "rate-limited" };
|
|
113
92
|
const message = parsed.value;
|
|
114
|
-
// The
|
|
93
|
+
// The email is in the language the visitor used the form in.
|
|
115
94
|
const locale = message.locale;
|
|
116
95
|
const labels = { ...(CONTACT_LABELS[locale] ?? ENGLISH_LABELS), ...givenLabels[locale] };
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const sent = `${now().toISOString().slice(0, 16).replace("T", " ")} UTC`;
|
|
120
|
-
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));
|
|
121
98
|
const who = message.company ? `${message.name} (${message.company})` : message.name;
|
|
122
|
-
const
|
|
123
|
-
// The one thing to do: answer by email, or call when only a phone was left.
|
|
124
|
-
const answer = message.email
|
|
125
|
-
? { label: `${labels.reply} ${firstName}`, href: `mailto:${message.email}` }
|
|
126
|
-
: { label: `${labels.call} ${firstName}`, href: `tel:${message.phone.replace(/[^\d+]/g, "")}` };
|
|
99
|
+
const heading = `${labels.thanks}, ${message.name}.`;
|
|
127
100
|
const rows = [
|
|
128
101
|
{ label: labels.name, value: message.name },
|
|
102
|
+
...(message.company ? [{ label: labels.organization, value: message.company }] : []),
|
|
129
103
|
...(message.email ? [{ label: labels.email, value: message.email, href: `mailto:${message.email}` }] : []),
|
|
130
104
|
...(message.phone
|
|
131
105
|
? [{ label: labels.phone, value: message.phone, href: `tel:${message.phone.replace(/[^\d+]/g, "")}` }]
|
|
132
106
|
: []),
|
|
133
|
-
...(message.company ? [{ label: labels.company, value: message.company }] : []),
|
|
134
107
|
...Object.entries(fields)
|
|
135
108
|
.filter(([field]) => message.fields[field])
|
|
136
109
|
.map(([field, label]) => ({ label: textIn(label, locale), value: message.fields[field] })),
|
|
137
|
-
...(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
...(page ? [{ label: labels.page, value: page, href: page }] : [{ label: labels.page, value: site }]),
|
|
141
|
-
{ label: labels.language, value: language },
|
|
142
|
-
{ label: labels.sent, value: sent },
|
|
143
|
-
{ 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 },
|
|
144
113
|
];
|
|
145
114
|
const text = [
|
|
146
|
-
|
|
147
|
-
|
|
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")),
|
|
148
122
|
"",
|
|
149
|
-
|
|
123
|
+
labels.closing,
|
|
124
|
+
`${company}.`,
|
|
150
125
|
].join("\n");
|
|
151
126
|
try {
|
|
152
127
|
const image = logo ? await logo() : undefined;
|
|
153
|
-
const
|
|
128
|
+
const darkImage = image && darkLogo ? await darkLogo() : undefined;
|
|
129
|
+
const inlineImages = [
|
|
130
|
+
...(image ? [{ id: "logo", ...image }] : []),
|
|
131
|
+
...(darkImage ? [{ id: "logo-dark", ...darkImage }] : []),
|
|
132
|
+
];
|
|
154
133
|
const configuration = readConfiguration();
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
to,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
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),
|
|
166
144
|
text,
|
|
167
145
|
html: emailLayout({
|
|
168
146
|
language: locale,
|
|
169
|
-
preview:
|
|
147
|
+
preview: labels.paragraphs[0] ?? heading,
|
|
170
148
|
eyebrow: labels.contact,
|
|
171
|
-
heading
|
|
149
|
+
heading,
|
|
150
|
+
paragraphs: labels.paragraphs,
|
|
172
151
|
rows,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
footer,
|
|
176
|
-
}, design, Boolean(image)),
|
|
152
|
+
closing: labels.closing,
|
|
153
|
+
}, design, { light: Boolean(image), dark: Boolean(darkImage) }),
|
|
177
154
|
inlineImages,
|
|
178
155
|
});
|
|
179
|
-
// The automatic reply: never stops the message itself from counting as sent.
|
|
180
|
-
const reply = acknowledgement?.[message.locale] ?? Object.values(acknowledgement ?? {})[0];
|
|
181
|
-
if (reply && message.email) {
|
|
182
|
-
try {
|
|
183
|
-
await sender.send({
|
|
184
|
-
from,
|
|
185
|
-
to: { name: oneLine(message.name), address: message.email },
|
|
186
|
-
replyTo: to,
|
|
187
|
-
// The form's name first, as on every email the form sends: "Contact · We received your message".
|
|
188
|
-
subject: oneLine(separated(labels.contact, reply.subject)).slice(0, 300),
|
|
189
|
-
text: [
|
|
190
|
-
reply.heading(message.name),
|
|
191
|
-
"",
|
|
192
|
-
...reply.paragraphs,
|
|
193
|
-
...(message.message ? ["", `${reply.messageLabel}:`, message.message] : []),
|
|
194
|
-
].join("\n"),
|
|
195
|
-
html: emailLayout({
|
|
196
|
-
language: message.locale,
|
|
197
|
-
preview: reply.paragraphs[0] ?? reply.subject,
|
|
198
|
-
eyebrow: reply.eyebrow,
|
|
199
|
-
heading: reply.heading(message.name),
|
|
200
|
-
paragraphs: reply.paragraphs,
|
|
201
|
-
...(message.message ? { quote: { label: reply.messageLabel, text: message.message } } : {}),
|
|
202
|
-
...(reply.button ? { button: reply.button } : {}),
|
|
203
|
-
// The company's own signature says where it is; without one, a line to its site does.
|
|
204
|
-
...(design.signature?.length
|
|
205
|
-
? {}
|
|
206
|
-
: {
|
|
207
|
-
footer: [
|
|
208
|
-
{
|
|
209
|
-
label: company,
|
|
210
|
-
value: page ? new URL(page).origin.replace("https://", "") : site,
|
|
211
|
-
href: page ? new URL(page).origin : `https://${site}`,
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
}),
|
|
215
|
-
}, design, Boolean(image)),
|
|
216
|
-
inlineImages,
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
catch (error) {
|
|
220
|
-
reportError("contact: the automatic reply failed", error);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
156
|
return { status: "sent" };
|
|
224
157
|
}
|
|
225
158
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW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 @@ 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
|
|
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
|
-
/**
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
|
|
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,38 +32,32 @@ export interface EmailLogo {
|
|
|
55
32
|
filename: string;
|
|
56
33
|
}
|
|
57
34
|
export interface ContactActionOptions {
|
|
58
|
-
/**
|
|
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
|
-
*
|
|
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. */
|
|
66
47
|
senderName?: string;
|
|
67
48
|
/** The sender address (an address the email server may send from); `EMAIL_SENDER_ADDRESS` or the server user. */
|
|
68
49
|
senderAddress?: string;
|
|
69
|
-
/** The company's logo
|
|
50
|
+
/** The company's logo at the top of every email, in black, with a thin white outline for darkened mail apps. */
|
|
70
51
|
logo?: () => Promise<EmailLogo>;
|
|
52
|
+
/** The same logo in white, shown instead where the mail app is in a dark theme (with `logo` only). */
|
|
53
|
+
darkLogo?: () => Promise<EmailLogo>;
|
|
71
54
|
/**
|
|
72
|
-
* What makes the emails the
|
|
73
|
-
* signature), in the one layout every mail app shows alike
|
|
55
|
+
* What makes the emails the company's (email-web-library's `EmailDesign`: its name, its logo's size, whether the
|
|
56
|
+
* name sits beside the logo, its signature), in the one layout every mail app shows alike.
|
|
74
57
|
*/
|
|
75
58
|
design?: EmailDesign;
|
|
76
|
-
/** Each language's name in the email, by code; English names of common languages by default. */
|
|
77
|
-
languageNames?: Readonly<Record<string, string>>;
|
|
78
|
-
/**
|
|
79
|
-
* The automatic reply to visitors who left an email, by language (the form's locale; the first one otherwise). It
|
|
80
|
-
* comes from the same sender, and replying to it reaches `to`. None by default.
|
|
81
|
-
*/
|
|
82
|
-
acknowledgement?: Readonly<Record<string, ContactAcknowledgement>>;
|
|
83
59
|
/** Choices the form may send, and how each is named in the email (in each language, or one); none by default. */
|
|
84
60
|
choices?: Readonly<Record<string, ContactText>>;
|
|
85
|
-
/**
|
|
86
|
-
* The site's domain, for example "sharadox.com". The page the form was sent from (the "page" field) is shown only
|
|
87
|
-
* when it is on this domain or one of its subdomains.
|
|
88
|
-
*/
|
|
89
|
-
site: string;
|
|
90
61
|
/** "email" (the default) requires an email; "email-or-phone" accepts either way of answering. */
|
|
91
62
|
reach?: ContactReach;
|
|
92
63
|
/** False lets the message be empty; true by default. */
|
|
@@ -97,12 +68,12 @@ export interface ContactActionOptions {
|
|
|
97
68
|
requireChoice?: boolean;
|
|
98
69
|
/**
|
|
99
70
|
* Extra single-line fields the form sends, and how each is named in the email (in each language, or one), for
|
|
100
|
-
* example `{ place: { en: "
|
|
71
|
+
* example `{ place: { en: "Place", pt: "Local" } }`.
|
|
101
72
|
*/
|
|
102
73
|
fields?: Readonly<Record<string, ContactText>>;
|
|
103
74
|
/**
|
|
104
|
-
* The email's words in each language, by code, over the built-in English and Portuguese ones. The email the
|
|
105
|
-
*
|
|
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).
|
|
106
77
|
*/
|
|
107
78
|
labels?: Readonly<Record<string, Partial<ContactLabels>>>;
|
|
108
79
|
/** Messages per address per window; 5 per hour by default. */
|
|
@@ -120,7 +91,7 @@ export interface ContactActionOptions {
|
|
|
120
91
|
createSender?: (configuration: EmailServerConfiguration) => EmailSender;
|
|
121
92
|
/** Where failures are reported; `console.error` by default. */
|
|
122
93
|
reportError?: (message: string, error: unknown) => void;
|
|
123
|
-
/**
|
|
124
|
-
|
|
94
|
+
/** A new conversation identifier, a UUID version 7 by default (tests give their own). */
|
|
95
|
+
identifier?: () => string;
|
|
125
96
|
}
|
|
126
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,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAElF,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC;CACjE;AAED,yGAAyG;AACzG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpE,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/contact-action/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACtG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAElF,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC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IAChD,iGAAiG;IACjG,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,wDAAwD;IACxD,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,uEAAuE;IACvE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,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
|
|
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.
|
|
3
|
+
"version": "0.8.0-polish.36",
|
|
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",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@sharadox/es-lint-configuration-web-library": "^0.1.1",
|
|
54
54
|
"@sharadox/library-build-web-library": "^0.1.2",
|
|
55
55
|
"@sharadox/prettier-configuration-web-library": "^0.1.0",
|
|
56
|
-
"@sharadox/turborepo-configuration-web-library": "
|
|
56
|
+
"@sharadox/turborepo-configuration-web-library": "0.1.3-polish.13",
|
|
57
57
|
"@sharadox/type-script-configuration-web-library": "^0.2.0",
|
|
58
58
|
"@sharadox/vitest-configuration-web-library": "^0.1.2",
|
|
59
59
|
"@testing-library/dom": "^10.4.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.
|
|
78
|
+
"@sharadox/email-web-library": "0.6.0-polish.26",
|
|
79
79
|
"@sharadox/icon-web-library": "^0.6.0",
|
|
80
|
-
"@sharadox/web-library": "
|
|
80
|
+
"@sharadox/web-library": "0.10.0-polish.23"
|
|
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"}
|