@saasquatch/mint-components 1.14.6-3 → 1.14.6-30
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-40f0bc74.js → ShadowViewAddon-cfd0e201.js} +115 -48
- 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} +140 -22
- 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 +12 -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 +8 -10
- package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +62 -2
- package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +56 -50
- package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +89 -34
- 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 +34 -3
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +32 -6
- package/dist/esm/{ShadowViewAddon-8a0d9e83.js → ShadowViewAddon-00515b50.js} +116 -50
- 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} +140 -23
- 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 +12 -2
- package/dist/esm/sqm-stencilbook.entry.js +12 -5
- package/dist/esm-es5/ShadowViewAddon-00515b50.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-0c67bb1b.entry.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-6544656d.system.js +1 -0
- package/dist/mint-components/p-6ae07d04.system.entry.js +1 -0
- package/dist/mint-components/p-6ba44ca9.js +1 -0
- package/dist/mint-components/p-72f136da.system.entry.js +1 -0
- package/dist/mint-components/{p-e358f0c1.entry.js → p-76e7034c.entry.js} +28 -20
- package/dist/mint-components/{p-cd1c6113.entry.js → p-ad24132a.entry.js} +2 -2
- package/dist/mint-components/p-d3144467.system.entry.js +1 -0
- package/dist/mint-components/{p-4139feb5.js → p-eb9ecf25.js} +24 -24
- 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 +10 -1
- 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 +22 -9
- 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 -0
- package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +2 -1
- package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
- package/dist/types/components.d.ts +71 -19
- package/dist/types/global/android.d.ts +7 -0
- package/dist/types/global/demo.d.ts +2 -0
- package/dist/types/stories/features.d.ts +4 -0
- package/dist/types/stories/templates.d.ts +4 -0
- 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 -75
- package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
- package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -71
- package/dist/esm-es5/ShadowViewAddon-8a0d9e83.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-13c67985.system.entry.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-4d5b02af.js +0 -1
- package/dist/mint-components/p-87384d9e.system.js +0 -1
- package/dist/mint-components/p-875861d7.system.entry.js +0 -1
- package/dist/mint-components/p-8af8ab01.system.entry.js +0 -1
- package/dist/mint-components/p-9e1570bf.system.entry.js +0 -1
- package/dist/mint-components/p-ad6420a2.system.js +0 -1
- package/dist/mint-components/p-b8c15858.entry.js +0 -1
- package/dist/mint-components/p-f59d6012.entry.js +0 -1
|
@@ -27,11 +27,20 @@ export class LeadDropdownField {
|
|
|
27
27
|
* @uiWidget textArea
|
|
28
28
|
*/
|
|
29
29
|
this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
|
|
30
|
+
/**
|
|
31
|
+
* @uiName Optional label
|
|
32
|
+
*/
|
|
33
|
+
this.optionalLabel = "(Optional)";
|
|
30
34
|
/**
|
|
31
35
|
* @uiName Optional
|
|
32
36
|
* @default
|
|
33
37
|
*/
|
|
34
38
|
this.dropdownOptional = false;
|
|
39
|
+
/**
|
|
40
|
+
* @uiName Multiple selection
|
|
41
|
+
* @default
|
|
42
|
+
*/
|
|
43
|
+
this.multiple = false;
|
|
35
44
|
withHooks(this);
|
|
36
45
|
}
|
|
37
46
|
disconnectedCallback() { }
|
|
@@ -125,6 +134,27 @@ export class LeadDropdownField {
|
|
|
125
134
|
"reflect": false,
|
|
126
135
|
"defaultValue": "\"Please select a {dropdownLabel}\""
|
|
127
136
|
},
|
|
137
|
+
"optionalLabel": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"mutable": false,
|
|
140
|
+
"complexType": {
|
|
141
|
+
"original": "string",
|
|
142
|
+
"resolved": "string",
|
|
143
|
+
"references": {}
|
|
144
|
+
},
|
|
145
|
+
"required": false,
|
|
146
|
+
"optional": false,
|
|
147
|
+
"docs": {
|
|
148
|
+
"tags": [{
|
|
149
|
+
"text": "Optional label",
|
|
150
|
+
"name": "uiName"
|
|
151
|
+
}],
|
|
152
|
+
"text": ""
|
|
153
|
+
},
|
|
154
|
+
"attribute": "optional-label",
|
|
155
|
+
"reflect": false,
|
|
156
|
+
"defaultValue": "\"(Optional)\""
|
|
157
|
+
},
|
|
128
158
|
"dropdownOptional": {
|
|
129
159
|
"type": "boolean",
|
|
130
160
|
"mutable": false,
|
|
@@ -134,7 +164,7 @@ export class LeadDropdownField {
|
|
|
134
164
|
"references": {}
|
|
135
165
|
},
|
|
136
166
|
"required": false,
|
|
137
|
-
"optional":
|
|
167
|
+
"optional": false,
|
|
138
168
|
"docs": {
|
|
139
169
|
"tags": [{
|
|
140
170
|
"text": "Optional",
|
|
@@ -149,12 +179,36 @@ export class LeadDropdownField {
|
|
|
149
179
|
"reflect": false,
|
|
150
180
|
"defaultValue": "false"
|
|
151
181
|
},
|
|
182
|
+
"multiple": {
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"mutable": false,
|
|
185
|
+
"complexType": {
|
|
186
|
+
"original": "boolean",
|
|
187
|
+
"resolved": "boolean",
|
|
188
|
+
"references": {}
|
|
189
|
+
},
|
|
190
|
+
"required": false,
|
|
191
|
+
"optional": false,
|
|
192
|
+
"docs": {
|
|
193
|
+
"tags": [{
|
|
194
|
+
"text": "Multiple selection",
|
|
195
|
+
"name": "uiName"
|
|
196
|
+
}, {
|
|
197
|
+
"text": undefined,
|
|
198
|
+
"name": "default"
|
|
199
|
+
}],
|
|
200
|
+
"text": ""
|
|
201
|
+
},
|
|
202
|
+
"attribute": "multiple",
|
|
203
|
+
"reflect": false,
|
|
204
|
+
"defaultValue": "false"
|
|
205
|
+
},
|
|
152
206
|
"demoData": {
|
|
153
207
|
"type": "unknown",
|
|
154
208
|
"mutable": false,
|
|
155
209
|
"complexType": {
|
|
156
210
|
"original": "DemoData<DropdownFieldViewProps>",
|
|
157
|
-
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional
|
|
211
|
+
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { dropdownName: string; dropdownLabel: string; dropdownOptional: boolean; optionalLabel: string; multiple: boolean; requiredFieldErrorMessage?: string; selectOptions?: VNode | VNode[]; }; }",
|
|
158
212
|
"references": {
|
|
159
213
|
"DemoData": {
|
|
160
214
|
"location": "import",
|
|
@@ -189,5 +243,11 @@ function useLeadDropdownFieldDemo(props) {
|
|
|
189
243
|
states: {
|
|
190
244
|
leadFormState: {},
|
|
191
245
|
},
|
|
246
|
+
content: {
|
|
247
|
+
dropdownName: props.dropdownName,
|
|
248
|
+
dropdownLabel: props.dropdownLabel,
|
|
249
|
+
requiredFieldErrorMessage: props.requiredFieldErrorMessage,
|
|
250
|
+
dropdownOptional: props.dropdownOptional,
|
|
251
|
+
},
|
|
192
252
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
193
253
|
}
|
|
@@ -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,6 +61,7 @@ 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;
|
|
64
|
+
console.log({ states });
|
|
54
65
|
if (states.error) {
|
|
55
66
|
window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
|
|
56
67
|
}
|
|
@@ -60,8 +71,8 @@ export function LeadFormView(props) {
|
|
|
60
71
|
}, {
|
|
61
72
|
fieldLabel,
|
|
62
73
|
});
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
return (h(Fragment, null,
|
|
75
|
+
states.success && (h("div", { class: sheet.classes.Wrapper, part: "sqm-base" },
|
|
65
76
|
h("style", { type: "text/css" },
|
|
66
77
|
vanillaStyle,
|
|
67
78
|
styleString),
|
|
@@ -70,49 +81,44 @@ export function LeadFormView(props) {
|
|
|
70
81
|
h("b", null, content.submitSuccessHeader),
|
|
71
82
|
h("br", null),
|
|
72
83
|
h("div", { part: "successalert-text" }, content.submitSuccessDescription)),
|
|
73
|
-
h("sl-button", {
|
|
74
|
-
|
|
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
|
-
h("input", { type: "hidden", hidden: true, name: "/rsReferralCode", value: states.referralCode }),
|
|
115
|
-
content.formData,
|
|
116
|
-
h("div", { class: sheet.classes.ButtonsContainer },
|
|
117
|
-
h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register")))));
|
|
84
|
+
h("sl-button", { class: sheet.classes.ContinueButton, onClick: callbacks.resetForm, loading: states.loading, exportparts: "base: primarybutton-base", type: "default" }, content.resubmitFormLabel))),
|
|
85
|
+
h("div", { class: sheet.classes.Wrapper, part: "sqm-base", style: { display: states.success ? "none" : "block" } },
|
|
86
|
+
h("style", { type: "text/css" },
|
|
87
|
+
vanillaStyle,
|
|
88
|
+
styleString),
|
|
89
|
+
h(TextSpanView, { type: "h3" }, content.pageLabel),
|
|
90
|
+
h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
|
|
91
|
+
states.error && (h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "danger", class: sheet.classes.ErrorAlertContainer, open: true },
|
|
92
|
+
h("sl-icon", { slot: "icon", name: "exclamation-octagon" }),
|
|
93
|
+
h("b", null, content.submitErrorHeader),
|
|
94
|
+
h("br", null),
|
|
95
|
+
intl.formatMessage({
|
|
96
|
+
id: "submitErrorDescription",
|
|
97
|
+
defaultMessage: content.submitErrorDescription,
|
|
98
|
+
}, {
|
|
99
|
+
supportLink: (h("a", { target: "_blank", href: `mailto:advocate-support@impact.com` }, content.supportLinkText)),
|
|
100
|
+
}))),
|
|
101
|
+
h("div", { class: sheet.classes.NameFieldWrapper },
|
|
102
|
+
h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.firstNameLabel || "First Name", "field-name": "firstName" }),
|
|
103
|
+
h("sqm-lead-input-field", { class: sheet.classes.NameInput, "field-label": content.lastNameLabel || "Last Name", "field-name": "lastName" })),
|
|
104
|
+
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 }) => {
|
|
105
|
+
if (!value) {
|
|
106
|
+
return getRequiredFieldErrorMessage({
|
|
107
|
+
fieldLabel: content.emailLabel || "Email",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
// this matches shoelace validation, but could be better
|
|
111
|
+
if (!value.includes("@")) {
|
|
112
|
+
return content.invalidEmailErrorMessage;
|
|
113
|
+
}
|
|
114
|
+
} }, (((_b = (_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ? {
|
|
115
|
+
class: sheet.classes.ErrorStyle,
|
|
116
|
+
helpText: ((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.email) ||
|
|
117
|
+
content.requiredFieldErrorMessage,
|
|
118
|
+
}
|
|
119
|
+
: []))),
|
|
120
|
+
h("input", { type: "hidden", hidden: true, name: "/referralCode", value: states.referralCode }),
|
|
121
|
+
content.formData,
|
|
122
|
+
h("div", { class: sheet.classes.ButtonsContainer },
|
|
123
|
+
h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register"))))));
|
|
118
124
|
}
|
|
@@ -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,56 @@ export class LeadForm {
|
|
|
35
35
|
* @uiName Header text
|
|
36
36
|
*/
|
|
37
37
|
this.pageLabel = "Refer your friend";
|
|
38
|
+
/**
|
|
39
|
+
* @uiName Optional label
|
|
40
|
+
*/
|
|
41
|
+
this.optionalLabel = "(Optional)";
|
|
42
|
+
/**
|
|
43
|
+
* Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
|
|
44
|
+
* @uiName Form key
|
|
45
|
+
*/
|
|
38
46
|
this.formKey = "lead-form";
|
|
39
47
|
/**
|
|
40
|
-
* Optional support link for error messages.
|
|
48
|
+
* Optional support link text for error messages.
|
|
49
|
+
* @uiName Support link text
|
|
41
50
|
*/
|
|
42
|
-
this.
|
|
51
|
+
this.supportLinkText = "Support";
|
|
43
52
|
/**
|
|
44
|
-
* Header text shown on successful submission.
|
|
53
|
+
* Header text shown on successful lead submission.
|
|
54
|
+
* @uiName Submit success header
|
|
45
55
|
*/
|
|
46
|
-
this.submitSuccessHeader = "
|
|
56
|
+
this.submitSuccessHeader = "Lead submitted";
|
|
47
57
|
/**
|
|
48
|
-
* Description text shown on successful submission.
|
|
58
|
+
* Description text shown on successful lead submission.
|
|
59
|
+
* @uiName Submit success description
|
|
49
60
|
*/
|
|
50
61
|
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
62
|
/**
|
|
52
|
-
*
|
|
63
|
+
* Header text shown if an error occurs.
|
|
64
|
+
* @uiName Submit error header
|
|
53
65
|
*/
|
|
54
66
|
this.submitErrorHeader = "An error occurred while submitting";
|
|
55
67
|
/**
|
|
56
|
-
* Description text shown
|
|
68
|
+
* Description text shown if an error occurs.
|
|
69
|
+
* @uiName Submit error description
|
|
57
70
|
*/
|
|
58
71
|
this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
|
|
59
72
|
/**
|
|
60
|
-
* The message to be displayed
|
|
73
|
+
* The message to be displayed if a required field is not filled.
|
|
61
74
|
*
|
|
62
75
|
* @uiName Required field message
|
|
63
76
|
* @uiWidget textArea
|
|
64
77
|
*/
|
|
65
78
|
this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
|
|
66
79
|
/**
|
|
67
|
-
* The message to be displayed
|
|
80
|
+
* The message to be displayed if a the form submission fails unexpectedly.
|
|
68
81
|
*
|
|
69
82
|
* @uiName Network error message
|
|
70
83
|
* @uiWidget textArea
|
|
71
84
|
*/
|
|
72
85
|
this.networkErrorMessage = "Network request failed.";
|
|
73
86
|
/**
|
|
74
|
-
* The message to be displayed
|
|
87
|
+
* The message to be displayed if the email used is invalid.
|
|
75
88
|
*
|
|
76
89
|
* @uiName Invalid email message
|
|
77
90
|
* @uiWidget textArea
|
|
@@ -90,13 +103,15 @@ export class LeadForm {
|
|
|
90
103
|
submitLabel: this.submitLabel,
|
|
91
104
|
resubmitFormLabel: this.resubmitFormLabel,
|
|
92
105
|
pageLabel: this.pageLabel,
|
|
93
|
-
|
|
106
|
+
supportLinkText: this.supportLinkText,
|
|
94
107
|
submitSuccessHeader: this.submitSuccessHeader,
|
|
95
108
|
submitSuccessDescription: this.submitSuccessDescription,
|
|
96
109
|
submitErrorHeader: this.submitErrorHeader,
|
|
97
110
|
submitErrorDescription: this.submitErrorDescription,
|
|
98
111
|
invalidEmailErrorMessage: this.invalidEmailErrorMessage,
|
|
99
112
|
requiredFieldErrorMessage: this.requiredFieldErrorMessage,
|
|
113
|
+
firstNameLabel: this.firstNameLabel,
|
|
114
|
+
lastNameLabel: this.lastNameLabel,
|
|
100
115
|
};
|
|
101
116
|
return (h(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
|
|
102
117
|
}
|
|
@@ -143,7 +158,7 @@ export class LeadForm {
|
|
|
143
158
|
},
|
|
144
159
|
"attribute": "first-name-label",
|
|
145
160
|
"reflect": false,
|
|
146
|
-
"defaultValue": "\"First
|
|
161
|
+
"defaultValue": "\"First name\""
|
|
147
162
|
},
|
|
148
163
|
"lastNameLabel": {
|
|
149
164
|
"type": "string",
|
|
@@ -164,7 +179,7 @@ export class LeadForm {
|
|
|
164
179
|
},
|
|
165
180
|
"attribute": "last-name-label",
|
|
166
181
|
"reflect": false,
|
|
167
|
-
"defaultValue": "\"Last
|
|
182
|
+
"defaultValue": "\"Last name\""
|
|
168
183
|
},
|
|
169
184
|
"submitLabel": {
|
|
170
185
|
"type": "string",
|
|
@@ -229,7 +244,7 @@ export class LeadForm {
|
|
|
229
244
|
"reflect": false,
|
|
230
245
|
"defaultValue": "\"Refer your friend\""
|
|
231
246
|
},
|
|
232
|
-
"
|
|
247
|
+
"optionalLabel": {
|
|
233
248
|
"type": "string",
|
|
234
249
|
"mutable": false,
|
|
235
250
|
"complexType": {
|
|
@@ -240,14 +255,38 @@ export class LeadForm {
|
|
|
240
255
|
"required": false,
|
|
241
256
|
"optional": false,
|
|
242
257
|
"docs": {
|
|
243
|
-
"tags": [
|
|
258
|
+
"tags": [{
|
|
259
|
+
"text": "Optional label",
|
|
260
|
+
"name": "uiName"
|
|
261
|
+
}],
|
|
244
262
|
"text": ""
|
|
245
263
|
},
|
|
264
|
+
"attribute": "optional-label",
|
|
265
|
+
"reflect": false,
|
|
266
|
+
"defaultValue": "\"(Optional)\""
|
|
267
|
+
},
|
|
268
|
+
"formKey": {
|
|
269
|
+
"type": "string",
|
|
270
|
+
"mutable": false,
|
|
271
|
+
"complexType": {
|
|
272
|
+
"original": "string",
|
|
273
|
+
"resolved": "string",
|
|
274
|
+
"references": {}
|
|
275
|
+
},
|
|
276
|
+
"required": false,
|
|
277
|
+
"optional": false,
|
|
278
|
+
"docs": {
|
|
279
|
+
"tags": [{
|
|
280
|
+
"text": "Form key",
|
|
281
|
+
"name": "uiName"
|
|
282
|
+
}],
|
|
283
|
+
"text": "Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms."
|
|
284
|
+
},
|
|
246
285
|
"attribute": "form-key",
|
|
247
286
|
"reflect": false,
|
|
248
287
|
"defaultValue": "\"lead-form\""
|
|
249
288
|
},
|
|
250
|
-
"
|
|
289
|
+
"supportLinkText": {
|
|
251
290
|
"type": "string",
|
|
252
291
|
"mutable": false,
|
|
253
292
|
"complexType": {
|
|
@@ -258,10 +297,13 @@ export class LeadForm {
|
|
|
258
297
|
"required": false,
|
|
259
298
|
"optional": false,
|
|
260
299
|
"docs": {
|
|
261
|
-
"tags": [
|
|
262
|
-
|
|
300
|
+
"tags": [{
|
|
301
|
+
"text": "Support link text",
|
|
302
|
+
"name": "uiName"
|
|
303
|
+
}],
|
|
304
|
+
"text": "Optional support link text for error messages."
|
|
263
305
|
},
|
|
264
|
-
"attribute": "support-link",
|
|
306
|
+
"attribute": "support-link-text",
|
|
265
307
|
"reflect": false,
|
|
266
308
|
"defaultValue": "\"Support\""
|
|
267
309
|
},
|
|
@@ -276,12 +318,15 @@ export class LeadForm {
|
|
|
276
318
|
"required": false,
|
|
277
319
|
"optional": false,
|
|
278
320
|
"docs": {
|
|
279
|
-
"tags": [
|
|
280
|
-
|
|
321
|
+
"tags": [{
|
|
322
|
+
"text": "Submit success header",
|
|
323
|
+
"name": "uiName"
|
|
324
|
+
}],
|
|
325
|
+
"text": "Header text shown on successful lead submission."
|
|
281
326
|
},
|
|
282
327
|
"attribute": "submit-success-header",
|
|
283
328
|
"reflect": false,
|
|
284
|
-
"defaultValue": "\"
|
|
329
|
+
"defaultValue": "\"Lead submitted\""
|
|
285
330
|
},
|
|
286
331
|
"submitSuccessDescription": {
|
|
287
332
|
"type": "string",
|
|
@@ -294,8 +339,11 @@ export class LeadForm {
|
|
|
294
339
|
"required": false,
|
|
295
340
|
"optional": false,
|
|
296
341
|
"docs": {
|
|
297
|
-
"tags": [
|
|
298
|
-
|
|
342
|
+
"tags": [{
|
|
343
|
+
"text": "Submit success description",
|
|
344
|
+
"name": "uiName"
|
|
345
|
+
}],
|
|
346
|
+
"text": "Description text shown on successful lead submission."
|
|
299
347
|
},
|
|
300
348
|
"attribute": "submit-success-description",
|
|
301
349
|
"reflect": false,
|
|
@@ -312,8 +360,11 @@ export class LeadForm {
|
|
|
312
360
|
"required": false,
|
|
313
361
|
"optional": false,
|
|
314
362
|
"docs": {
|
|
315
|
-
"tags": [
|
|
316
|
-
|
|
363
|
+
"tags": [{
|
|
364
|
+
"text": "Submit error header",
|
|
365
|
+
"name": "uiName"
|
|
366
|
+
}],
|
|
367
|
+
"text": "Header text shown if an error occurs."
|
|
317
368
|
},
|
|
318
369
|
"attribute": "submit-error-header",
|
|
319
370
|
"reflect": false,
|
|
@@ -330,8 +381,11 @@ export class LeadForm {
|
|
|
330
381
|
"required": false,
|
|
331
382
|
"optional": false,
|
|
332
383
|
"docs": {
|
|
333
|
-
"tags": [
|
|
334
|
-
|
|
384
|
+
"tags": [{
|
|
385
|
+
"text": "Submit error description",
|
|
386
|
+
"name": "uiName"
|
|
387
|
+
}],
|
|
388
|
+
"text": "Description text shown if an error occurs."
|
|
335
389
|
},
|
|
336
390
|
"attribute": "submit-error-description",
|
|
337
391
|
"reflect": false,
|
|
@@ -355,7 +409,7 @@ export class LeadForm {
|
|
|
355
409
|
"text": "textArea",
|
|
356
410
|
"name": "uiWidget"
|
|
357
411
|
}],
|
|
358
|
-
"text": "The message to be displayed
|
|
412
|
+
"text": "The message to be displayed if a required field is not filled."
|
|
359
413
|
},
|
|
360
414
|
"attribute": "required-field-error-message",
|
|
361
415
|
"reflect": false,
|
|
@@ -379,7 +433,7 @@ export class LeadForm {
|
|
|
379
433
|
"text": "textArea",
|
|
380
434
|
"name": "uiWidget"
|
|
381
435
|
}],
|
|
382
|
-
"text": "The message to be displayed
|
|
436
|
+
"text": "The message to be displayed if a the form submission fails unexpectedly."
|
|
383
437
|
},
|
|
384
438
|
"attribute": "network-error-message",
|
|
385
439
|
"reflect": false,
|
|
@@ -403,7 +457,7 @@ export class LeadForm {
|
|
|
403
457
|
"text": "textArea",
|
|
404
458
|
"name": "uiWidget"
|
|
405
459
|
}],
|
|
406
|
-
"text": "The message to be displayed
|
|
460
|
+
"text": "The message to be displayed if the email used is invalid."
|
|
407
461
|
},
|
|
408
462
|
"attribute": "invalid-email-error-message",
|
|
409
463
|
"reflect": false,
|
|
@@ -414,7 +468,7 @@ export class LeadForm {
|
|
|
414
468
|
"mutable": false,
|
|
415
469
|
"complexType": {
|
|
416
470
|
"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;
|
|
471
|
+
"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
472
|
"references": {
|
|
419
473
|
"DemoData": {
|
|
420
474
|
"location": "import",
|
|
@@ -456,6 +510,7 @@ function useRegisterDemo(props) {
|
|
|
456
510
|
console.log("submit");
|
|
457
511
|
},
|
|
458
512
|
inputFunction: () => { },
|
|
513
|
+
resetForm: () => { },
|
|
459
514
|
},
|
|
460
515
|
refs: {
|
|
461
516
|
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
|
: [])))));
|
|
@@ -15,6 +15,10 @@ import { useLeadInputField } from "./useLeadInputField";
|
|
|
15
15
|
export class LeadInputField {
|
|
16
16
|
constructor() {
|
|
17
17
|
this.ignored = true;
|
|
18
|
+
/**
|
|
19
|
+
* @uiName Optional label
|
|
20
|
+
*/
|
|
21
|
+
this.optionalLabel = "(Optional)";
|
|
18
22
|
/**
|
|
19
23
|
* @uiName Input type
|
|
20
24
|
* @uiType string
|
|
@@ -28,7 +32,7 @@ export class LeadInputField {
|
|
|
28
32
|
* @uiName Required field message
|
|
29
33
|
* @uiWidget textArea
|
|
30
34
|
*/
|
|
31
|
-
this.requiredFieldErrorMessage = "Please enter a {
|
|
35
|
+
this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
|
|
32
36
|
/**
|
|
33
37
|
* @uiName Optional
|
|
34
38
|
* @default
|
|
@@ -100,6 +104,27 @@ export class LeadInputField {
|
|
|
100
104
|
"attribute": "field-label",
|
|
101
105
|
"reflect": false
|
|
102
106
|
},
|
|
107
|
+
"optionalLabel": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"mutable": false,
|
|
110
|
+
"complexType": {
|
|
111
|
+
"original": "string",
|
|
112
|
+
"resolved": "string",
|
|
113
|
+
"references": {}
|
|
114
|
+
},
|
|
115
|
+
"required": false,
|
|
116
|
+
"optional": false,
|
|
117
|
+
"docs": {
|
|
118
|
+
"tags": [{
|
|
119
|
+
"text": "Optional label",
|
|
120
|
+
"name": "uiName"
|
|
121
|
+
}],
|
|
122
|
+
"text": ""
|
|
123
|
+
},
|
|
124
|
+
"attribute": "optional-label",
|
|
125
|
+
"reflect": false,
|
|
126
|
+
"defaultValue": "\"(Optional)\""
|
|
127
|
+
},
|
|
103
128
|
"fieldType": {
|
|
104
129
|
"type": "string",
|
|
105
130
|
"mutable": false,
|
|
@@ -152,7 +177,7 @@ export class LeadInputField {
|
|
|
152
177
|
},
|
|
153
178
|
"attribute": "required-field-error-message",
|
|
154
179
|
"reflect": false,
|
|
155
|
-
"defaultValue": "\"Please enter a {
|
|
180
|
+
"defaultValue": "\"Please enter a {fieldLabel}\""
|
|
156
181
|
},
|
|
157
182
|
"fieldOptional": {
|
|
158
183
|
"type": "boolean",
|
|
@@ -183,7 +208,7 @@ export class LeadInputField {
|
|
|
183
208
|
"mutable": false,
|
|
184
209
|
"complexType": {
|
|
185
210
|
"original": "DemoData<LeadInputFieldViewProps>",
|
|
186
|
-
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
|
|
211
|
+
"resolved": "{ states?: { leadFormState?: LeadFormState; }; content?: { fieldName: string; fieldLabel: string; optionalLabel: string; fieldType: \"text\" | \"date\" | \"tel\"; fieldOptional?: boolean; requiredFieldErrorMessage: string; }; }",
|
|
187
212
|
"references": {
|
|
188
213
|
"DemoData": {
|
|
189
214
|
"location": "import",
|
|
@@ -218,5 +243,11 @@ function useLeadInputFieldDemo(props) {
|
|
|
218
243
|
states: {
|
|
219
244
|
leadForState: {},
|
|
220
245
|
},
|
|
246
|
+
content: {
|
|
247
|
+
fieldName: props.fieldName,
|
|
248
|
+
fieldLabel: props.fieldLabel,
|
|
249
|
+
fieldType: props.fieldType,
|
|
250
|
+
requiredFieldErrorMessage: props.requiredFieldErrorMessage,
|
|
251
|
+
},
|
|
221
252
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
222
253
|
}
|