@saasquatch/mint-components 1.14.6-9 → 1.14.6
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/cjs/{ShadowViewAddon-d1dda2b0.js → ShadowViewAddon-3c344355.js} +116 -49
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-big-stat_42.cjs.entry.js → sqm-big-stat_43.cjs.entry.js} +118 -25
- package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
- package/dist/cjs/sqm-lead-input-field.cjs.entry.js +6 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
- package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
- package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
- package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
- package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +10 -10
- package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +57 -5
- package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +55 -51
- package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +65 -35
- package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
- package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +28 -5
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +15 -10
- package/dist/esm/{ShadowViewAddon-81771102.js → ShadowViewAddon-64194d20.js} +117 -51
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_43.entry.js} +118 -26
- package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
- package/dist/esm/sqm-lead-input-field.entry.js +6 -2
- package/dist/esm/sqm-stencilbook.entry.js +12 -5
- package/dist/esm-es5/ShadowViewAddon-64194d20.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
- package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
- package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-01dd541f.system.js +1 -0
- package/dist/mint-components/{p-b2ff8561.entry.js → p-0a4f1306.entry.js} +21 -21
- package/dist/mint-components/p-0d94d81a.system.js +1 -0
- package/dist/mint-components/{p-460974bf.js → p-30a11ec0.js} +24 -24
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-6ba44ca9.js +1 -0
- package/dist/mint-components/p-74fdf750.system.entry.js +1 -0
- package/dist/mint-components/p-d3e72503.entry.js +1 -0
- package/dist/mint-components/p-eaf1a8a6.system.entry.js +1 -0
- package/dist/mint-components/{p-ba585a4b.entry.js → p-f60d1ae9.entry.js} +2 -2
- package/dist/mint-components/p-fbbb85f0.system.entry.js +1 -0
- package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
- package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
- package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +11 -4
- package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
- package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +19 -10
- package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
- package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -2
- package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +1 -0
- package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
- package/dist/types/components.d.ts +63 -19
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
- package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -81
- package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
- package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -77
- package/dist/esm-es5/ShadowViewAddon-81771102.js +0 -1
- package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
- package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
- package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
- package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
- package/dist/mint-components/p-15f1ff1d.system.js +0 -1
- package/dist/mint-components/p-26da31c6.js +0 -1
- package/dist/mint-components/p-4056c0ea.system.entry.js +0 -1
- package/dist/mint-components/p-4d5b02af.js +0 -1
- package/dist/mint-components/p-59970cb1.system.entry.js +0 -1
- package/dist/mint-components/p-6b093d8c.entry.js +0 -1
- package/dist/mint-components/p-7094012d.system.entry.js +0 -1
- package/dist/mint-components/p-87384d9e.system.js +0 -1
- package/dist/mint-components/p-ad128614.system.js +0 -1
- package/dist/mint-components/p-c5a55554.entry.js +0 -1
- package/dist/mint-components/p-de5356d9.system.entry.js +0 -1
|
@@ -9,9 +9,7 @@ import { useLeadDropdownField } from "./useLeadDropdownField";
|
|
|
9
9
|
/**
|
|
10
10
|
* @uiName Lead Form Dropdown Field
|
|
11
11
|
* @validParents ["sqm-lead-form"]
|
|
12
|
-
* @slots [{"name":"", "title":"
|
|
13
|
-
* @exampleGroup Microsite Components
|
|
14
|
-
* @example Lead Form Dropdown Field - <sqm-lead-dropdown-field dropdown-label="Select an option" required-field-error-message="Please select an option"><sl-menu-item value="option-1">Option 1</sl-menu-item><sl-menu-item value="option-2">Option 2</sl-menu-item><sl-menu-item value="option-3">Option 3</sl-menu-item></sqm-lead-dropdown-field>
|
|
12
|
+
* @slots [{"name":"", "title":"Dropdown Option"}]
|
|
15
13
|
*/
|
|
16
14
|
export class LeadDropdownField {
|
|
17
15
|
constructor() {
|
|
@@ -27,11 +25,20 @@ export class LeadDropdownField {
|
|
|
27
25
|
* @uiWidget textArea
|
|
28
26
|
*/
|
|
29
27
|
this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
|
|
28
|
+
/**
|
|
29
|
+
* @uiName Optional label
|
|
30
|
+
*/
|
|
31
|
+
this.optionalLabel = "(optional)";
|
|
30
32
|
/**
|
|
31
33
|
* @uiName Optional
|
|
32
34
|
* @default
|
|
33
35
|
*/
|
|
34
36
|
this.dropdownOptional = false;
|
|
37
|
+
/**
|
|
38
|
+
* @uiName Multiple selection
|
|
39
|
+
* @default
|
|
40
|
+
*/
|
|
41
|
+
this.multiple = false;
|
|
35
42
|
withHooks(this);
|
|
36
43
|
}
|
|
37
44
|
disconnectedCallback() { }
|
|
@@ -125,6 +132,27 @@ export class LeadDropdownField {
|
|
|
125
132
|
"reflect": false,
|
|
126
133
|
"defaultValue": "\"Please select a {dropdownLabel}\""
|
|
127
134
|
},
|
|
135
|
+
"optionalLabel": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [{
|
|
147
|
+
"text": "Optional label",
|
|
148
|
+
"name": "uiName"
|
|
149
|
+
}],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"attribute": "optional-label",
|
|
153
|
+
"reflect": false,
|
|
154
|
+
"defaultValue": "\"(optional)\""
|
|
155
|
+
},
|
|
128
156
|
"dropdownOptional": {
|
|
129
157
|
"type": "boolean",
|
|
130
158
|
"mutable": false,
|
|
@@ -134,7 +162,7 @@ export class LeadDropdownField {
|
|
|
134
162
|
"references": {}
|
|
135
163
|
},
|
|
136
164
|
"required": false,
|
|
137
|
-
"optional":
|
|
165
|
+
"optional": false,
|
|
138
166
|
"docs": {
|
|
139
167
|
"tags": [{
|
|
140
168
|
"text": "Optional",
|
|
@@ -149,12 +177,36 @@ export class LeadDropdownField {
|
|
|
149
177
|
"reflect": false,
|
|
150
178
|
"defaultValue": "false"
|
|
151
179
|
},
|
|
180
|
+
"multiple": {
|
|
181
|
+
"type": "boolean",
|
|
182
|
+
"mutable": false,
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "boolean",
|
|
185
|
+
"resolved": "boolean",
|
|
186
|
+
"references": {}
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"optional": false,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [{
|
|
192
|
+
"text": "Multiple selection",
|
|
193
|
+
"name": "uiName"
|
|
194
|
+
}, {
|
|
195
|
+
"text": undefined,
|
|
196
|
+
"name": "default"
|
|
197
|
+
}],
|
|
198
|
+
"text": ""
|
|
199
|
+
},
|
|
200
|
+
"attribute": "multiple",
|
|
201
|
+
"reflect": false,
|
|
202
|
+
"defaultValue": "false"
|
|
203
|
+
},
|
|
152
204
|
"demoData": {
|
|
153
205
|
"type": "unknown",
|
|
154
206
|
"mutable": false,
|
|
155
207
|
"complexType": {
|
|
156
208
|
"original": "DemoData<DropdownFieldViewProps>",
|
|
157
|
-
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional
|
|
209
|
+
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional: boolean; optionalLabel: string; multiple: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
|
|
158
210
|
"references": {
|
|
159
211
|
"DemoData": {
|
|
160
212
|
"location": "import",
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { h } from "@stencil/core";
|
|
1
|
+
import { Fragment, h } from "@stencil/core";
|
|
2
|
+
import { intl } from "../../global/global";
|
|
2
3
|
import { AuthButtonsContainer, AuthColumn, AuthWrapper, ErrorStyles, HostBlock, } from "../../global/mixins";
|
|
3
4
|
import { createStyleSheet } from "../../styling/JSS";
|
|
4
5
|
import { TextSpanView } from "../sqm-text-span/sqm-text-span-view";
|
|
5
|
-
import { intl } from "../../global/global";
|
|
6
6
|
const style = {
|
|
7
|
-
Wrapper: {
|
|
7
|
+
Wrapper: {
|
|
8
|
+
...AuthWrapper,
|
|
9
|
+
"max-width": "600px",
|
|
10
|
+
border: "none",
|
|
11
|
+
margin: "0",
|
|
12
|
+
},
|
|
8
13
|
Column: AuthColumn,
|
|
9
14
|
HostBlock: HostBlock,
|
|
10
15
|
":host": {
|
|
@@ -14,6 +19,7 @@ const style = {
|
|
|
14
19
|
NameFieldWrapper: {
|
|
15
20
|
display: "flex",
|
|
16
21
|
gap: "var(--sl-spacing-medium)",
|
|
22
|
+
marginBottom: "0 !important",
|
|
17
23
|
},
|
|
18
24
|
ContinueButton: { maxWidth: "169px" },
|
|
19
25
|
ButtonsContainer: AuthButtonsContainer,
|
|
@@ -29,6 +35,10 @@ const style = {
|
|
|
29
35
|
borderTop: "none",
|
|
30
36
|
},
|
|
31
37
|
},
|
|
38
|
+
NameInput: {
|
|
39
|
+
marginBottom: "0",
|
|
40
|
+
width: "50%",
|
|
41
|
+
},
|
|
32
42
|
ErrorStyle: ErrorStyles,
|
|
33
43
|
};
|
|
34
44
|
const vanillaStyle = `
|
|
@@ -51,7 +61,6 @@ const styleString = sheet.toString();
|
|
|
51
61
|
export function LeadFormView(props) {
|
|
52
62
|
var _a, _b, _c, _d;
|
|
53
63
|
const { states, refs, callbacks, content } = props;
|
|
54
|
-
console.log({ states });
|
|
55
64
|
if (states.error) {
|
|
56
65
|
window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
|
57
66
|
}
|
|
@@ -61,8 +70,8 @@ export function LeadFormView(props) {
|
|
|
61
70
|
}, {
|
|
62
71
|
fieldLabel,
|
|
63
72
|
});
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
return (h(Fragment, null,
|
|
74
|
+
states.success && (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
|
|
66
75
|
h("style", { type: "text/css" },
|
|
67
76
|
vanillaStyle,
|
|
68
77
|
styleString),
|
|
@@ -71,49 +80,44 @@ export function LeadFormView(props) {
|
|
|
71
80
|
h("b", null, content.submitSuccessHeader),
|
|
72
81
|
h("br", null),
|
|
73
82
|
h("div", { part: "successalert-text" }, content.submitSuccessDescription)),
|
|
74
|
-
h("sl-button", {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
: []))),
|
|
115
|
-
h("input", { type: "hidden", hidden: true, name: "/rsReferralCode", value: states.referralCode }),
|
|
116
|
-
content.formData,
|
|
117
|
-
h("div", { class: sheet.classes.ButtonsContainer },
|
|
118
|
-
h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register")))));
|
|
83
|
+
h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
|
|
84
|
+
h("div", { class: sheet.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
|
|
85
|
+
h("style", { type: "text/css" },
|
|
86
|
+
vanillaStyle,
|
|
87
|
+
styleString),
|
|
88
|
+
h(TextSpanView, { type: "h3" }, content.pageLabel),
|
|
89
|
+
h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
|
|
90
|
+
states.error && (h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", class: sheet.classes.ErrorAlertContainer, open: true },
|
|
91
|
+
h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
92
|
+
h("b", null, content.submitErrorHeader),
|
|
93
|
+
h("br", null),
|
|
94
|
+
intl.formatMessage({
|
|
95
|
+
id: "submitErrorDescription",
|
|
96
|
+
defaultMessage: content.submitErrorDescription,
|
|
97
|
+
}, {
|
|
98
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, content.supportLinkText)),
|
|
99
|
+
}))),
|
|
100
|
+
h("div", { class: sheet.classes.NameFieldWrapper },
|
|
101
|
+
h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.firstNameLabel || "First Name", "field-name": "firstName" }),
|
|
102
|
+
h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.lastNameLabel || "Last Name", "field-name": "lastName" })),
|
|
103
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", disabled: states.loading, required: true, validationError: ({ value }) => {
|
|
104
|
+
if (!value) {
|
|
105
|
+
return getRequiredFieldErrorMessage({
|
|
106
|
+
fieldLabel: content.emailLabel || "Email",
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// this matches shoelace validation, but could be better
|
|
110
|
+
if (!value.includes("@")) {
|
|
111
|
+
return content.invalidEmailErrorMessage;
|
|
112
|
+
}
|
|
113
|
+
} }, (((_b = (_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ? {
|
|
114
|
+
class: sheet.classes.ErrorStyle,
|
|
115
|
+
helpText: ((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.email) ||
|
|
116
|
+
content.requiredFieldErrorMessage,
|
|
117
|
+
}
|
|
118
|
+
: []))),
|
|
119
|
+
h("input", { type: "hidden", hidden: true, name: "/referralCode", value: states.referralCode }),
|
|
120
|
+
content.formData,
|
|
121
|
+
h("div", { class: sheet.classes.ButtonsContainer },
|
|
122
|
+
h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register"))))));
|
|
119
123
|
}
|
|
@@ -6,7 +6,7 @@ import { LeadFormView } from "./sqm-lead-form-view";
|
|
|
6
6
|
import { useLeadForm } from "./useLeadForm";
|
|
7
7
|
/**
|
|
8
8
|
* @uiName Lead Form
|
|
9
|
-
* @slots [{"name":"formData","title":"Additional Fields"}
|
|
9
|
+
* @slots [{"name":"formData","title":"Additional Fields"}]
|
|
10
10
|
*/
|
|
11
11
|
export class LeadForm {
|
|
12
12
|
constructor() {
|
|
@@ -18,11 +18,11 @@ export class LeadForm {
|
|
|
18
18
|
/**
|
|
19
19
|
* @uiName First Name field label
|
|
20
20
|
*/
|
|
21
|
-
this.firstNameLabel = "First
|
|
21
|
+
this.firstNameLabel = "First name";
|
|
22
22
|
/**
|
|
23
23
|
* @uiName Last Name field label
|
|
24
24
|
*/
|
|
25
|
-
this.lastNameLabel = "Last
|
|
25
|
+
this.lastNameLabel = "Last name";
|
|
26
26
|
/**
|
|
27
27
|
* @uiName Submit button text
|
|
28
28
|
*/
|
|
@@ -35,43 +35,52 @@ export class LeadForm {
|
|
|
35
35
|
* @uiName Header text
|
|
36
36
|
*/
|
|
37
37
|
this.pageLabel = "Refer your friend";
|
|
38
|
+
/**
|
|
39
|
+
* Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
|
|
40
|
+
* @uiName Form key
|
|
41
|
+
*/
|
|
38
42
|
this.formKey = "lead-form";
|
|
39
43
|
/**
|
|
40
|
-
* Optional support link for error messages.
|
|
44
|
+
* Optional support link text for error messages.
|
|
45
|
+
* @uiName Support link text
|
|
41
46
|
*/
|
|
42
|
-
this.
|
|
47
|
+
this.supportLinkText = "Support";
|
|
43
48
|
/**
|
|
44
|
-
* Header text shown on successful submission.
|
|
49
|
+
* Header text shown on successful lead submission.
|
|
50
|
+
* @uiName Submit success header
|
|
45
51
|
*/
|
|
46
|
-
this.submitSuccessHeader = "
|
|
52
|
+
this.submitSuccessHeader = "Lead submitted";
|
|
47
53
|
/**
|
|
48
|
-
* Description text shown on successful submission.
|
|
54
|
+
* Description text shown on successful lead submission.
|
|
55
|
+
* @uiName Submit success description
|
|
49
56
|
*/
|
|
50
57
|
this.submitSuccessDescription = "Our team will contact your friend to see if they’re a good fit. In the meantime, you can track this referral on Activity page.";
|
|
51
58
|
/**
|
|
52
|
-
*
|
|
59
|
+
* Header text shown if an error occurs.
|
|
60
|
+
* @uiName Submit error header
|
|
53
61
|
*/
|
|
54
62
|
this.submitErrorHeader = "An error occurred while submitting";
|
|
55
63
|
/**
|
|
56
|
-
* Description text shown
|
|
64
|
+
* Description text shown if an error occurs.
|
|
65
|
+
* @uiName Submit error description
|
|
57
66
|
*/
|
|
58
67
|
this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
|
|
59
68
|
/**
|
|
60
|
-
* The message to be displayed
|
|
69
|
+
* The message to be displayed if a required field is not filled.
|
|
61
70
|
*
|
|
62
71
|
* @uiName Required field message
|
|
63
72
|
* @uiWidget textArea
|
|
64
73
|
*/
|
|
65
74
|
this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
|
|
66
75
|
/**
|
|
67
|
-
* The message to be displayed
|
|
76
|
+
* The message to be displayed if a the form submission fails unexpectedly.
|
|
68
77
|
*
|
|
69
78
|
* @uiName Network error message
|
|
70
79
|
* @uiWidget textArea
|
|
71
80
|
*/
|
|
72
81
|
this.networkErrorMessage = "Network request failed.";
|
|
73
82
|
/**
|
|
74
|
-
* The message to be displayed
|
|
83
|
+
* The message to be displayed if the email used is invalid.
|
|
75
84
|
*
|
|
76
85
|
* @uiName Invalid email message
|
|
77
86
|
* @uiWidget textArea
|
|
@@ -90,13 +99,15 @@ export class LeadForm {
|
|
|
90
99
|
submitLabel: this.submitLabel,
|
|
91
100
|
resubmitFormLabel: this.resubmitFormLabel,
|
|
92
101
|
pageLabel: this.pageLabel,
|
|
93
|
-
|
|
102
|
+
supportLinkText: this.supportLinkText,
|
|
94
103
|
submitSuccessHeader: this.submitSuccessHeader,
|
|
95
104
|
submitSuccessDescription: this.submitSuccessDescription,
|
|
96
105
|
submitErrorHeader: this.submitErrorHeader,
|
|
97
106
|
submitErrorDescription: this.submitErrorDescription,
|
|
98
107
|
invalidEmailErrorMessage: this.invalidEmailErrorMessage,
|
|
99
108
|
requiredFieldErrorMessage: this.requiredFieldErrorMessage,
|
|
109
|
+
firstNameLabel: this.firstNameLabel,
|
|
110
|
+
lastNameLabel: this.lastNameLabel,
|
|
100
111
|
};
|
|
101
112
|
return (h(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
|
|
102
113
|
}
|
|
@@ -143,7 +154,7 @@ export class LeadForm {
|
|
|
143
154
|
},
|
|
144
155
|
"attribute": "first-name-label",
|
|
145
156
|
"reflect": false,
|
|
146
|
-
"defaultValue": "\"First
|
|
157
|
+
"defaultValue": "\"First name\""
|
|
147
158
|
},
|
|
148
159
|
"lastNameLabel": {
|
|
149
160
|
"type": "string",
|
|
@@ -164,7 +175,7 @@ export class LeadForm {
|
|
|
164
175
|
},
|
|
165
176
|
"attribute": "last-name-label",
|
|
166
177
|
"reflect": false,
|
|
167
|
-
"defaultValue": "\"Last
|
|
178
|
+
"defaultValue": "\"Last name\""
|
|
168
179
|
},
|
|
169
180
|
"submitLabel": {
|
|
170
181
|
"type": "string",
|
|
@@ -240,14 +251,17 @@ export class LeadForm {
|
|
|
240
251
|
"required": false,
|
|
241
252
|
"optional": false,
|
|
242
253
|
"docs": {
|
|
243
|
-
"tags": [
|
|
244
|
-
|
|
254
|
+
"tags": [{
|
|
255
|
+
"text": "Form key",
|
|
256
|
+
"name": "uiName"
|
|
257
|
+
}],
|
|
258
|
+
"text": "Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms."
|
|
245
259
|
},
|
|
246
260
|
"attribute": "form-key",
|
|
247
261
|
"reflect": false,
|
|
248
262
|
"defaultValue": "\"lead-form\""
|
|
249
263
|
},
|
|
250
|
-
"
|
|
264
|
+
"supportLinkText": {
|
|
251
265
|
"type": "string",
|
|
252
266
|
"mutable": false,
|
|
253
267
|
"complexType": {
|
|
@@ -258,10 +272,13 @@ export class LeadForm {
|
|
|
258
272
|
"required": false,
|
|
259
273
|
"optional": false,
|
|
260
274
|
"docs": {
|
|
261
|
-
"tags": [
|
|
262
|
-
|
|
275
|
+
"tags": [{
|
|
276
|
+
"text": "Support link text",
|
|
277
|
+
"name": "uiName"
|
|
278
|
+
}],
|
|
279
|
+
"text": "Optional support link text for error messages."
|
|
263
280
|
},
|
|
264
|
-
"attribute": "support-link",
|
|
281
|
+
"attribute": "support-link-text",
|
|
265
282
|
"reflect": false,
|
|
266
283
|
"defaultValue": "\"Support\""
|
|
267
284
|
},
|
|
@@ -276,12 +293,15 @@ export class LeadForm {
|
|
|
276
293
|
"required": false,
|
|
277
294
|
"optional": false,
|
|
278
295
|
"docs": {
|
|
279
|
-
"tags": [
|
|
280
|
-
|
|
296
|
+
"tags": [{
|
|
297
|
+
"text": "Submit success header",
|
|
298
|
+
"name": "uiName"
|
|
299
|
+
}],
|
|
300
|
+
"text": "Header text shown on successful lead submission."
|
|
281
301
|
},
|
|
282
302
|
"attribute": "submit-success-header",
|
|
283
303
|
"reflect": false,
|
|
284
|
-
"defaultValue": "\"
|
|
304
|
+
"defaultValue": "\"Lead submitted\""
|
|
285
305
|
},
|
|
286
306
|
"submitSuccessDescription": {
|
|
287
307
|
"type": "string",
|
|
@@ -294,8 +314,11 @@ export class LeadForm {
|
|
|
294
314
|
"required": false,
|
|
295
315
|
"optional": false,
|
|
296
316
|
"docs": {
|
|
297
|
-
"tags": [
|
|
298
|
-
|
|
317
|
+
"tags": [{
|
|
318
|
+
"text": "Submit success description",
|
|
319
|
+
"name": "uiName"
|
|
320
|
+
}],
|
|
321
|
+
"text": "Description text shown on successful lead submission."
|
|
299
322
|
},
|
|
300
323
|
"attribute": "submit-success-description",
|
|
301
324
|
"reflect": false,
|
|
@@ -312,8 +335,11 @@ export class LeadForm {
|
|
|
312
335
|
"required": false,
|
|
313
336
|
"optional": false,
|
|
314
337
|
"docs": {
|
|
315
|
-
"tags": [
|
|
316
|
-
|
|
338
|
+
"tags": [{
|
|
339
|
+
"text": "Submit error header",
|
|
340
|
+
"name": "uiName"
|
|
341
|
+
}],
|
|
342
|
+
"text": "Header text shown if an error occurs."
|
|
317
343
|
},
|
|
318
344
|
"attribute": "submit-error-header",
|
|
319
345
|
"reflect": false,
|
|
@@ -330,8 +356,11 @@ export class LeadForm {
|
|
|
330
356
|
"required": false,
|
|
331
357
|
"optional": false,
|
|
332
358
|
"docs": {
|
|
333
|
-
"tags": [
|
|
334
|
-
|
|
359
|
+
"tags": [{
|
|
360
|
+
"text": "Submit error description",
|
|
361
|
+
"name": "uiName"
|
|
362
|
+
}],
|
|
363
|
+
"text": "Description text shown if an error occurs."
|
|
335
364
|
},
|
|
336
365
|
"attribute": "submit-error-description",
|
|
337
366
|
"reflect": false,
|
|
@@ -355,7 +384,7 @@ export class LeadForm {
|
|
|
355
384
|
"text": "textArea",
|
|
356
385
|
"name": "uiWidget"
|
|
357
386
|
}],
|
|
358
|
-
"text": "The message to be displayed
|
|
387
|
+
"text": "The message to be displayed if a required field is not filled."
|
|
359
388
|
},
|
|
360
389
|
"attribute": "required-field-error-message",
|
|
361
390
|
"reflect": false,
|
|
@@ -379,7 +408,7 @@ export class LeadForm {
|
|
|
379
408
|
"text": "textArea",
|
|
380
409
|
"name": "uiWidget"
|
|
381
410
|
}],
|
|
382
|
-
"text": "The message to be displayed
|
|
411
|
+
"text": "The message to be displayed if a the form submission fails unexpectedly."
|
|
383
412
|
},
|
|
384
413
|
"attribute": "network-error-message",
|
|
385
414
|
"reflect": false,
|
|
@@ -403,7 +432,7 @@ export class LeadForm {
|
|
|
403
432
|
"text": "textArea",
|
|
404
433
|
"name": "uiWidget"
|
|
405
434
|
}],
|
|
406
|
-
"text": "The message to be displayed
|
|
435
|
+
"text": "The message to be displayed if the email used is invalid."
|
|
407
436
|
},
|
|
408
437
|
"attribute": "invalid-email-error-message",
|
|
409
438
|
"reflect": false,
|
|
@@ -414,7 +443,7 @@ export class LeadForm {
|
|
|
414
443
|
"mutable": false,
|
|
415
444
|
"complexType": {
|
|
416
445
|
"original": "DemoData<LeadFormViewProps>",
|
|
417
|
-
"resolved": "{ states?: { error: string; success: boolean; loading: boolean; leadFormState: LeadFormState; referralCode: string; }; refs?: { formRef: any; }; content?: { formData?: VNode; emailLabel?: string; firstNameLabel?: string; lastNameLabel?: string; submitLabel?: string; resubmitFormLabel?: string; pageLabel?: string;
|
|
446
|
+
"resolved": "{ states?: { error: string; success: boolean; loading: boolean; leadFormState: LeadFormState; referralCode: string; }; refs?: { formRef: any; }; content?: { formData?: VNode; emailLabel?: string; firstNameLabel?: string; lastNameLabel?: string; submitLabel?: string; resubmitFormLabel?: string; pageLabel?: string; supportLinkText?: string; submitSuccessHeader?: string; submitSuccessDescription?: string; submitErrorHeader?: string; submitErrorDescription?: string; requiredFieldErrorMessage: string; invalidEmailErrorMessage: string; }; }",
|
|
418
447
|
"references": {
|
|
419
448
|
"DemoData": {
|
|
420
449
|
"location": "import",
|
|
@@ -456,6 +485,7 @@ function useRegisterDemo(props) {
|
|
|
456
485
|
console.log("submit");
|
|
457
486
|
},
|
|
458
487
|
inputFunction: () => { },
|
|
488
|
+
resetForm: () => { },
|
|
459
489
|
},
|
|
460
490
|
refs: {
|
|
461
491
|
formRef: {},
|
|
@@ -6,7 +6,7 @@ import { ErrorStyles } from "../../global/mixins";
|
|
|
6
6
|
const style = {
|
|
7
7
|
ErrorStyle: ErrorStyles,
|
|
8
8
|
FieldContainer: {
|
|
9
|
-
"margin-bottom": "var(--sl-spacing-
|
|
9
|
+
"margin-bottom": "var(--sl-spacing-medium)",
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
const vanillaStyle = `
|
|
@@ -23,24 +23,24 @@ export function LeadInputFieldView(props) {
|
|
|
23
23
|
var _a, _b, _c, _d, _e, _f;
|
|
24
24
|
const { states, content } = props;
|
|
25
25
|
const getRequiredFieldErrorMessage = ({ fieldLabel, }) => intl.formatMessage({
|
|
26
|
-
id:
|
|
26
|
+
id: `requiredFieldErrorMessage-${fieldLabel}`,
|
|
27
27
|
defaultMessage: content.requiredFieldErrorMessage,
|
|
28
28
|
}, {
|
|
29
29
|
fieldLabel,
|
|
30
30
|
});
|
|
31
|
-
return (h("div", { part: "sqm-base" },
|
|
31
|
+
return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
32
32
|
h("style", { type: "text/css" },
|
|
33
33
|
vanillaStyle,
|
|
34
34
|
styleString),
|
|
35
|
-
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
|
|
36
|
-
if (!value) {
|
|
35
|
+
h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: `${content.fieldLabel}${content.fieldOptional ? ` ${content.optionalLabel}` : ""}` }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
|
|
36
|
+
if (!value && !content.fieldOptional) {
|
|
37
37
|
return getRequiredFieldErrorMessage({
|
|
38
38
|
fieldLabel: content.fieldLabel,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
} }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.
|
|
41
|
+
} }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.fieldName]) ? {
|
|
42
42
|
class: sheet.classes.ErrorStyle,
|
|
43
|
-
helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.
|
|
43
|
+
helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.fieldName]) ||
|
|
44
44
|
content.requiredFieldErrorMessage,
|
|
45
45
|
}
|
|
46
46
|
: [])))));
|
|
@@ -9,12 +9,14 @@ import { useLeadInputField } from "./useLeadInputField";
|
|
|
9
9
|
/**
|
|
10
10
|
* @uiName Lead Form Input Field
|
|
11
11
|
* @validParents ["sqm-lead-form"]
|
|
12
|
-
* @exampleGroup Microsite Components
|
|
13
|
-
* @example Lead Form Input Field - <sqm-input-field input-label="Field Label" field-type="text" error-message="Cannot be empty"></sqm-input-field>
|
|
14
12
|
*/
|
|
15
13
|
export class LeadInputField {
|
|
16
14
|
constructor() {
|
|
17
15
|
this.ignored = true;
|
|
16
|
+
/**
|
|
17
|
+
* @uiName Optional label
|
|
18
|
+
*/
|
|
19
|
+
this.optionalLabel = "(optional)";
|
|
18
20
|
/**
|
|
19
21
|
* @uiName Input type
|
|
20
22
|
* @uiType string
|
|
@@ -28,7 +30,7 @@ export class LeadInputField {
|
|
|
28
30
|
* @uiName Required field message
|
|
29
31
|
* @uiWidget textArea
|
|
30
32
|
*/
|
|
31
|
-
this.requiredFieldErrorMessage = "Please enter a {
|
|
33
|
+
this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
|
|
32
34
|
/**
|
|
33
35
|
* @uiName Optional
|
|
34
36
|
* @default
|
|
@@ -100,6 +102,27 @@ export class LeadInputField {
|
|
|
100
102
|
"attribute": "field-label",
|
|
101
103
|
"reflect": false
|
|
102
104
|
},
|
|
105
|
+
"optionalLabel": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"mutable": false,
|
|
108
|
+
"complexType": {
|
|
109
|
+
"original": "string",
|
|
110
|
+
"resolved": "string",
|
|
111
|
+
"references": {}
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"optional": false,
|
|
115
|
+
"docs": {
|
|
116
|
+
"tags": [{
|
|
117
|
+
"text": "Optional label",
|
|
118
|
+
"name": "uiName"
|
|
119
|
+
}],
|
|
120
|
+
"text": ""
|
|
121
|
+
},
|
|
122
|
+
"attribute": "optional-label",
|
|
123
|
+
"reflect": false,
|
|
124
|
+
"defaultValue": "\"(optional)\""
|
|
125
|
+
},
|
|
103
126
|
"fieldType": {
|
|
104
127
|
"type": "string",
|
|
105
128
|
"mutable": false,
|
|
@@ -152,7 +175,7 @@ export class LeadInputField {
|
|
|
152
175
|
},
|
|
153
176
|
"attribute": "required-field-error-message",
|
|
154
177
|
"reflect": false,
|
|
155
|
-
"defaultValue": "\"Please enter a {
|
|
178
|
+
"defaultValue": "\"Please enter a {fieldLabel}\""
|
|
156
179
|
},
|
|
157
180
|
"fieldOptional": {
|
|
158
181
|
"type": "boolean",
|
|
@@ -183,7 +206,7 @@ export class LeadInputField {
|
|
|
183
206
|
"mutable": false,
|
|
184
207
|
"complexType": {
|
|
185
208
|
"original": "DemoData<LeadInputFieldViewProps>",
|
|
186
|
-
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
|
|
209
|
+
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; optionalLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
|
|
187
210
|
"references": {
|
|
188
211
|
"DemoData": {
|
|
189
212
|
"location": "import",
|