@saasquatch/mint-components 2.0.0-67 → 2.0.0-68

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 (72) hide show
  1. package/dist/cjs/{ShadowViewAddon-cd5c186c.js → ShadowViewAddon-1b38dcfc.js} +9 -3
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/{sqm-base-registration-form-view-7b95ae7a.js → sqm-base-registration-form-view-69a4b615.js} +9 -4
  5. package/dist/cjs/sqm-big-stat_47.cjs.entry.js +10 -3
  6. package/dist/cjs/sqm-portal-google-registration-form.cjs.entry.js +25 -18
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +7 -4
  8. package/dist/collection/components/sqm-base-registration/BaseRegistrationForm.stories.js +2 -2
  9. package/dist/collection/components/sqm-base-registration/sqm-base-registration-form-view.js +9 -4
  10. package/dist/collection/components/sqm-big-stat/useBigStat.js +7 -1
  11. package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +1 -1
  12. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field.js +1 -1
  13. package/dist/collection/components/sqm-input-field/sqm-input-field.js +1 -1
  14. package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +1 -1
  15. package/dist/collection/components/sqm-name-fields/NameFields.stories.js +2 -0
  16. package/dist/collection/components/sqm-name-fields/sqm-name-fields-view.js +2 -2
  17. package/dist/collection/components/sqm-name-fields/sqm-name-fields.js +31 -1
  18. package/dist/collection/components/sqm-name-fields/useNameFields.js +1 -0
  19. package/dist/collection/components/sqm-password-field/sqm-password-field.js +2 -2
  20. package/dist/collection/components/sqm-portal-google-registration-form/PortalGoogleRegistrationForm.stories.js +1 -0
  21. package/dist/collection/components/sqm-portal-google-registration-form/sqm-portal-google-registration-form.js +4 -4
  22. package/dist/collection/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.js +22 -15
  23. package/dist/collection/components/sqm-task-card/sqm-task-card.js +2 -2
  24. package/dist/esm/{ShadowViewAddon-11ffa85d.js → ShadowViewAddon-1adaf077.js} +9 -3
  25. package/dist/esm/loader.js +1 -1
  26. package/dist/esm/mint-components.js +1 -1
  27. package/dist/esm/{sqm-base-registration-form-view-1a6bb4b4.js → sqm-base-registration-form-view-9e97d8b4.js} +9 -4
  28. package/dist/esm/sqm-big-stat_47.entry.js +10 -3
  29. package/dist/esm/sqm-portal-google-registration-form.entry.js +25 -18
  30. package/dist/esm/sqm-stencilbook.entry.js +7 -4
  31. package/dist/esm-es5/{ShadowViewAddon-11ffa85d.js → ShadowViewAddon-1adaf077.js} +1 -1
  32. package/dist/esm-es5/loader.js +1 -1
  33. package/dist/esm-es5/mint-components.js +1 -1
  34. package/dist/esm-es5/sqm-base-registration-form-view-9e97d8b4.js +1 -0
  35. package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
  36. package/dist/esm-es5/sqm-portal-google-registration-form.entry.js +1 -1
  37. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  38. package/dist/mint-components/mint-components.esm.js +1 -1
  39. package/dist/mint-components/{p-e658929b.js → p-0e1a1b14.js} +3 -3
  40. package/dist/mint-components/{p-16ac4d4f.entry.js → p-31bba357.entry.js} +1 -1
  41. package/dist/mint-components/p-51a6a779.js +1 -0
  42. package/dist/mint-components/p-662ed116.system.entry.js +1 -0
  43. package/dist/mint-components/{p-4adf23e7.entry.js → p-720341b1.entry.js} +3 -3
  44. package/dist/mint-components/p-80569911.system.js +1 -0
  45. package/dist/mint-components/p-95b6e903.entry.js +1 -0
  46. package/dist/mint-components/p-967a9040.system.js +1 -1
  47. package/dist/mint-components/{p-b377570a.system.js → p-9f8d34d1.system.js} +1 -1
  48. package/dist/mint-components/p-d69c0a32.system.entry.js +1 -0
  49. package/dist/mint-components/p-fedb9ab8.system.entry.js +1 -0
  50. package/dist/types/components/sqm-base-registration/sqm-base-registration-form-view.d.ts +2 -1
  51. package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
  52. package/dist/types/components/sqm-dropdown-field/sqm-dropdown-field.d.ts +1 -1
  53. package/dist/types/components/sqm-input-field/sqm-input-field.d.ts +1 -1
  54. package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +1 -1
  55. package/dist/types/components/sqm-name-fields/sqm-name-fields-view.d.ts +1 -0
  56. package/dist/types/components/sqm-name-fields/sqm-name-fields.d.ts +5 -0
  57. package/dist/types/components/sqm-name-fields/useNameFields.d.ts +1 -0
  58. package/dist/types/components/sqm-password-field/sqm-password-field.d.ts +1 -1
  59. package/dist/types/components/sqm-portal-google-registration-form/usePortalGoogleRegistrationForm.d.ts +2 -1
  60. package/dist/types/components.d.ts +10 -0
  61. package/docs/docs.docx +0 -0
  62. package/docs/raisins.json +1 -1
  63. package/grapesjs/grapesjs.js +1 -1
  64. package/package.json +2 -2
  65. package/dist/esm-es5/sqm-base-registration-form-view-1a6bb4b4.js +0 -1
  66. package/dist/mint-components/p-1522a7d1.js +0 -1
  67. package/dist/mint-components/p-71a6e549.system.entry.js +0 -1
  68. package/dist/mint-components/p-b21c5311.system.js +0 -1
  69. package/dist/mint-components/p-c2ac14b7.entry.js +0 -1
  70. package/dist/mint-components/p-e9a596ad.system.entry.js +0 -1
  71. package/dist/mint-components/p-f66e02c7.system.entry.js +0 -1
  72. package/shoelace/assets/icons/twitter-x.svg +0 -4
@@ -11,7 +11,7 @@ const JSS = require('./JSS-8503a151.js');
11
11
  require('./mixins-4761d472.js');
12
12
  require('./sqm-text-span-view-7a61ae4c.js');
13
13
  const useRegistrationFormState = require('./useRegistrationFormState-bbee6e7b.js');
14
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-7b95ae7a.js');
14
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-69a4b615.js');
15
15
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-5a96c2f5.js');
16
16
  require('./AsYouType-6788393a.js');
17
17
  const usePortalRegistrationForm = require('./usePortalRegistrationForm-75b647fe.js');
@@ -75,7 +75,6 @@ function jwtDecode(token, options) {
75
75
  }
76
76
 
77
77
  function usePortalGoogleRegistrationForm(props) {
78
- const [emailValidationError, setEmailValidationError] = domContextHooks_module.useState(null);
79
78
  const [registrationFormState, setRegistrationFormState] = useRegistrationFormState.useRegistrationForm();
80
79
  const [showRegistrationForm, setShowRegistrationForm] = domContextHooks_module.useState({
81
80
  mode: "base",
@@ -83,33 +82,40 @@ function usePortalGoogleRegistrationForm(props) {
83
82
  const handleEmailSubmit = async (event) => {
84
83
  const formControls = event.target.getFormControls();
85
84
  let formData = {};
86
- let errorMessage = null;
85
+ let validationErrors = {};
87
86
  formControls.forEach((control) => {
88
87
  if (!control.name)
89
88
  return;
90
- jsonpointer.jsonpointer.set(formData, control.name, control.value);
91
- // only validate email field
92
- if (control.name !== "/email")
93
- return;
94
- if (control.required && !control.value)
95
- errorMessage = props.requiredFieldErrorMessage;
89
+ const key = control.name;
90
+ const value = control.value;
91
+ jsonpointer.jsonpointer.set(formData, key, value);
92
+ if (control.required && !value) {
93
+ jsonpointer.jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
94
+ }
96
95
  if (typeof control.validationError === "function") {
97
96
  const validate = control.validationError;
98
97
  const validationError = validate({
99
98
  control,
100
- key: "email",
101
- value: control.value,
99
+ key,
100
+ value,
102
101
  });
103
102
  if (validationError)
104
- errorMessage = validationError;
103
+ jsonpointer.jsonpointer.set(validationErrors, key, validationError);
105
104
  }
106
105
  });
107
- if (errorMessage) {
108
- setEmailValidationError(errorMessage);
106
+ if (Object.keys(validationErrors).length) {
107
+ // early return for validation errors
108
+ setRegistrationFormState({
109
+ ...registrationFormState,
110
+ loading: false,
111
+ error: "",
112
+ validationErrors,
113
+ });
109
114
  return;
110
115
  }
111
116
  setRegistrationFormState({
112
117
  ...registrationFormState,
118
+ validationErrors: {},
113
119
  initialData: {
114
120
  ...registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.initialData,
115
121
  ...formData,
@@ -139,8 +145,9 @@ function usePortalGoogleRegistrationForm(props) {
139
145
  }
140
146
  };
141
147
  return {
148
+ registrationFormState,
142
149
  showRegistrationForm,
143
- emailValidationError,
150
+ validationErrors: registrationFormState.validationErrors,
144
151
  handleGoogleInit,
145
152
  handleEmailSubmit,
146
153
  };
@@ -296,7 +303,7 @@ const PortalGoogleRegistrationForm = class {
296
303
  };
297
304
  const sheet = JSS.createStyleSheet(styles);
298
305
  const styleString = sheet.toString();
299
- const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, emailValidationError, } = index_module.isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
306
+ const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, validationErrors, } = index_module.isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
300
307
  const content = {
301
308
  formData: index.h("slot", { name: "formData" }),
302
309
  googleButton: (index.h("sqm-google-sign-in", { text: this.googleButtonText, onInitComplete: handleGoogleInit })),
@@ -321,7 +328,7 @@ const PortalGoogleRegistrationForm = class {
321
328
  };
322
329
  if (showRegistrationForm.mode === "base") {
323
330
  return (index.h(sqmBaseRegistrationFormView.BaseRegistrationFormView, { states: {
324
- error: emailValidationError,
331
+ validationErrors,
325
332
  }, callbacks: { handleEmailSubmit }, content: content }));
326
333
  }
327
334
  return (index.h(sqmPortalRegistrationFormView.PortalRegistrationFormView, { states: {
@@ -364,7 +371,7 @@ function useGoogleDemo(props) {
364
371
  mode: "base",
365
372
  });
366
373
  return cjs.cjs({
367
- emailValidationError: false,
374
+ validationErrors: {},
368
375
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
369
376
  showRegistrationForm,
370
377
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -26,7 +26,7 @@ const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-de90ef03
26
26
  const sqmNavigationSidebarItemView = require('./sqm-navigation-sidebar-item-view-4e88f774.js');
27
27
  const sqmPortalEmailVerificationView = require('./sqm-portal-email-verification-view-5518eb0d.js');
28
28
  const sqmPortalLoginView = require('./sqm-portal-login-view-bb50304c.js');
29
- const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-7b95ae7a.js');
29
+ const sqmBaseRegistrationFormView = require('./sqm-base-registration-form-view-69a4b615.js');
30
30
  const sqmPortalRegistrationFormView = require('./sqm-portal-registration-form-view-5a96c2f5.js');
31
31
  const sqmPortalProfileView = require('./sqm-portal-profile-view-615e6975.js');
32
32
  require('./utilities-9a0c5e91.js');
@@ -34,7 +34,7 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-25e
34
34
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-1c4e781f.js');
35
35
  require('./ErrorView-3f91e5ab.js');
36
36
  const sqmQrCodeView = require('./sqm-qr-code-view-4ccf89da.js');
37
- const ShadowViewAddon = require('./ShadowViewAddon-cd5c186c.js');
37
+ const ShadowViewAddon = require('./ShadowViewAddon-1b38dcfc.js');
38
38
  const sqmPortalContainerView = require('./sqm-portal-container-view-07e4343f.js');
39
39
  const IndirectTaxDetailsView = require('./IndirectTaxDetailsView-e5f70b8b.js');
40
40
  const utils = require('./utils-83d125fa.js');
@@ -5044,7 +5044,7 @@ const BaseRegistrationForm_stories = {
5044
5044
  };
5045
5045
  const defaultProps = {
5046
5046
  states: {
5047
- error: "",
5047
+ validationErrors: {},
5048
5048
  },
5049
5049
  callbacks: {
5050
5050
  handleEmailSubmit: () => console.log("Submit!"),
@@ -5064,7 +5064,7 @@ const defaultProps = {
5064
5064
  const errorProps = {
5065
5065
  ...defaultProps,
5066
5066
  states: {
5067
- error: "Something went wrong. Please try again.",
5067
+ validationErrors: { error: "Something went wrong. Please try again." },
5068
5068
  },
5069
5069
  };
5070
5070
  const Default$1 = () => {
@@ -8250,6 +8250,7 @@ const NameFields_stories = {
8250
8250
  };
8251
8251
  const props = {
8252
8252
  states: {
8253
+ optional: false,
8253
8254
  registrationFormState: {
8254
8255
  validationErrors: undefined,
8255
8256
  },
@@ -8261,6 +8262,7 @@ const props = {
8261
8262
  };
8262
8263
  const errorProps$1 = {
8263
8264
  states: {
8265
+ optional: false,
8264
8266
  registrationFormState: {
8265
8267
  validationErrors: {
8266
8268
  firstName: "Cannot be empty",
@@ -9190,6 +9192,7 @@ const defaultProps$g = {
9190
9192
  formData: (index.h("div", null,
9191
9193
  " ",
9192
9194
  index.h(ShadowViewAddon.NameFieldsView, { states: {
9195
+ optional: false,
9193
9196
  registrationFormState: {
9194
9197
  validationErrors: undefined,
9195
9198
  disabled: true,
@@ -5,7 +5,7 @@ export default {
5
5
  };
6
6
  const defaultProps = {
7
7
  states: {
8
- error: "",
8
+ validationErrors: {},
9
9
  },
10
10
  callbacks: {
11
11
  handleEmailSubmit: () => console.log("Submit!"),
@@ -25,7 +25,7 @@ const defaultProps = {
25
25
  const errorProps = {
26
26
  ...defaultProps,
27
27
  states: {
28
- error: "Something went wrong. Please try again.",
28
+ validationErrors: { error: "Something went wrong. Please try again." },
29
29
  },
30
30
  };
31
31
  export const Default = () => {
@@ -37,6 +37,7 @@ sqm-portal-register {
37
37
  const sheet = createStyleSheet(style);
38
38
  const styleString = sheet.toString();
39
39
  export function BaseRegistrationFormView(props) {
40
+ var _a, _b;
40
41
  const { states, content, callbacks } = props;
41
42
  return (h("div", { class: sheet.classes.Wrapper },
42
43
  h("style", { type: "text/css" },
@@ -44,10 +45,8 @@ export function BaseRegistrationFormView(props) {
44
45
  styleString),
45
46
  h(TextSpanView, { type: "h3" }, content.pageLabel),
46
47
  h("sl-form", { class: sheet.classes.Column, "onSl-submit": callbacks.handleEmailSubmit, novalidate: true },
47
- states.error && (h("sqm-form-message", { type: "error", exportparts: "erroralert-icon" },
48
- h("div", { part: "erroralert-text" }, props.states.error))),
49
48
  content.formData,
50
- h("sl-input", { exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
49
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", type: "email", name: "/email", label: content.emailLabel || "Email", required: true, validationError: ({ value }) => {
51
50
  if (!value) {
52
51
  return content.requiredFieldErrorMessage;
53
52
  }
@@ -55,7 +54,13 @@ export function BaseRegistrationFormView(props) {
55
54
  if (!value.includes("@")) {
56
55
  return content.invalidEmailErrorMessage;
57
56
  }
58
- } }),
57
+ } }, (((_a = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _a === void 0 ? void 0 : _a.email) ? {
58
+ class: sheet.classes.ErrorStyle,
59
+ helpText: ((_b = states === null || states === void 0 ? void 0 : states.validationErrors) === null || _b === void 0 ? void 0 : _b.email) ||
60
+ content.requiredFieldErrorMessage,
61
+ }
62
+ : []))),
63
+ content.terms,
59
64
  h("div", { class: sheet.classes.ButtonsContainer },
60
65
  h("sl-button", { submit: true, exportparts: "base: primarybutton-base", type: "primary", style: { margin: "0" } }, content.submitLabel || "Register"),
61
66
  h("sl-menu-divider", { style: { margin: "0" } }),
@@ -120,12 +120,18 @@ const referralsMonthQuery = (programId, status) => {
120
120
  });
121
121
  });
122
122
  };
123
- const referralsWeekQuery = (programId) => {
123
+ const referralsWeekQuery = (programId, status) => {
124
124
  const programFilter = programId === "classic"
125
125
  ? { programId_exists: false }
126
126
  : { programId_eq: programId };
127
+ const convertedFilter = status && status == "converted"
128
+ ? { dateConverted_exists: true }
129
+ : status && status == "started"
130
+ ? { dateConverted_exists: false }
131
+ : {};
127
132
  const filter = {
128
133
  ...programFilter,
134
+ ...convertedFilter,
129
135
  dateReferralStarted_timeframe: "this_week",
130
136
  };
131
137
  return debugQuery(gql `
@@ -8,7 +8,7 @@ import { CheckboxFieldView, } from "./sqm-checkbox-field-view";
8
8
  import { useCheckboxField } from "./useCheckboxField";
9
9
  /**
10
10
  * @uiName Form Checkbox Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Checkbox Field - <sqm-checkbox-field checkbox-name="terms" checkbox-label="By signing up you agree to the {labelLink}" checkbox-label-link="https://example.com" checkbox-label-link-text="Terms and Conditions" error-message="Must be checked" ></sqm-checkbox-field>
14
14
  */
@@ -8,7 +8,7 @@ import { DropdownFieldView, } from "./sqm-dropdown-field-view";
8
8
  import { useDropdownField } from "./useDropdownField";
9
9
  /**
10
10
  * @uiName Form Dropdown Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @slots [{"name":"", "title":"Drop Down Option"}]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Dropdown Field - <sqm-dropdown-field dropdown-label="Select an option" error-message="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-dropdown-field>
@@ -8,7 +8,7 @@ import { InputFieldView } from "./sqm-input-field-view";
8
8
  import { useInputField } from "./useInputField";
9
9
  /**
10
10
  * @uiName Form Input Field
11
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
11
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
12
12
  * @exampleGroup Microsite Components
13
13
  * @example Form Input Field - <sqm-input-field input-label="Field Label" field-type="text" error-message="Cannot be empty"></sqm-input-field>
14
14
  */
@@ -7,7 +7,7 @@ import { CheckboxFieldView, } from "../sqm-checkbox-field/sqm-checkbox-field-vie
7
7
  import { useCheckboxField } from "../sqm-checkbox-field/useCheckboxField";
8
8
  /**
9
9
  * @uiName Marketing Emails Checkbox Field
10
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
10
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
11
11
  * @requiredFeatures ["MARKETING_EMAILS"]
12
12
  */
13
13
  export class MarketingEmailsCheckbox {
@@ -9,6 +9,7 @@ export default {
9
9
  };
10
10
  const props = {
11
11
  states: {
12
+ optional: false,
12
13
  registrationFormState: {
13
14
  validationErrors: undefined,
14
15
  },
@@ -20,6 +21,7 @@ const props = {
20
21
  };
21
22
  const errorProps = {
22
23
  states: {
24
+ optional: false,
23
25
  registrationFormState: {
24
26
  validationErrors: {
25
27
  firstName: "Cannot be empty",
@@ -56,7 +56,7 @@ export function NameFieldsView(props) {
56
56
  h("style", { type: "text/css" },
57
57
  vanillaStyle,
58
58
  styleString),
59
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: true, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
59
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: !states.optional, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
60
60
  value: (_g = (_f = states.registrationFormState) === null || _f === void 0 ? void 0 : _f.initialData) === null || _g === void 0 ? void 0 : _g.firstName,
61
61
  }
62
62
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) ? {
@@ -64,7 +64,7 @@ export function NameFieldsView(props) {
64
64
  helpText: (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) || "Cannot be empty",
65
65
  }
66
66
  : []))),
67
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: true, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
67
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: !states.optional, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
68
68
  value: (_o = (_m = states.registrationFormState) === null || _m === void 0 ? void 0 : _m.initialData) === null || _o === void 0 ? void 0 : _o.lastName,
69
69
  }
70
70
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.lastName) ? {
@@ -21,6 +21,11 @@ export class NameFields {
21
21
  * @uiName Last name label
22
22
  */
23
23
  this.lastNameLabel = "Last Name";
24
+ /**
25
+ * @uiName Optional
26
+ * @uiWidget
27
+ */
28
+ this.optional = false;
24
29
  withHooks(this);
25
30
  }
26
31
  disconnectedCallback() { }
@@ -73,12 +78,36 @@ export class NameFields {
73
78
  "reflect": false,
74
79
  "defaultValue": "\"Last Name\""
75
80
  },
81
+ "optional": {
82
+ "type": "boolean",
83
+ "mutable": false,
84
+ "complexType": {
85
+ "original": "boolean",
86
+ "resolved": "boolean",
87
+ "references": {}
88
+ },
89
+ "required": false,
90
+ "optional": false,
91
+ "docs": {
92
+ "tags": [{
93
+ "text": "Optional",
94
+ "name": "uiName"
95
+ }, {
96
+ "text": undefined,
97
+ "name": "uiWidget"
98
+ }],
99
+ "text": ""
100
+ },
101
+ "attribute": "optional",
102
+ "reflect": false,
103
+ "defaultValue": "false"
104
+ },
76
105
  "demoData": {
77
106
  "type": "unknown",
78
107
  "mutable": false,
79
108
  "complexType": {
80
109
  "original": "DemoData<NameFieldsViewProps>",
81
- "resolved": "{ states?: { registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
110
+ "resolved": "{ states?: { optional: boolean; registrationFormState?: RegistrationFormState; content: { firstNameLabel: string; lastNameLabel: string; }; }; }",
82
111
  "references": {
83
112
  "DemoData": {
84
113
  "location": "import",
@@ -111,6 +140,7 @@ export class NameFields {
111
140
  function useNameFieldsDemo(props) {
112
141
  return deepmerge({
113
142
  states: {
143
+ optional: props.optional,
114
144
  validationErrors: [],
115
145
  content: {
116
146
  firstNameLabel: props.firstNameLabel,
@@ -4,6 +4,7 @@ export function useNameFields(props) {
4
4
  const registrationFormState = useDomContext(REGISTRATION_FORM_STATE_CONTEXT);
5
5
  return {
6
6
  states: {
7
+ optional: props.optional,
7
8
  registrationFormState,
8
9
  content: {
9
10
  lastNameLabel: props.lastNameLabel,
@@ -3,13 +3,13 @@ import { withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { useState } from "@saasquatch/universal-hooks";
4
4
  import { Component, h, Prop, State } from "@stencil/core";
5
5
  import deepmerge from "deepmerge";
6
+ import { getProps } from "../../utils/utils";
6
7
  import { validateNewPassword } from "./passwordValidation";
7
8
  import { PortalResetPasswordView, } from "./sqm-password-field-view";
8
9
  import { usePasswordField } from "./usePasswordField";
9
- import { getProps } from "../../utils/utils";
10
10
  /**
11
11
  * @uiName Form Password Field
12
- * @validParents ["sqm-portal-register","sqm-portal-registration-form"]
12
+ * @validParents ["sqm-portal-register","sqm-portal-registration-form", "sqm-portal-google-registration-form"]
13
13
  * @exampleGroup Microsite Components
14
14
  * @example Form Password Field - <sqm-password-field field-label="Password"></sqm-password-field>
15
15
  */
@@ -31,6 +31,7 @@ const defaultProps = {
31
31
  formData: (h("div", null,
32
32
  " ",
33
33
  h(NameFieldsView, { states: {
34
+ optional: false,
34
35
  registrationFormState: {
35
36
  validationErrors: undefined,
36
37
  disabled: true,
@@ -2,11 +2,11 @@ import { isDemo, navigation } from "@saasquatch/component-boilerplate";
2
2
  import { useState, withHooks } from "@saasquatch/stencil-hooks";
3
3
  import { Component, h, Prop, State } from "@stencil/core";
4
4
  import deepmerge from "deepmerge";
5
+ import { createStyleSheet } from "../../styling/JSS";
5
6
  import { BaseRegistrationFormView } from "../sqm-base-registration/sqm-base-registration-form-view";
6
7
  import { PortalRegistrationFormView, } from "../sqm-portal-registration-form/sqm-portal-registration-form-view";
7
8
  import { usePortalRegistrationForm } from "../sqm-portal-registration-form/usePortalRegistrationForm";
8
9
  import { usePortalGoogleRegistrationForm } from "./usePortalGoogleRegistrationForm";
9
- import { createStyleSheet } from "../../styling/JSS";
10
10
  /**
11
11
  * @uiName Google Registration
12
12
  * @canvasRenderer always-replace
@@ -161,7 +161,7 @@ export class PortalGoogleRegistrationForm {
161
161
  };
162
162
  const sheet = createStyleSheet(styles);
163
163
  const styleString = sheet.toString();
164
- const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, emailValidationError, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
164
+ const { handleGoogleInit, handleEmailSubmit, showRegistrationForm, validationErrors, } = isDemo() ? useGoogleDemo(this) : usePortalGoogleRegistrationForm(this);
165
165
  const content = {
166
166
  formData: h("slot", { name: "formData" }),
167
167
  googleButton: (h("sqm-google-sign-in", { text: this.googleButtonText, onInitComplete: handleGoogleInit })),
@@ -192,7 +192,7 @@ export class PortalGoogleRegistrationForm {
192
192
  };
193
193
  if (showRegistrationForm.mode === "base") {
194
194
  return (h(BaseRegistrationFormView, { states: {
195
- error: emailValidationError,
195
+ validationErrors,
196
196
  }, callbacks: { handleEmailSubmit }, content: content }));
197
197
  }
198
198
  return (h(PortalRegistrationFormView, { states: {
@@ -874,7 +874,7 @@ function useGoogleDemo(props) {
874
874
  mode: "base",
875
875
  });
876
876
  return deepmerge({
877
- emailValidationError: false,
877
+ validationErrors: {},
878
878
  handleEmailSubmit: () => setShowRegistrationForm({ mode: "manual" }),
879
879
  showRegistrationForm,
880
880
  handleGoogleInit: () => setShowRegistrationForm({ mode: "google" }),
@@ -1,9 +1,8 @@
1
1
  import { useState } from "@saasquatch/universal-hooks";
2
2
  import jsonpointer from "jsonpointer";
3
- import { useRegistrationForm } from "../sqm-portal-registration-form/useRegistrationFormState";
4
3
  import { jwtDecode } from "jwt-decode";
4
+ import { useRegistrationForm } from "../sqm-portal-registration-form/useRegistrationFormState";
5
5
  export function usePortalGoogleRegistrationForm(props) {
6
- const [emailValidationError, setEmailValidationError] = useState(null);
7
6
  const [registrationFormState, setRegistrationFormState] = useRegistrationForm();
8
7
  const [showRegistrationForm, setShowRegistrationForm] = useState({
9
8
  mode: "base",
@@ -11,33 +10,40 @@ export function usePortalGoogleRegistrationForm(props) {
11
10
  const handleEmailSubmit = async (event) => {
12
11
  const formControls = event.target.getFormControls();
13
12
  let formData = {};
14
- let errorMessage = null;
13
+ let validationErrors = {};
15
14
  formControls.forEach((control) => {
16
15
  if (!control.name)
17
16
  return;
18
- jsonpointer.set(formData, control.name, control.value);
19
- // only validate email field
20
- if (control.name !== "/email")
21
- return;
22
- if (control.required && !control.value)
23
- errorMessage = props.requiredFieldErrorMessage;
17
+ const key = control.name;
18
+ const value = control.value;
19
+ jsonpointer.set(formData, key, value);
20
+ if (control.required && !value) {
21
+ jsonpointer.set(validationErrors, key, props.requiredFieldErrorMessage);
22
+ }
24
23
  if (typeof control.validationError === "function") {
25
24
  const validate = control.validationError;
26
25
  const validationError = validate({
27
26
  control,
28
- key: "email",
29
- value: control.value,
27
+ key,
28
+ value,
30
29
  });
31
30
  if (validationError)
32
- errorMessage = validationError;
31
+ jsonpointer.set(validationErrors, key, validationError);
33
32
  }
34
33
  });
35
- if (errorMessage) {
36
- setEmailValidationError(errorMessage);
34
+ if (Object.keys(validationErrors).length) {
35
+ // early return for validation errors
36
+ setRegistrationFormState({
37
+ ...registrationFormState,
38
+ loading: false,
39
+ error: "",
40
+ validationErrors,
41
+ });
37
42
  return;
38
43
  }
39
44
  setRegistrationFormState({
40
45
  ...registrationFormState,
46
+ validationErrors: {},
41
47
  initialData: {
42
48
  ...registrationFormState === null || registrationFormState === void 0 ? void 0 : registrationFormState.initialData,
43
49
  ...formData,
@@ -67,8 +73,9 @@ export function usePortalGoogleRegistrationForm(props) {
67
73
  }
68
74
  };
69
75
  return {
76
+ registrationFormState,
70
77
  showRegistrationForm,
71
- emailValidationError,
78
+ validationErrors: registrationFormState.validationErrors,
72
79
  handleGoogleInit,
73
80
  handleEmailSubmit,
74
81
  };
@@ -133,11 +133,11 @@ export class TaskCard {
133
133
  disconnectedCallback() { }
134
134
  render() {
135
135
  const { props } = isDemo()
136
- ? useDemoBigStat(this)
136
+ ? useDemoBigStat(getProps(this))
137
137
  : useBigStat({ ...getProps(this), programId: this.programId });
138
138
  const { value, loading } = props;
139
139
  const { states, callbacks } = isDemo()
140
- ? useTaskCardDemo(this)
140
+ ? useTaskCardDemo(getProps(this))
141
141
  : useTaskCard(this);
142
142
  return (h(TaskCardView, { callbacks: callbacks, states: {
143
143
  loading,
@@ -405,12 +405,18 @@ const referralsMonthQuery = (programId, status) => {
405
405
  });
406
406
  });
407
407
  };
408
- const referralsWeekQuery = (programId) => {
408
+ const referralsWeekQuery = (programId, status) => {
409
409
  const programFilter = programId === "classic"
410
410
  ? { programId_exists: false }
411
411
  : { programId_eq: programId };
412
+ const convertedFilter = status && status == "converted"
413
+ ? { dateConverted_exists: true }
414
+ : status && status == "started"
415
+ ? { dateConverted_exists: false }
416
+ : {};
412
417
  const filter = {
413
418
  ...programFilter,
419
+ ...convertedFilter,
414
420
  dateReferralStarted_timeframe: "this_week",
415
421
  };
416
422
  return debugQuery(dist.gql `
@@ -2780,7 +2786,7 @@ function NameFieldsView(props) {
2780
2786
  h("style", { type: "text/css" },
2781
2787
  vanillaStyle$4,
2782
2788
  styleString$7),
2783
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: true, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
2789
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/firstName", type: "text", label: states.content.firstNameLabel, required: !states.optional, disabled: ((_b = states.registrationFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.registrationFormState) === null || _c === void 0 ? void 0 : _c.disabled) }, (((_e = (_d = states.registrationFormState) === null || _d === void 0 ? void 0 : _d.initialData) === null || _e === void 0 ? void 0 : _e.firstName) ? {
2784
2790
  value: (_g = (_f = states.registrationFormState) === null || _f === void 0 ? void 0 : _f.initialData) === null || _g === void 0 ? void 0 : _g.firstName,
2785
2791
  }
2786
2792
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) ? {
@@ -2788,7 +2794,7 @@ function NameFieldsView(props) {
2788
2794
  helpText: (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.firstName) || "Cannot be empty",
2789
2795
  }
2790
2796
  : []))),
2791
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: true, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
2797
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: "/lastName", type: "text", label: states.content.lastNameLabel, required: !states.optional, disabled: ((_h = states.registrationFormState) === null || _h === void 0 ? void 0 : _h.loading) || ((_j = states.registrationFormState) === null || _j === void 0 ? void 0 : _j.disabled) }, (((_l = (_k = states.registrationFormState) === null || _k === void 0 ? void 0 : _k.initialData) === null || _l === void 0 ? void 0 : _l.lastName) ? {
2792
2798
  value: (_o = (_m = states.registrationFormState) === null || _m === void 0 ? void 0 : _m.initialData) === null || _o === void 0 ? void 0 : _o.lastName,
2793
2799
  }
2794
2800
  : {}), ((validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors.lastName) ? {