@sharadox/form-web-library 0.8.0-polish.33 → 0.8.0-polish.34
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 +1 -0
- package/README.md +5 -16
- package/distribution/contact-acknowledgement/index.d.ts +11 -0
- package/distribution/contact-acknowledgement/index.d.ts.map +1 -0
- package/distribution/contact-acknowledgement/index.js +37 -0
- package/distribution/contact-acknowledgement/index.js.map +1 -0
- package/llms.txt +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@ What changed in each version of `@sharadox/form-web-library`, newest first.
|
|
|
9
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
10
|
- The automatic reply's subject starts with the form's name too: "Contact · We received your message".
|
|
11
11
|
- The emails use email-web-library's one simple layout, black on white, so every mail app shows them alike; `plainDesign` is black with the logo and name, and a site's `design` brings only its logo size, color, fonts 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.
|
|
12
13
|
|
|
13
14
|
## 0.6.1
|
|
14
15
|
|
package/README.md
CHANGED
|
@@ -49,30 +49,19 @@ export const sendContact = createContactAction({
|
|
|
49
49
|
choices: { website: "Website", logo: "Logo", other: "Others" },
|
|
50
50
|
logo: async () => ({ content: await readFile(LOGO), contentType: "image/png", filename: "logo.png" }),
|
|
51
51
|
design: EXAMPLE_EMAIL, // the brand's EmailDesign (email-web-library): logo size, color, fonts, signature
|
|
52
|
-
acknowledgement:
|
|
53
|
-
en: {
|
|
54
|
-
subject: "Example · We received your message",
|
|
55
|
-
eyebrow: "Message received",
|
|
56
|
-
heading: (name) => `Thank you, ${name}.`,
|
|
57
|
-
paragraphs: ["We'll get back to you shortly."],
|
|
58
|
-
messageLabel: "Your message",
|
|
59
|
-
button: { label: "Visit example.com", href: "https://example.com" }, // optional
|
|
60
|
-
},
|
|
61
|
-
},
|
|
52
|
+
acknowledgement: contactAcknowledgement("https://example.com"), // the automatic reply every site sends
|
|
62
53
|
});
|
|
63
54
|
```
|
|
64
55
|
|
|
65
56
|
Every email has the same layout, black on white so every mail app shows it alike: the company's logo at the top
|
|
66
|
-
left, the visitor's name in the brand's color
|
|
67
|
-
(and company), every detail they gave, their message, and at the bottom the page the form was sent from, the
|
|
57
|
+
left, the visitor's name (and company) in the brand's color,, every detail they gave, their message, and at the bottom the page the form was sent from, the
|
|
68
58
|
language, the time and the IP address. Replying answers the visitor. With `acknowledgement`, a visitor who left an
|
|
69
59
|
email also gets an automatic reply in their language, with their message, and replying to it reaches the company.
|
|
60
|
+
`contactAcknowledgement(site)` (`…/contact-acknowledgement`) gives every site's reply the same words, in English and
|
|
61
|
+
Portuguese: "Contact · We received your message" ("Contacto · Recebemos a sua mensagem"), thanks by name, a reply
|
|
62
|
+
within one working day, the message back and a button to the site.
|
|
70
63
|
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.
|
|
71
64
|
|
|
72
|
-
```ts
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
|
|
76
65
|
```ts
|
|
77
66
|
// the application's server action
|
|
78
67
|
"use server";
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/llms.txt
CHANGED
|
@@ -14,3 +14,4 @@
|
|
|
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.34",
|
|
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",
|
|
@@ -75,7 +75,7 @@
|
|
|
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.24",
|
|
79
79
|
"@sharadox/icon-web-library": "^0.6.0",
|
|
80
80
|
"@sharadox/web-library": "^0.9.0"
|
|
81
81
|
},
|