@saasquatch/mint-components 1.14.5 → 1.14.6-1

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.
Files changed (44) hide show
  1. package/dist/cjs/{ShadowViewAddon-787391f7.js → ShadowViewAddon-c0a5fdf8.js} +83 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/{sqm-big-stat_41.cjs.entry.js → sqm-big-stat_42.cjs.entry.js} +218 -3
  5. package/dist/cjs/sqm-stencilbook.cjs.entry.js +115 -3
  6. package/dist/collection/collection-manifest.json +1 -0
  7. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +102 -0
  8. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +85 -0
  9. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +353 -0
  10. package/dist/collection/components/sqm-lead-form/useLeadForm.js +122 -0
  11. package/dist/collection/components/sqm-lead-form/useLeadFormState.js +10 -0
  12. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +2 -0
  13. package/dist/esm/{ShadowViewAddon-cf230f50.js → ShadowViewAddon-aa7177fe.js} +83 -1
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/mint-components.js +1 -1
  16. package/dist/esm/{sqm-big-stat_41.entry.js → sqm-big-stat_42.entry.js} +220 -6
  17. package/dist/esm/sqm-stencilbook.entry.js +115 -3
  18. package/dist/esm-es5/{ShadowViewAddon-cf230f50.js → ShadowViewAddon-aa7177fe.js} +1 -1
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mint-components.js +1 -1
  21. package/dist/esm-es5/sqm-big-stat_42.entry.js +1 -0
  22. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  23. package/dist/mint-components/mint-components.esm.js +1 -1
  24. package/dist/mint-components/p-02a6e0df.system.entry.js +1 -0
  25. package/dist/mint-components/{p-6cc141b9.js → p-373a92a2.js} +1 -1
  26. package/dist/mint-components/p-37996351.system.js +1 -1
  27. package/dist/mint-components/p-72e5e84f.system.js +1 -0
  28. package/dist/mint-components/{p-4d7108af.entry.js → p-8dc110b0.entry.js} +2 -2
  29. package/dist/mint-components/p-cde11800.system.entry.js +1 -0
  30. package/dist/mint-components/{p-f7f8545f.entry.js → p-ede3d2f9.entry.js} +25 -19
  31. package/dist/types/components/sqm-lead-form/LeadForm.stories.d.ts +9 -0
  32. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +28 -0
  33. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +66 -0
  34. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +23 -0
  35. package/dist/types/components/sqm-lead-form/useLeadFormState.d.ts +19 -0
  36. package/dist/types/components.d.ts +114 -0
  37. package/docs/docs.docx +0 -0
  38. package/docs/raisins.json +1 -1
  39. package/grapesjs/grapesjs.js +1 -1
  40. package/package.json +1 -1
  41. package/dist/esm-es5/sqm-big-stat_41.entry.js +0 -1
  42. package/dist/mint-components/p-28c615f2.system.entry.js +0 -1
  43. package/dist/mint-components/p-562428ef.system.js +0 -1
  44. package/dist/mint-components/p-caca540c.system.entry.js +0 -1
@@ -0,0 +1,353 @@
1
+ import { isDemo } from "@saasquatch/component-boilerplate";
2
+ import { withHooks } from "@saasquatch/stencil-hooks";
3
+ import { Component, h, Prop, State } from "@stencil/core";
4
+ import deepmerge from "deepmerge";
5
+ import { LeadFormView } from "./sqm-lead-form-view";
6
+ import { useLeadForm } from "./useLeadForm";
7
+ /**
8
+ * @uiName Lead Form
9
+ * @slots [{"name":"formData","title":"Additional Fields"},{"name":"terms","title":"Terms And Conditions Fields"}]
10
+ */
11
+ export class LeadForm {
12
+ constructor() {
13
+ this.ignored = true;
14
+ /**
15
+ * Redirect participants to this page from their verification email
16
+ *
17
+ * @uiName Submission redirect
18
+ * @uiWidget pageSelect
19
+ */
20
+ this.nextPage = "/";
21
+ /**
22
+ * @uiName Email field label
23
+ */
24
+ this.emailLabel = "Email";
25
+ /**
26
+ * @uiName First Name field label
27
+ */
28
+ this.firstNameLabel = "First Name";
29
+ /**
30
+ * @uiName Last Name field label
31
+ */
32
+ this.lastNameLabel = "Last Name";
33
+ /**
34
+ * @uiName Submit button text
35
+ */
36
+ this.submitLabel = "Submit";
37
+ /**
38
+ * @uiName Header text
39
+ */
40
+ this.pageLabel = "Submit your information";
41
+ this.formKey = "lead-form";
42
+ /**
43
+ * The message to be displayed when a required field is not filled.
44
+ *
45
+ * @uiName Required field message
46
+ * @uiWidget textArea
47
+ */
48
+ this.requiredFieldErrorMessage = "Cannot be empty";
49
+ /**
50
+ * The message to be displayed when a the form submission fails unexpectedly.
51
+ *
52
+ * @uiName Network error message
53
+ * @uiWidget textArea
54
+ */
55
+ this.networkErrorMessage = "Network request failed.";
56
+ /**
57
+ * The message to be displayed when the email used is invalid or blocked.
58
+ *
59
+ * @uiName Invalid email message
60
+ * @uiWidget textArea
61
+ */
62
+ this.invalidEmailErrorMessage = "Must be a valid email address";
63
+ withHooks(this);
64
+ }
65
+ disconnectedCallback() { }
66
+ render() {
67
+ const { states, callbacks, refs } = isDemo()
68
+ ? useRegisterDemo(this)
69
+ : useLeadForm(this);
70
+ const content = {
71
+ formData: h("slot", { name: "formData" }),
72
+ emailLabel: this.emailLabel,
73
+ submitLabel: this.submitLabel,
74
+ pageLabel: this.pageLabel,
75
+ invalidEmailErrorMessage: this.invalidEmailErrorMessage,
76
+ requiredFieldErrorMessage: this.requiredFieldErrorMessage,
77
+ };
78
+ return (h(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
79
+ }
80
+ static get is() { return "sqm-lead-form"; }
81
+ static get encapsulation() { return "shadow"; }
82
+ static get properties() { return {
83
+ "nextPage": {
84
+ "type": "string",
85
+ "mutable": false,
86
+ "complexType": {
87
+ "original": "string",
88
+ "resolved": "string",
89
+ "references": {}
90
+ },
91
+ "required": false,
92
+ "optional": false,
93
+ "docs": {
94
+ "tags": [{
95
+ "text": "Submission redirect",
96
+ "name": "uiName"
97
+ }, {
98
+ "text": "pageSelect",
99
+ "name": "uiWidget"
100
+ }],
101
+ "text": "Redirect participants to this page from their verification email"
102
+ },
103
+ "attribute": "next-page",
104
+ "reflect": false,
105
+ "defaultValue": "\"/\""
106
+ },
107
+ "emailLabel": {
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": "Email field label",
120
+ "name": "uiName"
121
+ }],
122
+ "text": ""
123
+ },
124
+ "attribute": "email-label",
125
+ "reflect": false,
126
+ "defaultValue": "\"Email\""
127
+ },
128
+ "firstNameLabel": {
129
+ "type": "string",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "string",
133
+ "resolved": "string",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [{
140
+ "text": "First Name field label",
141
+ "name": "uiName"
142
+ }],
143
+ "text": ""
144
+ },
145
+ "attribute": "first-name-label",
146
+ "reflect": false,
147
+ "defaultValue": "\"First Name\""
148
+ },
149
+ "lastNameLabel": {
150
+ "type": "string",
151
+ "mutable": false,
152
+ "complexType": {
153
+ "original": "string",
154
+ "resolved": "string",
155
+ "references": {}
156
+ },
157
+ "required": false,
158
+ "optional": false,
159
+ "docs": {
160
+ "tags": [{
161
+ "text": "Last Name field label",
162
+ "name": "uiName"
163
+ }],
164
+ "text": ""
165
+ },
166
+ "attribute": "last-name-label",
167
+ "reflect": false,
168
+ "defaultValue": "\"Last Name\""
169
+ },
170
+ "submitLabel": {
171
+ "type": "string",
172
+ "mutable": false,
173
+ "complexType": {
174
+ "original": "string",
175
+ "resolved": "string",
176
+ "references": {}
177
+ },
178
+ "required": false,
179
+ "optional": false,
180
+ "docs": {
181
+ "tags": [{
182
+ "text": "Submit button text",
183
+ "name": "uiName"
184
+ }],
185
+ "text": ""
186
+ },
187
+ "attribute": "submit-label",
188
+ "reflect": false,
189
+ "defaultValue": "\"Submit\""
190
+ },
191
+ "pageLabel": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [{
203
+ "text": "Header text",
204
+ "name": "uiName"
205
+ }],
206
+ "text": ""
207
+ },
208
+ "attribute": "page-label",
209
+ "reflect": false,
210
+ "defaultValue": "\"Submit your information\""
211
+ },
212
+ "formKey": {
213
+ "type": "string",
214
+ "mutable": false,
215
+ "complexType": {
216
+ "original": "string",
217
+ "resolved": "string",
218
+ "references": {}
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": ""
225
+ },
226
+ "attribute": "form-key",
227
+ "reflect": false,
228
+ "defaultValue": "\"lead-form\""
229
+ },
230
+ "requiredFieldErrorMessage": {
231
+ "type": "string",
232
+ "mutable": false,
233
+ "complexType": {
234
+ "original": "string",
235
+ "resolved": "string",
236
+ "references": {}
237
+ },
238
+ "required": false,
239
+ "optional": false,
240
+ "docs": {
241
+ "tags": [{
242
+ "text": "Required field message",
243
+ "name": "uiName"
244
+ }, {
245
+ "text": "textArea",
246
+ "name": "uiWidget"
247
+ }],
248
+ "text": "The message to be displayed when a required field is not filled."
249
+ },
250
+ "attribute": "required-field-error-message",
251
+ "reflect": false,
252
+ "defaultValue": "\"Cannot be empty\""
253
+ },
254
+ "networkErrorMessage": {
255
+ "type": "string",
256
+ "mutable": false,
257
+ "complexType": {
258
+ "original": "string",
259
+ "resolved": "string",
260
+ "references": {}
261
+ },
262
+ "required": false,
263
+ "optional": false,
264
+ "docs": {
265
+ "tags": [{
266
+ "text": "Network error message",
267
+ "name": "uiName"
268
+ }, {
269
+ "text": "textArea",
270
+ "name": "uiWidget"
271
+ }],
272
+ "text": "The message to be displayed when a the form submission fails unexpectedly."
273
+ },
274
+ "attribute": "network-error-message",
275
+ "reflect": false,
276
+ "defaultValue": "\"Network request failed.\""
277
+ },
278
+ "invalidEmailErrorMessage": {
279
+ "type": "string",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "string",
283
+ "resolved": "string",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [{
290
+ "text": "Invalid email message",
291
+ "name": "uiName"
292
+ }, {
293
+ "text": "textArea",
294
+ "name": "uiWidget"
295
+ }],
296
+ "text": "The message to be displayed when the email used is invalid or blocked."
297
+ },
298
+ "attribute": "invalid-email-error-message",
299
+ "reflect": false,
300
+ "defaultValue": "\"Must be a valid email address\""
301
+ },
302
+ "demoData": {
303
+ "type": "unknown",
304
+ "mutable": false,
305
+ "complexType": {
306
+ "original": "DemoData<LeadFormViewProps>",
307
+ "resolved": "{ states?: { error: string; loading: boolean; leadFormState: LeadFormState; referralCode: string; }; refs?: { formRef: any; }; content?: { formData?: VNode; emailLabel?: string; firstNameLabel?: string; lastNameLabel?: string; submitLabel?: string; pageLabel?: string; requiredFieldErrorMessage: string; invalidEmailErrorMessage: string; }; }",
308
+ "references": {
309
+ "DemoData": {
310
+ "location": "import",
311
+ "path": "../../global/demo"
312
+ },
313
+ "LeadFormViewProps": {
314
+ "location": "import",
315
+ "path": "./sqm-lead-form-view"
316
+ }
317
+ }
318
+ },
319
+ "required": false,
320
+ "optional": true,
321
+ "docs": {
322
+ "tags": [{
323
+ "text": undefined,
324
+ "name": "undocumented"
325
+ }, {
326
+ "text": "object",
327
+ "name": "uiType"
328
+ }],
329
+ "text": ""
330
+ }
331
+ }
332
+ }; }
333
+ static get states() { return {
334
+ "ignored": {}
335
+ }; }
336
+ }
337
+ function useRegisterDemo(props) {
338
+ return deepmerge({
339
+ states: {
340
+ error: "",
341
+ loading: false,
342
+ },
343
+ callbacks: {
344
+ submit: async (_event) => {
345
+ console.log("submit");
346
+ },
347
+ inputFunction: () => { },
348
+ },
349
+ refs: {
350
+ formRef: {},
351
+ },
352
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
353
+ }
@@ -0,0 +1,122 @@
1
+ import { navigation, useMutation } from "@saasquatch/component-boilerplate";
2
+ import { useCallback, useEffect, useRef } from "@saasquatch/universal-hooks";
3
+ import { gql } from "graphql-request";
4
+ import jsonpointer from "jsonpointer";
5
+ import { AsYouType } from "libphonenumber-js";
6
+ import { useLeadFormState } from "./useLeadFormState";
7
+ const SUBMIT_LEAD = gql `
8
+ mutation submitForm($formSubmissionInput: FormSubmissionInput) {
9
+ submitForm(formSubmissionInput: $formSubmissionInput) {
10
+ success
11
+ }
12
+ }
13
+ `;
14
+ export function useLeadForm(props) {
15
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
16
+ const formRef = useRef(null);
17
+ const { leadFormState, setLeadFormState } = useLeadFormState({});
18
+ const [submitLead, { loading, errors, data }] = useMutation(SUBMIT_LEAD);
19
+ useEffect(() => {
20
+ if (!formRef.current)
21
+ return;
22
+ const form = formRef.current;
23
+ form.addEventListener("sl-input", inputFunction);
24
+ return () => {
25
+ form.removeEventListener("sl-input", inputFunction);
26
+ };
27
+ }, [formRef.current]);
28
+ const submit = async (event) => {
29
+ let formControls = event.target.getFormControls();
30
+ let formData = {};
31
+ let validationErrors = {};
32
+ formControls === null || formControls === void 0 ? void 0 : formControls.forEach((control) => {
33
+ if (!control.name)
34
+ return;
35
+ const key = control.name;
36
+ const value = control.value;
37
+ jsonpointer.set(formData, key, value);
38
+ // required validation
39
+ if (control.required && !value) {
40
+ jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
41
+ }
42
+ // custom validation
43
+ if (typeof control.validationError === "function") {
44
+ const validate = control.validationError;
45
+ const validationError = validate({ control, key, value });
46
+ if (validationError)
47
+ jsonpointer.set(validationErrors, key, validationError);
48
+ }
49
+ });
50
+ if (Object.keys(validationErrors).length) {
51
+ setLeadFormState({ loading: false, error: "", validationErrors });
52
+ // early return for validation errors
53
+ return;
54
+ }
55
+ setLeadFormState({
56
+ loading: true,
57
+ error: "",
58
+ validationErrors: {},
59
+ });
60
+ formData = { ...formData };
61
+ const redirectPath = props.nextPage;
62
+ const variables = {
63
+ key: props.formKey,
64
+ formData,
65
+ };
66
+ try {
67
+ const result = await submitLead({ formSubmissionInput: variables });
68
+ if (result instanceof Error) {
69
+ throw result;
70
+ }
71
+ setLeadFormState({
72
+ loading: false,
73
+ error: "",
74
+ validationErrors: {},
75
+ });
76
+ if (result.success) {
77
+ navigation.push(props.nextPage);
78
+ }
79
+ }
80
+ catch (error) {
81
+ setLeadFormState({
82
+ loading: false,
83
+ error: props.networkErrorMessage,
84
+ validationErrors: {},
85
+ });
86
+ }
87
+ };
88
+ const inputFunction = useCallback((e) => {
89
+ var _a, _b;
90
+ const name = (_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.toLowerCase();
91
+ if (name !== "tel")
92
+ return;
93
+ const asYouType = new AsYouType("US");
94
+ e.target.value = asYouType.input(e.target.value);
95
+ }, []);
96
+ let errorMessage = "";
97
+ if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
98
+ errorMessage = props.networkErrorMessage;
99
+ }
100
+ else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors.length)) {
101
+ errorMessage = props.networkErrorMessage;
102
+ }
103
+ else {
104
+ errorMessage =
105
+ ((_f = (_e = (_d = (_c = errors === null || errors === void 0 ? void 0 : errors.response) === null || _c === void 0 ? void 0 : _c.errors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.message) || ((_j = (_h = (_g = errors === null || errors === void 0 ? void 0 : errors.response) === null || _g === void 0 ? void 0 : _g.errors) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.message) || (leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.error);
106
+ }
107
+ return {
108
+ states: {
109
+ loading,
110
+ error: errorMessage,
111
+ leadFormState,
112
+ referralCode: "ABC123",
113
+ },
114
+ callbacks: {
115
+ submit,
116
+ inputFunction,
117
+ },
118
+ refs: {
119
+ formRef,
120
+ },
121
+ };
122
+ }
@@ -0,0 +1,10 @@
1
+ import { useHost } from "@saasquatch/component-boilerplate";
2
+ import { useDomContextState } from "@saasquatch/dom-context-hooks";
3
+ export const LEAD_FORM_STATE_CONTEXT = "sq:lead-form-state";
4
+ const LEAD_FORM_STATE_CONTEXT_INTERNAL = "sq:lead-form-state-internal";
5
+ export function useLeadFormState(formState) {
6
+ const host = useHost();
7
+ const [leadFormState, setLeadFormState] = useDomContextState(host, LEAD_FORM_STATE_CONTEXT, formState);
8
+ useDomContextState(host, LEAD_FORM_STATE_CONTEXT_INTERNAL, [leadFormState, setLeadFormState]);
9
+ return { leadFormState, setLeadFormState };
10
+ }
@@ -97,6 +97,7 @@ import * as BaseRegistrationForm from "../sqm-base-registration/BaseRegistration
97
97
  import * as PortalRegistrationForm from "../sqm-portal-registration-form/PortalRegistrationForm.stories";
98
98
  import * as PortalGoogleRegistrationFormStories from "../sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories";
99
99
  import * as QRCode from "../sqm-qr-code/QRCode.stories";
100
+ import * as LeadForm from "../sqm-lead-form/LeadForm.stories";
100
101
  import * as Themes from "./Themes";
101
102
  import { CucumberAddon } from "./CucumberAddon";
102
103
  import { HookStoryAddon } from "./HookStoryAddon";
@@ -199,6 +200,7 @@ const stories = [
199
200
  PayoutButtonScroll,
200
201
  PayoutStatusAlert,
201
202
  QRCode,
203
+ LeadForm,
202
204
  ];
203
205
  /**
204
206
  * For internal documentation
@@ -4044,6 +4044,88 @@ function CouponCodeView(props) {
4044
4044
  h("div", { part: "erroralert-text" }, props.errorText))) : (h(CopyTextView, Object.assign({}, props)))));
4045
4045
  }
4046
4046
 
4047
+ const style$d = {
4048
+ Wrapper: { ...AuthWrapper, "max-width": "600px" },
4049
+ Column: AuthColumn,
4050
+ HostBlock: HostBlock,
4051
+ ":host": {
4052
+ margin: "0 auto",
4053
+ width: "100%",
4054
+ },
4055
+ ButtonsContainer: AuthButtonsContainer,
4056
+ ErrorStyle: ErrorStyles,
4057
+ };
4058
+ const vanillaStyle$8 = `
4059
+ sqm-portal-register {
4060
+ margin: 0 auto;
4061
+ width: 100%;
4062
+ display: block;
4063
+ }
4064
+
4065
+ :host{
4066
+ display: block;
4067
+ }
4068
+
4069
+ :host([hidden]) {
4070
+ display: none;
4071
+ }
4072
+ `;
4073
+ const sheet$d = createStyleSheet(style$d);
4074
+ const styleString$d = sheet$d.toString();
4075
+ function LeadFormView(props) {
4076
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
4077
+ const { states, refs, callbacks, content } = props;
4078
+ if (states.error) {
4079
+ window.scrollTo({ top: 0, left: 0, behavior: "smooth" });
4080
+ }
4081
+ return (h("div", { class: sheet$d.classes.Wrapper, part: "sqm-base" },
4082
+ h("style", { type: "text/css" },
4083
+ vanillaStyle$8,
4084
+ styleString$d),
4085
+ h(TextSpanView, { type: "h3" }, content.pageLabel),
4086
+ h("sl-form", { class: sheet$d.classes.Column, "onSl-submit": callbacks.submit, ref: (el) => (refs.formRef.current = el), novalidate: true },
4087
+ states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
4088
+ h("div", { part: "erroralert-text" }, props.states.error))),
4089
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "text", name: "/lastName", label: content.firstNameLabel || "First Name", disabled: states.loading, required: true, validationError: ({ value }) => {
4090
+ if (!value) {
4091
+ return content.requiredFieldErrorMessage;
4092
+ }
4093
+ } }, (((_b = (_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors) === null || _b === void 0 ? void 0 : _b.firstName) ? {
4094
+ class: sheet$d.classes.ErrorStyle,
4095
+ helpText: ((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.firstName) ||
4096
+ content.requiredFieldErrorMessage,
4097
+ }
4098
+ : []))),
4099
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "text", name: "/lastName", label: content.lastNameLabel || "Last Name", disabled: states.loading, required: true, validationError: ({ value }) => {
4100
+ if (!value) {
4101
+ return content.requiredFieldErrorMessage;
4102
+ }
4103
+ } }, (((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.lastName) ? {
4104
+ class: sheet$d.classes.ErrorStyle,
4105
+ helpText: ((_h = (_g = states.leadFormState) === null || _g === void 0 ? void 0 : _g.validationErrors) === null || _h === void 0 ? void 0 : _h.lastName) ||
4106
+ content.requiredFieldErrorMessage,
4107
+ }
4108
+ : []))),
4109
+ 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 }) => {
4110
+ if (!value) {
4111
+ return content.requiredFieldErrorMessage;
4112
+ }
4113
+ // this matches shoelace validation, but could be better
4114
+ if (!value.includes("@")) {
4115
+ return content.invalidEmailErrorMessage;
4116
+ }
4117
+ } }, (((_k = (_j = states.leadFormState) === null || _j === void 0 ? void 0 : _j.validationErrors) === null || _k === void 0 ? void 0 : _k.email) ? {
4118
+ class: sheet$d.classes.ErrorStyle,
4119
+ helpText: ((_m = (_l = states.leadFormState) === null || _l === void 0 ? void 0 : _l.validationErrors) === null || _m === void 0 ? void 0 : _m.email) ||
4120
+ content.requiredFieldErrorMessage,
4121
+ }
4122
+ : []))),
4123
+ h("input", { type: "hidden", hidden: true, name: "/rsReferralCode", value: states.referralCode }),
4124
+ content.formData,
4125
+ h("div", { class: sheet$d.classes.ButtonsContainer },
4126
+ h("sl-button", { submit: true, loading: states.loading, exportparts: "base: primarybutton-base", type: "primary" }, content.submitLabel || "Register")))));
4127
+ }
4128
+
4047
4129
  function t(t,n,r){return Math.min(Math.max(t,r),n)}class n extends Error{constructor(t){super(`Failed to parse color: "${t}"`);}}function r(r){if("string"!=typeof r)throw new n(r);if("transparent"===r.trim().toLowerCase())return [0,0,0,0];let e=r.trim();e=u.test(r)?function(t){const r=t.toLowerCase().trim(),e=o[function(t){let n=5381,r=t.length;for(;r;)n=33*n^t.charCodeAt(--r);return (n>>>0)%2341}(r)];if(!e)throw new n(t);return `#${e}`}(r):r;const f=s.exec(e);if(f){const t=Array.from(f).slice(1);return [...t.slice(0,3).map(t=>parseInt(_(t,2),16)),parseInt(_(t[3]||"f",2),16)/255]}const p=i.exec(e);if(p){const t=Array.from(p).slice(1);return [...t.slice(0,3).map(t=>parseInt(t,16)),parseInt(t[3]||"ff",16)/255]}const z=a.exec(e);if(z){const t=Array.from(z).slice(1);return [...t.slice(0,3).map(t=>parseInt(t,10)),parseFloat(t[3]||"1")]}const h=c.exec(e);if(h){const[e,o,_,s]=Array.from(h).slice(1).map(parseFloat);if(t(0,100,o)!==o)throw new n(r);if(t(0,100,_)!==_)throw new n(r);return [...l(e,o,_),s||1]}throw new n(r)}const e=t=>parseInt(t.replace(/_/g,""),36),o="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((t,n)=>{const r=e(n.substring(0,3)),o=e(n.substring(3)).toString(16);let _="";for(let t=0;t<6-o.length;t++)_+="0";return t[r]=`${_}${o}`,t},{}),_=(t,n)=>Array.from(Array(n)).map(()=>t).join(""),s=new RegExp(`^#${_("([a-f0-9])",3)}([a-f0-9])?$`,"i"),i=new RegExp(`^#${_("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),a=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${_(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),c=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,u=/^[a-z]+$/i,f=t=>Math.round(255*t),l=(t,n,r)=>{let e=r/100;if(0===n)return [e,e,e].map(f);const o=(t%360+360)%360/60,_=(1-Math.abs(2*e-1))*(n/100),s=_*(1-Math.abs(o%2-1));let i=0,a=0,c=0;o>=0&&o<1?(i=_,a=s):o>=1&&o<2?(i=s,a=_):o>=2&&o<3?(a=_,c=s):o>=3&&o<4?(a=s,c=_):o>=4&&o<5?(i=s,c=_):o>=5&&o<6&&(i=_,c=s);const u=e-_/2;return [i+u,a+u,c+u].map(f)};function p(t){const[n,e,o,_]=r(t).map((t,n)=>3===n?t:t/255),s=Math.max(n,e,o),i=Math.min(n,e,o),a=(s+i)/2;if(s===i)return [0,0,a,_];const c=s-i;return [60*(n===s?(e-o)/c+(e<o?6:0):e===s?(o-n)/c+2:(n-e)/c+4),a>.5?c/(2-s-i):c/(s+i),a,_]}function z(n,r,e,o){return `hsla(${(n%360).toFixed()}, ${t(0,100,100*r).toFixed()}%, ${t(0,100,100*e).toFixed()}%, ${parseFloat(t(0,1,o).toFixed(3))})`}
4048
4130
 
4049
4131
  const colorScale = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
@@ -4129,4 +4211,4 @@ const ShadowViewAddon = ({ story }, children) => {
4129
4211
  h(TagName, { "stencilbook-shadow-view": randomInt })));
4130
4212
  };
4131
4213
 
4132
- export { loading as A, BigStatView as B, ChangeMarktingView as C, DropdownFieldView as D, EditProfileView as E, empty as F, rewardExchange as G, HeroView as H, InputFieldView as I, CardFeedView as J, CouponCodeView as K, LeaderboardView as L, ProgressBar as M, NameFieldsView as N, autoColorScaleCss as O, PortalFrameView as P, ShadowViewAddon as Q, ReferralIframeView as R, ShareButtonView as S, TaskCardView as T, useBigStat as U, withShadowView as V, demoRewardExchange as W, useShareButton as a, useDemoBigStat as b, StatContainerView as c, PortalChangePasswordView as d, PortalRegisterView as e, ProgressBarView as f, PoweredByImg as g, PortalFooterView as h, CheckboxFieldView as i, RewardExchangeView as j, rewardExchangeLongText as k, rewardExchangeSelected as l, chooseAmountFixed as m, chooseAmountFixedNoDescription as n, chooseAmountVariable as o, chooseAmountVariableNoDescription as p, chooseAmountVariableDisabled as q, rewardExchangeCustomErrorMsg as r, chooseAmountVariableUnavailable as s, confirmFixed as t, useShareLink as u, confirmVariable as v, redemptionError as w, queryError as x, success as y, successVariable as z };
4214
+ export { loading as A, BigStatView as B, ChangeMarktingView as C, DropdownFieldView as D, EditProfileView as E, empty as F, rewardExchange as G, HeroView as H, InputFieldView as I, CardFeedView as J, CouponCodeView as K, LeaderboardView as L, ProgressBar as M, NameFieldsView as N, LeadFormView as O, PortalFrameView as P, autoColorScaleCss as Q, ReferralIframeView as R, ShareButtonView as S, TaskCardView as T, ShadowViewAddon as U, useBigStat as V, withShadowView as W, demoRewardExchange as X, useShareButton as a, useDemoBigStat as b, StatContainerView as c, PortalChangePasswordView as d, PortalRegisterView as e, ProgressBarView as f, PoweredByImg as g, PortalFooterView as h, CheckboxFieldView as i, RewardExchangeView as j, rewardExchangeLongText as k, rewardExchangeSelected as l, chooseAmountFixed as m, chooseAmountFixedNoDescription as n, chooseAmountVariable as o, chooseAmountVariableNoDescription as p, chooseAmountVariableDisabled as q, rewardExchangeCustomErrorMsg as r, chooseAmountVariableUnavailable as s, confirmFixed as t, useShareLink as u, confirmVariable as v, redemptionError as w, queryError as x, success as y, successVariable as z };