@social-mail/social-mail-client 1.2.351 → 1.2.352
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/dist/public/contact-us/ContactUsApp.d.ts +16 -0
- package/dist/public/contact-us/ContactUsApp.d.ts.map +1 -0
- package/dist/public/contact-us/ContactUsApp.js +111 -0
- package/dist/public/contact-us/ContactUsApp.js.map +1 -0
- package/dist/public/contact-us/ContactUsApp.pack.js +13860 -0
- package/dist/public/contact-us/ContactUsApp.pack.js.map +1 -0
- package/dist/public/contact-us/ContactUsApp.pack.min.js +425 -0
- package/dist/public/contact-us/ContactUsApp.pack.min.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/public/contact-us/ContactUsApp.tsx +93 -0
package/package.json
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import Bind from "@web-atoms/core/dist/core/Bind";
|
|
2
|
+
import XNode from "@web-atoms/core/dist/core/XNode";
|
|
3
|
+
import FetchBuilder from "@web-atoms/core/dist/services/FetchBuilder";
|
|
4
|
+
import styled from "@web-atoms/core/dist/style/styled";
|
|
5
|
+
import { AtomControl } from "@web-atoms/core/dist/web/controls/AtomControl";
|
|
6
|
+
import Form from "@web-atoms/web-controls/dist/basic/Form";
|
|
7
|
+
import FormField from "@web-atoms/web-controls/dist/basic/FormField";
|
|
8
|
+
import { EmailIconTextButton } from "../../common/controls/buttons/IconButton";
|
|
9
|
+
import Pack from "@web-atoms/core/dist/Pack";
|
|
10
|
+
import Action from "@web-atoms/core/dist/view-model/Action";
|
|
11
|
+
|
|
12
|
+
styled.css `
|
|
13
|
+
`.installGlobal("contact-us");
|
|
14
|
+
|
|
15
|
+
@Pack
|
|
16
|
+
export default class ContactUsApp extends AtomControl {
|
|
17
|
+
|
|
18
|
+
model = {
|
|
19
|
+
captcha: null,
|
|
20
|
+
name: "",
|
|
21
|
+
email: "",
|
|
22
|
+
phone: "",
|
|
23
|
+
subject: "",
|
|
24
|
+
countryCode: "",
|
|
25
|
+
description: ""
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
constructor(app, e = document.createElement("contact-us")) {
|
|
29
|
+
super(app, e);
|
|
30
|
+
this.runAfterInit(() => this.app.runAsync(() => this.init()));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async init() {
|
|
34
|
+
|
|
35
|
+
const captcha = this.model.captcha = await FetchBuilder.put("/api/users/captcha")
|
|
36
|
+
.responseAsJson<any>();
|
|
37
|
+
|
|
38
|
+
captcha.code = "";
|
|
39
|
+
|
|
40
|
+
this.renderer = <div>
|
|
41
|
+
<Form>
|
|
42
|
+
<FormField label="Your Name"
|
|
43
|
+
error={Bind.oneWay(() => (this.model.name) ? "" : "Name is required")}>
|
|
44
|
+
<input value={Bind.twoWaysImmediate(() => this.model.name)}/>
|
|
45
|
+
</FormField>
|
|
46
|
+
<FormField
|
|
47
|
+
label="Your Email"
|
|
48
|
+
error={Bind.oneWay(() => (this.model.email || this.model.phone) ? "" : "Email or Phone is required")}>
|
|
49
|
+
<input value={Bind.twoWaysImmediate(() => this.model.email)}/>
|
|
50
|
+
</FormField>
|
|
51
|
+
<FormField label="Your Phone"
|
|
52
|
+
error={Bind.oneWay(() => (this.model.email || this.model.phone) ? "" : "Email or Phone is required")}>
|
|
53
|
+
<input value={Bind.twoWaysImmediate(() => this.model.phone)}/>
|
|
54
|
+
</FormField>
|
|
55
|
+
<FormField label="Subject"
|
|
56
|
+
error={Bind.oneWay(() => (this.model.name) ? "" : "Name is required")}>
|
|
57
|
+
<input value={Bind.twoWaysImmediate(() => this.model.subject)}/>
|
|
58
|
+
</FormField>
|
|
59
|
+
<FormField label="Questions">
|
|
60
|
+
<textarea
|
|
61
|
+
rows="8"
|
|
62
|
+
value={Bind.twoWaysImmediate(() => this.model.subject)}/>
|
|
63
|
+
</FormField>
|
|
64
|
+
<FormField
|
|
65
|
+
label="Verify Code"
|
|
66
|
+
error={Bind.oneWay(() => this.model.captcha.code ? "" : "Code is required")}>
|
|
67
|
+
<div data-layout="vertical-flex">
|
|
68
|
+
<img src={`/api/users/captcha/${this.model.captcha.id}/${this.model.captcha.accessCode}`} />
|
|
69
|
+
<input type="tel" value={Bind.twoWaysImmediate(() => this.model.captcha.code)}/>
|
|
70
|
+
</div>
|
|
71
|
+
</FormField>
|
|
72
|
+
<FormField label="">
|
|
73
|
+
<EmailIconTextButton
|
|
74
|
+
data-submit-event="send-email"
|
|
75
|
+
text="Send Email"
|
|
76
|
+
/>
|
|
77
|
+
</FormField>
|
|
78
|
+
</Form>
|
|
79
|
+
</div>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@Action({
|
|
83
|
+
onEvent: "send-email",
|
|
84
|
+
success: "Email sent successfully."
|
|
85
|
+
})
|
|
86
|
+
async sendEmail() {
|
|
87
|
+
await FetchBuilder.post("/api/site/contact")
|
|
88
|
+
.jsonBody(this.model)
|
|
89
|
+
.responseAsJson<any>();
|
|
90
|
+
await this.init();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
}
|