@saasquatch/mint-components 1.14.6-2 → 1.14.6-3

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 (86) hide show
  1. package/dist/cjs/{ShadowViewAddon-c0a5fdf8.js → ShadowViewAddon-40f0bc74.js} +58 -26
  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_42.cjs.entry.js +84 -116
  5. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +69 -0
  6. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +75 -0
  7. package/dist/cjs/sqm-lead-input-field-view-6344cd93.js +51 -0
  8. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +78 -0
  9. package/dist/cjs/sqm-stencilbook.cjs.entry.js +166 -49
  10. package/dist/cjs/useLeadFormState-c83d2034.js +72 -0
  11. package/dist/collection/collection-manifest.json +2 -0
  12. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +34 -46
  13. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +59 -0
  14. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +48 -0
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +65 -0
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +193 -0
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +59 -26
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +147 -36
  19. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +47 -0
  20. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +222 -0
  21. package/dist/collection/components/sqm-lead-form/useLeadDropdownField.js +10 -0
  22. package/dist/collection/components/sqm-lead-form/useLeadForm.js +8 -5
  23. package/dist/collection/components/sqm-lead-form/useLeadInputField.js +10 -0
  24. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -0
  25. package/dist/esm/{ShadowViewAddon-aa7177fe.js → ShadowViewAddon-8a0d9e83.js} +58 -26
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/mint-components.js +1 -1
  28. package/dist/esm/sqm-big-stat_42.entry.js +81 -113
  29. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +67 -0
  30. package/dist/esm/sqm-lead-dropdown-field.entry.js +71 -0
  31. package/dist/esm/sqm-lead-input-field-view-f1dd4b77.js +49 -0
  32. package/dist/esm/sqm-lead-input-field.entry.js +74 -0
  33. package/dist/esm/sqm-stencilbook.entry.js +166 -49
  34. package/dist/esm/useLeadFormState-9016d812.js +68 -0
  35. package/dist/esm-es5/{ShadowViewAddon-aa7177fe.js → ShadowViewAddon-8a0d9e83.js} +1 -1
  36. package/dist/esm-es5/loader.js +1 -1
  37. package/dist/esm-es5/mint-components.js +1 -1
  38. package/dist/esm-es5/sqm-big-stat_42.entry.js +1 -1
  39. package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +1 -0
  40. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +1 -0
  41. package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +1 -0
  42. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -0
  43. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  44. package/dist/esm-es5/useLeadFormState-9016d812.js +1 -0
  45. package/dist/mint-components/mint-components.esm.js +1 -1
  46. package/dist/mint-components/p-13c67985.system.entry.js +1 -0
  47. package/dist/mint-components/p-15f1ff1d.system.js +1 -0
  48. package/dist/mint-components/p-1d704c40.system.js +1 -0
  49. package/dist/mint-components/p-26da31c6.js +1 -0
  50. package/dist/mint-components/p-37996351.system.js +1 -1
  51. package/dist/mint-components/{p-373a92a2.js → p-4139feb5.js} +3 -3
  52. package/dist/mint-components/p-4d5b02af.js +1 -0
  53. package/dist/mint-components/p-87384d9e.system.js +1 -0
  54. package/dist/mint-components/p-875861d7.system.entry.js +1 -0
  55. package/dist/mint-components/p-8af8ab01.system.entry.js +1 -0
  56. package/dist/mint-components/p-9e1570bf.system.entry.js +1 -0
  57. package/dist/mint-components/{p-72e5e84f.system.js → p-ad6420a2.system.js} +1 -1
  58. package/dist/mint-components/p-b8c15858.entry.js +1 -0
  59. package/dist/mint-components/{p-8dc110b0.entry.js → p-cd1c6113.entry.js} +2 -2
  60. package/dist/mint-components/p-e358f0c1.entry.js +265 -0
  61. package/dist/mint-components/p-f59d6012.entry.js +1 -0
  62. package/dist/mint-components/p-f98a4354.js +1 -0
  63. package/dist/types/components/sqm-lead-form/LeadForm.stories.d.ts +1 -0
  64. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +9 -0
  65. package/dist/types/components/sqm-lead-form/LeadInputField.stories.d.ts +8 -0
  66. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +15 -0
  67. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +42 -0
  68. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +7 -0
  69. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +24 -7
  70. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +14 -0
  71. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +49 -0
  72. package/dist/types/components/sqm-lead-form/useLeadDropdownField.d.ts +6 -0
  73. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +4 -0
  74. package/dist/types/components/sqm-lead-form/useLeadInputField.d.ts +6 -0
  75. package/dist/types/components.d.ts +194 -12
  76. package/docs/docs.docx +0 -0
  77. package/docs/raisins.json +1 -1
  78. package/grapesjs/grapesjs.js +1 -1
  79. package/package.json +1 -1
  80. package/dist/mint-components/p-02a6e0df.system.entry.js +0 -1
  81. package/dist/mint-components/p-0c6ab3ec.system.entry.js +0 -1
  82. package/dist/mint-components/p-6349fb7c.entry.js +0 -265
  83. package/dist/types/global/android.d.ts +0 -7
  84. package/dist/types/global/demo.d.ts +0 -2
  85. package/dist/types/stories/features.d.ts +0 -4
  86. package/dist/types/stories/templates.d.ts +0 -4
@@ -0,0 +1,78 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a29c60ef.js');
6
+ const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
7
+ require('./global-e31dc4f5.js');
8
+ const index_module = require('./index.module-ee84433d.js');
9
+ const cjs = require('./cjs-1066ec21.js');
10
+ const utils = require('./utils-6847bc06.js');
11
+ require('./JSS-8503a151.js');
12
+ require('./mixins-f7e0377a.js');
13
+ const useLeadFormState = require('./useLeadFormState-c83d2034.js');
14
+ const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
15
+
16
+ function useLeadInputField() {
17
+ const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
18
+ return {
19
+ states: {
20
+ leadFormState,
21
+ },
22
+ };
23
+ }
24
+
25
+ const LeadInputField = class {
26
+ constructor(hostRef) {
27
+ index.registerInstance(this, hostRef);
28
+ this.ignored = true;
29
+ /**
30
+ * @uiName Input type
31
+ * @uiType string
32
+ * @uiEnum ["text", "date", "tel"]
33
+ * @uiEnumNames ["Text", "Date", "Phone Number"]
34
+ */
35
+ this.fieldType = "text";
36
+ /**
37
+ * The message to be displayed when a required field is not filled.
38
+ *
39
+ * @uiName Required field message
40
+ * @uiWidget textArea
41
+ */
42
+ this.requiredFieldErrorMessage = "Please enter a {fieldName}";
43
+ /**
44
+ * @uiName Optional
45
+ * @default
46
+ */
47
+ this.fieldOptional = false;
48
+ stencilHooks_module.h$1(this);
49
+ }
50
+ disconnectedCallback() { }
51
+ render() {
52
+ const content = {
53
+ ...utils.getProps(this),
54
+ };
55
+ const missingProps = utils.getMissingProps([
56
+ {
57
+ attribute: "field-name",
58
+ value: this.fieldName,
59
+ },
60
+ ]);
61
+ if (!index_module.isDemo() && missingProps) {
62
+ return (index.h(useLeadFormState.RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
63
+ }
64
+ const { states } = index_module.isDemo()
65
+ ? useLeadInputFieldDemo(this)
66
+ : useLeadInputField();
67
+ return (index.h(sqmLeadInputFieldView.LeadInputFieldView, { states: states, content: content }));
68
+ }
69
+ };
70
+ function useLeadInputFieldDemo(props) {
71
+ return cjs.cjs({
72
+ states: {
73
+ leadForState: {},
74
+ },
75
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
76
+ }
77
+
78
+ exports.sqm_lead_input_field = LeadInputField;
@@ -20,6 +20,7 @@ const sqmAssetCardView = require('./sqm-asset-card-view-21ddf04f.js');
20
20
  const sqmCloseButtonView = require('./sqm-close-button-view-ea3fa23b.js');
21
21
  require('./index-8c6255f5.js');
22
22
  const emailRegistrationView = require('./email-registration-view-55b378dc.js');
23
+ const sqmLeadDropdownFieldView = require('./sqm-lead-dropdown-field-view-03a3e03f.js');
23
24
  const sqmLeaderboardRankView = require('./sqm-leaderboard-rank-view-d39a55d8.js');
24
25
  const sqmLogoutCurrentUserView = require('./sqm-logout-current-user-view-11d57c12.js');
25
26
  const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-17111896.js');
@@ -35,9 +36,10 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe6
35
36
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
36
37
  require('./ErrorView-b2fcf954.js');
37
38
  const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
38
- const ShadowViewAddon = require('./ShadowViewAddon-c0a5fdf8.js');
39
+ const ShadowViewAddon = require('./ShadowViewAddon-40f0bc74.js');
39
40
  const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
40
41
  const sqmInvoiceTableView = require('./sqm-invoice-table-view-0f7fa309.js');
42
+ const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
41
43
 
42
44
  /**
43
45
  * lodash (Custom Build) <https://lodash.com/>
@@ -15836,6 +15838,7 @@ const LeadForm_stories = {
15836
15838
  };
15837
15839
  const defaultProps$t = {
15838
15840
  states: {
15841
+ success: false,
15839
15842
  leadFormState: {},
15840
15843
  error: "",
15841
15844
  loading: false,
@@ -15849,75 +15852,61 @@ const defaultProps$t = {
15849
15852
  formRef: {},
15850
15853
  },
15851
15854
  content: {
15855
+ submitLabel: "Submit",
15852
15856
  pageLabel: "Submit your information",
15857
+ resubmitFormLabel: "Refer Another Friend",
15853
15858
  requiredFieldErrorMessage: "Cannot be empty",
15854
15859
  invalidEmailErrorMessage: "Must be a valid email address",
15860
+ submitSuccessHeader: "Referral submitted",
15861
+ 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.",
15862
+ submitErrorHeader: "An error occurred while submitting",
15863
+ submitErrorDescription: "Please try again later. If the problem continues, contact Support",
15855
15864
  },
15856
15865
  };
15857
- const errorProps$c = {
15866
+ const successProps$5 = {
15867
+ ...defaultProps$t,
15858
15868
  states: {
15859
- error: "Something went wrong. Please try again.",
15860
- leadFormState: {},
15861
- loading: false,
15862
- referralCode: "ABC123",
15863
- },
15864
- callbacks: {
15865
- submit: () => console.log("Submit!"),
15866
- inputFunction: () => { },
15867
- },
15868
- refs: {
15869
- formRef: {},
15869
+ ...defaultProps$t.states,
15870
+ success: true,
15871
+ error: null,
15870
15872
  },
15871
15873
  content: {
15872
- pageLabel: "Submit your information",
15873
- requiredFieldErrorMessage: "Cannot be empty",
15874
- invalidEmailErrorMessage: "Must be a valid email address",
15874
+ ...defaultProps$t.content,
15875
+ pageLabel: "Refer your friend",
15876
+ },
15877
+ };
15878
+ const errorProps$c = {
15879
+ ...defaultProps$t,
15880
+ states: {
15881
+ ...defaultProps$t.states,
15882
+ error: "Something went wrong. Please try again.",
15883
+ leadFormState: {
15884
+ validationErrors: {
15885
+ firstName: "Please enter a first name",
15886
+ lastName: "Please enter a last name",
15887
+ email: "Please enter a valid email",
15888
+ },
15889
+ },
15875
15890
  },
15876
15891
  };
15877
15892
  const loadingProps$9 = {
15893
+ ...defaultProps$t,
15878
15894
  states: {
15879
- leadFormState: {},
15880
- error: "",
15895
+ ...defaultProps$t.states,
15881
15896
  loading: true,
15882
- referralCode: "ABC123",
15883
- },
15884
- callbacks: {
15885
- submit: () => console.log("Submit!"),
15886
- inputFunction: () => { },
15887
- },
15888
- refs: {
15889
- formRef: {},
15890
- },
15891
- content: {
15892
- pageLabel: "Submit your information",
15893
- requiredFieldErrorMessage: "Cannot be empty",
15894
- invalidEmailErrorMessage: "Must be a valid email address",
15895
15897
  },
15896
15898
  };
15897
15899
  const slottedProps$2 = {
15898
- states: {
15899
- leadFormState: {},
15900
- error: "",
15901
- loading: false,
15902
- referralCode: "ABC123",
15903
- },
15904
- callbacks: {
15905
- submit: () => console.log("Submit!"),
15906
- inputFunction: () => { },
15907
- },
15908
- refs: {
15909
- formRef: {},
15910
- },
15900
+ ...defaultProps$t,
15911
15901
  content: {
15912
- pageLabel: "Submit your information",
15913
- requiredFieldErrorMessage: "Cannot be empty",
15914
- invalidEmailErrorMessage: "Must be a valid email address",
15902
+ ...defaultProps$t.content,
15915
15903
  formData: (index.h("div", null,
15916
15904
  index.h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
15917
15905
  index.h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
15918
15906
  },
15919
15907
  };
15920
15908
  const Default$r = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, defaultProps$t));
15909
+ const LeadSubmitSuccess = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, successProps$5));
15921
15910
  const LeadSubmitWithError = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, errorProps$c));
15922
15911
  const LeadSubmitLoading = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, loadingProps$9));
15923
15912
  const FieldsHidden$2 = () => {
@@ -15925,6 +15914,7 @@ const FieldsHidden$2 = () => {
15925
15914
  states: {
15926
15915
  leadFormState: {},
15927
15916
  error: "",
15917
+ success: false,
15928
15918
  loading: true,
15929
15919
  referralCode: "ABC123",
15930
15920
  },
@@ -15936,12 +15926,137 @@ const LeadForm = /*#__PURE__*/Object.freeze({
15936
15926
  __proto__: null,
15937
15927
  'default': LeadForm_stories,
15938
15928
  Default: Default$r,
15929
+ LeadSubmitSuccess: LeadSubmitSuccess,
15939
15930
  LeadSubmitWithError: LeadSubmitWithError,
15940
15931
  LeadSubmitLoading: LeadSubmitLoading,
15941
15932
  FieldsHidden: FieldsHidden$2,
15942
15933
  SlottedInputs: SlottedInputs$2
15943
15934
  });
15944
15935
 
15936
+ const LeadInputField_stories = {
15937
+ title: "Components/Lead Form Input Field",
15938
+ };
15939
+ const defaultProps$u = {
15940
+ states: {
15941
+ leadFormState: {
15942
+ validationErrors: {},
15943
+ loading: false,
15944
+ disabled: false,
15945
+ initialData: {},
15946
+ },
15947
+ },
15948
+ content: {
15949
+ fieldName: "firstName",
15950
+ fieldLabel: "First Name",
15951
+ fieldType: "text",
15952
+ requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
15953
+ fieldOptional: false,
15954
+ },
15955
+ };
15956
+ const Default$s = () => index.h(sqmLeadInputFieldView.LeadInputFieldView, Object.assign({}, defaultProps$u));
15957
+ const WithError = () => (index.h(sqmLeadInputFieldView.LeadInputFieldView, Object.assign({}, defaultProps$u, { states: {
15958
+ ...defaultProps$u.states,
15959
+ leadFormState: {
15960
+ ...defaultProps$u.states.leadFormState,
15961
+ validationErrors: {
15962
+ firstName: "Please enter a first name",
15963
+ },
15964
+ },
15965
+ } })));
15966
+ const Disabled$2 = () => (index.h(sqmLeadInputFieldView.LeadInputFieldView, Object.assign({}, defaultProps$u, { states: {
15967
+ ...defaultProps$u.states,
15968
+ leadFormState: {
15969
+ ...defaultProps$u.states.leadFormState,
15970
+ disabled: true,
15971
+ },
15972
+ } })));
15973
+ const WithInitialValue = () => (index.h(sqmLeadInputFieldView.LeadInputFieldView, Object.assign({}, defaultProps$u, { states: {
15974
+ ...defaultProps$u.states,
15975
+ leadFormState: {
15976
+ ...defaultProps$u.states.leadFormState,
15977
+ initialData: {
15978
+ firstName: "Jane",
15979
+ },
15980
+ },
15981
+ } })));
15982
+
15983
+ const LeadInputField = /*#__PURE__*/Object.freeze({
15984
+ __proto__: null,
15985
+ 'default': LeadInputField_stories,
15986
+ Default: Default$s,
15987
+ WithError: WithError,
15988
+ Disabled: Disabled$2,
15989
+ WithInitialValue: WithInitialValue
15990
+ });
15991
+
15992
+ const LeadFormDropdownField_stories = {
15993
+ title: "Components/Lead Form Dropdown Field",
15994
+ };
15995
+ const defaultProps$v = {
15996
+ states: {
15997
+ leadFormState: {
15998
+ validationErrors: {},
15999
+ loading: false,
16000
+ disabled: false,
16001
+ initialData: {},
16002
+ },
16003
+ },
16004
+ content: {
16005
+ dropdownName: "country",
16006
+ dropdownLabel: "Country",
16007
+ requiredFieldErrorMessage: "Please select a country",
16008
+ dropdownOptional: false,
16009
+ selectOptions: [
16010
+ index.h("sl-menu-item", { value: "red" }, "Canada"),
16011
+ index.h("sl-menu-item", { value: "blue" }, "United States"),
16012
+ index.h("sl-menu-item", { value: "green" }, "Mexico"),
16013
+ ],
16014
+ },
16015
+ };
16016
+ const Default$t = () => index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v));
16017
+ const WithError$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16018
+ ...defaultProps$v.states,
16019
+ leadFormState: {
16020
+ ...defaultProps$v.states.leadFormState,
16021
+ validationErrors: {
16022
+ country: "Please select a country",
16023
+ },
16024
+ },
16025
+ } })));
16026
+ const Disabled$3 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16027
+ ...defaultProps$v.states,
16028
+ leadFormState: {
16029
+ ...defaultProps$v.states.leadFormState,
16030
+ disabled: true,
16031
+ },
16032
+ } })));
16033
+ const Loading$d = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16034
+ ...defaultProps$v.states,
16035
+ leadFormState: {
16036
+ ...defaultProps$v.states.leadFormState,
16037
+ loading: true,
16038
+ },
16039
+ } })));
16040
+ const WithInitialValue$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16041
+ ...defaultProps$v.states,
16042
+ leadFormState: {
16043
+ ...defaultProps$v.states.leadFormState,
16044
+ initialData: {
16045
+ country: "Canada",
16046
+ },
16047
+ },
16048
+ } })));
16049
+
16050
+ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
16051
+ __proto__: null,
16052
+ 'default': LeadFormDropdownField_stories,
16053
+ Default: Default$t,
16054
+ WithError: WithError$1,
16055
+ Disabled: Disabled$3,
16056
+ Loading: Loading$d,
16057
+ WithInitialValue: WithInitialValue$1
16058
+ });
16059
+
15945
16060
  /**
15946
16061
  *
15947
16062
  * Themes
@@ -15954,7 +16069,7 @@ const LeadForm = /*#__PURE__*/Object.freeze({
15954
16069
  *
15955
16070
  */
15956
16071
  //
15957
- const Default$s = `
16072
+ const Default$u = `
15958
16073
  // No CSS
15959
16074
  `;
15960
16075
  const Orangey = `
@@ -15988,7 +16103,7 @@ const Klip = `
15988
16103
 
15989
16104
  const Themes = /*#__PURE__*/Object.freeze({
15990
16105
  __proto__: null,
15991
- Default: Default$s,
16106
+ Default: Default$u,
15992
16107
  Orangey: Orangey,
15993
16108
  Netflix: Netflix,
15994
16109
  SaaSquatchCorporate: SaaSquatchCorporate,
@@ -18680,6 +18795,8 @@ const stories = [
18680
18795
  PayoutStatusAlert,
18681
18796
  QRCode,
18682
18797
  LeadForm,
18798
+ LeadInputField,
18799
+ LeadFormDropdownField,
18683
18800
  ];
18684
18801
  const StencilStorybook = class {
18685
18802
  constructor(hostRef) {
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-a29c60ef.js');
4
+ const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
5
+ const global = require('./global-e31dc4f5.js');
6
+ const index_module = require('./index.module-ee84433d.js');
7
+ const JSS = require('./JSS-8503a151.js');
8
+
9
+ const style = {
10
+ IconStyle: {
11
+ display: "block",
12
+ position: "absolute",
13
+ top: "23px",
14
+ },
15
+ DivStyle: {
16
+ marginLeft: "28px",
17
+ },
18
+ Details: {
19
+ marginLeft: "28px",
20
+ },
21
+ Heading: {
22
+ display: "inline-block",
23
+ },
24
+ Children: {
25
+ display: "none",
26
+ },
27
+ };
28
+ const sheet = JSS.createStyleSheet(style);
29
+ const styleString = sheet.toString();
30
+ function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
31
+ if (!missingProps)
32
+ return false;
33
+ const host = index_module._();
34
+ const [detailsOpen, setDetailsOpen] = stencilHooks_module.useState(false);
35
+ return (index.h("sl-alert", { type: "danger", open: true },
36
+ index.h("style", { type: "text/css" }, styleString),
37
+ index.h("div", { slot: "icon", class: sheet.classes.IconStyle },
38
+ index.h("sl-icon", { name: "exclamation-octagon" })),
39
+ index.h("div", { class: sheet.classes.DivStyle },
40
+ index.h("h2", { class: sheet.classes.Heading }, global.intl.formatMessage({
41
+ id: `error-heading`,
42
+ defaultMessage: heading,
43
+ })),
44
+ index.h("p", null, global.intl.formatMessage({
45
+ id: `error-subheading`,
46
+ defaultMessage: subheading,
47
+ }))),
48
+ index.h("details", { class: sheet.classes.Details },
49
+ index.h("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
50
+ detailsOpen ? "Less" : "More",
51
+ " details"),
52
+ index.h("p", null, global.intl.formatMessage({
53
+ id: `error-description`,
54
+ defaultMessage: description,
55
+ }, { tagName: host.tagName.toLowerCase() })),
56
+ index.h("ul", null, missingProps.map((prop) => (index.h("li", null,
57
+ index.h("strong", null, prop.attribute)))))),
58
+ index.h("div", { class: sheet.classes.Children }, children)));
59
+ }
60
+
61
+ const LEAD_FORM_STATE_CONTEXT = "sq:lead-form-state";
62
+ const LEAD_FORM_STATE_CONTEXT_INTERNAL = "sq:lead-form-state-internal";
63
+ function useLeadFormState(formState) {
64
+ const host = index_module._();
65
+ const [leadFormState, setLeadFormState] = stencilHooks_module.y(host, LEAD_FORM_STATE_CONTEXT, formState);
66
+ stencilHooks_module.y(host, LEAD_FORM_STATE_CONTEXT_INTERNAL, [leadFormState, setLeadFormState]);
67
+ return { leadFormState, setLeadFormState };
68
+ }
69
+
70
+ exports.LEAD_FORM_STATE_CONTEXT = LEAD_FORM_STATE_CONTEXT;
71
+ exports.RequiredPropsError = RequiredPropsError;
72
+ exports.useLeadFormState = useLeadFormState;
@@ -42,7 +42,9 @@
42
42
  "./components/sqm-invoice-table/columns/sqm-invoice-table-data-column.js",
43
43
  "./components/sqm-invoice-table/columns/sqm-invoice-table-date-column.js",
44
44
  "./components/sqm-invoice-table/columns/sqm-invoice-table-download-column.js",
45
+ "./components/sqm-lead-form/sqm-lead-dropdown-field.js",
45
46
  "./components/sqm-lead-form/sqm-lead-form.js",
47
+ "./components/sqm-lead-form/sqm-lead-input-field.js",
46
48
  "./components/sqm-leaderboard/sqm-leaderboard.js",
47
49
  "./components/sqm-leaderboard-rank/sqm-leaderboard-rank.js",
48
50
  "./components/sqm-link-button/sqm-link-button.js",
@@ -5,6 +5,7 @@ export default {
5
5
  };
6
6
  const defaultProps = {
7
7
  states: {
8
+ success: false,
8
9
  leadFormState: {},
9
10
  error: "",
10
11
  loading: false,
@@ -18,75 +19,61 @@ const defaultProps = {
18
19
  formRef: {},
19
20
  },
20
21
  content: {
22
+ submitLabel: "Submit",
21
23
  pageLabel: "Submit your information",
24
+ resubmitFormLabel: "Refer Another Friend",
22
25
  requiredFieldErrorMessage: "Cannot be empty",
23
26
  invalidEmailErrorMessage: "Must be a valid email address",
27
+ submitSuccessHeader: "Referral submitted",
28
+ 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.",
29
+ submitErrorHeader: "An error occurred while submitting",
30
+ submitErrorDescription: "Please try again later. If the problem continues, contact Support",
24
31
  },
25
32
  };
26
- const errorProps = {
33
+ const successProps = {
34
+ ...defaultProps,
27
35
  states: {
28
- error: "Something went wrong. Please try again.",
29
- leadFormState: {},
30
- loading: false,
31
- referralCode: "ABC123",
32
- },
33
- callbacks: {
34
- submit: () => console.log("Submit!"),
35
- inputFunction: () => { },
36
- },
37
- refs: {
38
- formRef: {},
36
+ ...defaultProps.states,
37
+ success: true,
38
+ error: null,
39
39
  },
40
40
  content: {
41
- pageLabel: "Submit your information",
42
- requiredFieldErrorMessage: "Cannot be empty",
43
- invalidEmailErrorMessage: "Must be a valid email address",
41
+ ...defaultProps.content,
42
+ pageLabel: "Refer your friend",
43
+ },
44
+ };
45
+ const errorProps = {
46
+ ...defaultProps,
47
+ states: {
48
+ ...defaultProps.states,
49
+ error: "Something went wrong. Please try again.",
50
+ leadFormState: {
51
+ validationErrors: {
52
+ firstName: "Please enter a first name",
53
+ lastName: "Please enter a last name",
54
+ email: "Please enter a valid email",
55
+ },
56
+ },
44
57
  },
45
58
  };
46
59
  const loadingProps = {
60
+ ...defaultProps,
47
61
  states: {
48
- leadFormState: {},
49
- error: "",
62
+ ...defaultProps.states,
50
63
  loading: true,
51
- referralCode: "ABC123",
52
- },
53
- callbacks: {
54
- submit: () => console.log("Submit!"),
55
- inputFunction: () => { },
56
- },
57
- refs: {
58
- formRef: {},
59
- },
60
- content: {
61
- pageLabel: "Submit your information",
62
- requiredFieldErrorMessage: "Cannot be empty",
63
- invalidEmailErrorMessage: "Must be a valid email address",
64
64
  },
65
65
  };
66
66
  const slottedProps = {
67
- states: {
68
- leadFormState: {},
69
- error: "",
70
- loading: false,
71
- referralCode: "ABC123",
72
- },
73
- callbacks: {
74
- submit: () => console.log("Submit!"),
75
- inputFunction: () => { },
76
- },
77
- refs: {
78
- formRef: {},
79
- },
67
+ ...defaultProps,
80
68
  content: {
81
- pageLabel: "Submit your information",
82
- requiredFieldErrorMessage: "Cannot be empty",
83
- invalidEmailErrorMessage: "Must be a valid email address",
69
+ ...defaultProps.content,
84
70
  formData: (h("div", null,
85
71
  h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
86
72
  h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
87
73
  },
88
74
  };
89
75
  export const Default = () => h(LeadFormView, Object.assign({}, defaultProps));
76
+ export const LeadSubmitSuccess = () => h(LeadFormView, Object.assign({}, successProps));
90
77
  export const LeadSubmitWithError = () => h(LeadFormView, Object.assign({}, errorProps));
91
78
  export const LeadSubmitLoading = () => h(LeadFormView, Object.assign({}, loadingProps));
92
79
  export const FieldsHidden = () => {
@@ -94,6 +81,7 @@ export const FieldsHidden = () => {
94
81
  states: {
95
82
  leadFormState: {},
96
83
  error: "",
84
+ success: false,
97
85
  loading: true,
98
86
  referralCode: "ABC123",
99
87
  },
@@ -0,0 +1,59 @@
1
+ import { h } from "@stencil/core";
2
+ import { LeadDropdownFieldView, } from "./sqm-lead-dropdown-field-view";
3
+ export default {
4
+ title: "Components/Lead Form Dropdown Field",
5
+ };
6
+ const defaultProps = {
7
+ states: {
8
+ leadFormState: {
9
+ validationErrors: {},
10
+ loading: false,
11
+ disabled: false,
12
+ initialData: {},
13
+ },
14
+ },
15
+ content: {
16
+ dropdownName: "country",
17
+ dropdownLabel: "Country",
18
+ requiredFieldErrorMessage: "Please select a country",
19
+ dropdownOptional: false,
20
+ selectOptions: [
21
+ h("sl-menu-item", { value: "red" }, "Canada"),
22
+ h("sl-menu-item", { value: "blue" }, "United States"),
23
+ h("sl-menu-item", { value: "green" }, "Mexico"),
24
+ ],
25
+ },
26
+ };
27
+ export const Default = () => h(LeadDropdownFieldView, Object.assign({}, defaultProps));
28
+ export const WithError = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
29
+ ...defaultProps.states,
30
+ leadFormState: {
31
+ ...defaultProps.states.leadFormState,
32
+ validationErrors: {
33
+ country: "Please select a country",
34
+ },
35
+ },
36
+ } })));
37
+ export const Disabled = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
38
+ ...defaultProps.states,
39
+ leadFormState: {
40
+ ...defaultProps.states.leadFormState,
41
+ disabled: true,
42
+ },
43
+ } })));
44
+ export const Loading = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
45
+ ...defaultProps.states,
46
+ leadFormState: {
47
+ ...defaultProps.states.leadFormState,
48
+ loading: true,
49
+ },
50
+ } })));
51
+ export const WithInitialValue = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
52
+ ...defaultProps.states,
53
+ leadFormState: {
54
+ ...defaultProps.states.leadFormState,
55
+ initialData: {
56
+ country: "Canada",
57
+ },
58
+ },
59
+ } })));