@saasquatch/mint-components 1.14.6-1 → 1.14.6-11

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 (83) hide show
  1. package/dist/cjs/{ShadowViewAddon-c0a5fdf8.js → ShadowViewAddon-d1dda2b0.js} +59 -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 +102 -121
  5. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +69 -0
  6. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +81 -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 +84 -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 +3 -1
  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 +199 -0
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +60 -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 +228 -0
  21. package/dist/collection/components/sqm-lead-form/useLeadDropdownField.js +10 -0
  22. package/dist/collection/components/sqm-lead-form/useLeadForm.js +24 -8
  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-81771102.js} +59 -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 +99 -118
  29. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +67 -0
  30. package/dist/esm/sqm-lead-dropdown-field.entry.js +77 -0
  31. package/dist/esm/sqm-lead-input-field-view-f1dd4b77.js +49 -0
  32. package/dist/esm/sqm-lead-input-field.entry.js +80 -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-81771102.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-15f1ff1d.system.js +1 -0
  47. package/dist/mint-components/p-1d704c40.system.js +1 -0
  48. package/dist/mint-components/p-26da31c6.js +1 -0
  49. package/dist/mint-components/p-37996351.system.js +1 -1
  50. package/dist/mint-components/p-4056c0ea.system.entry.js +1 -0
  51. package/dist/mint-components/{p-373a92a2.js → p-460974bf.js} +3 -3
  52. package/dist/mint-components/p-4d5b02af.js +1 -0
  53. package/dist/mint-components/p-59970cb1.system.entry.js +1 -0
  54. package/dist/mint-components/p-6b093d8c.entry.js +1 -0
  55. package/dist/mint-components/p-87384d9e.system.js +1 -0
  56. package/dist/mint-components/p-8d86d7e6.system.entry.js +1 -0
  57. package/dist/mint-components/{p-72e5e84f.system.js → p-ad128614.system.js} +1 -1
  58. package/dist/mint-components/{p-8dc110b0.entry.js → p-ba585a4b.entry.js} +2 -2
  59. package/dist/mint-components/p-c5a55554.entry.js +1 -0
  60. package/dist/mint-components/p-de5356d9.system.entry.js +1 -0
  61. package/dist/mint-components/p-f98a4354.js +1 -0
  62. package/dist/mint-components/p-fa303868.entry.js +273 -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 +5 -1
  74. package/dist/types/components/sqm-lead-form/useLeadInputField.d.ts +6 -0
  75. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  76. package/dist/types/components.d.ts +194 -12
  77. package/docs/docs.docx +0 -0
  78. package/docs/raisins.json +1 -1
  79. package/grapesjs/grapesjs.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/mint-components/p-02a6e0df.system.entry.js +0 -1
  82. package/dist/mint-components/p-cde11800.system.entry.js +0 -1
  83. package/dist/mint-components/p-ede3d2f9.entry.js +0 -265
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h as h$1, c as Host } from './index-91e7729f.js';
2
- import { n as h, f as useEffect, k as useState, i as d, m as useRef, y, u as useMemo, b as browser, j as useReducer } from './stencil-hooks.module-4bc38af4.js';
2
+ import { n as h, f as useEffect, i as d, k as useState, m as useRef, u as useMemo, b as browser, j as useReducer } from './stencil-hooks.module-4bc38af4.js';
3
3
  import { i as intl } from './global-be1f9992.js';
4
- import { i as isDemo, _, d as dist, J, H, $ as $e, w as wn, B, j as jn, u as useCallback, L, y as yn, r as Ue, V as Ve, Q as Qe, k as kn } from './index.module-89a79f66.js';
4
+ import { i as isDemo, _, d as dist, J, H, $ as $e, w as wn, B, u as useCallback, L, y as yn, j as jn, r as Ue, V as Ve, Q as Qe, k as kn } from './index.module-89a79f66.js';
5
5
  import { j as jsonpointer } from './jsonpointer-388a7082.js';
6
6
  import { c as cjs } from './cjs-bdfb4486.js';
7
7
  import { g as getProps, a as getMissingProps } from './utils-334c1e34.js';
@@ -15,11 +15,12 @@ import './luxon-8d51c92b.js';
15
15
  import './sqm-text-span-view-ca32495e.js';
16
16
  import { p as pathToRegexp } from './index-ffa26b43.js';
17
17
  import { R as REGISTRATION_FORM_STATE_CONTEXT, u as useRegistrationFormState } from './useRegistrationFormState-d6f33135.js';
18
+ import { R as RequiredPropsError, u as useLeadFormState } from './useLeadFormState-9016d812.js';
18
19
  import { P as PortalLoginView } from './sqm-portal-login-view-7e49609a.js';
19
20
  import { u as usePortalLogin } from './usePortalLogin-ef647a50.js';
20
21
  import { A as AsYouType } from './AsYouType-46f67d0d.js';
21
22
  import { i as isEmpty } from './utilities-5b0ca040.js';
22
- import { b as useDemoBigStat, V as useBigStat, B as BigStatView, Q as autoColorScaleCss, J as CardFeedView, i as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, O as LeadFormView, W as withShadowView, L as LeaderboardView, N as NameFieldsView, C as ChangeMarktingView, d as PortalChangePasswordView, h as PortalFooterView, P as PortalFrameView, e as PortalRegisterView, R as ReferralIframeView, X as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-aa7177fe.js';
23
+ import { b as useDemoBigStat, V as useBigStat, B as BigStatView, Q as autoColorScaleCss, J as CardFeedView, i as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, O as LeadFormView, W as withShadowView, L as LeaderboardView, N as NameFieldsView, C as ChangeMarktingView, d as PortalChangePasswordView, h as PortalFooterView, P as PortalFrameView, e as PortalRegisterView, R as ReferralIframeView, X as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-81771102.js';
23
24
  import './sqm-portal-container-view-1683ae32.js';
24
25
  import { u as usePayoutStatus } from './usePayoutStatus-fed17fc9.js';
25
26
 
@@ -137,58 +138,6 @@ const CardFeed = class {
137
138
  }
138
139
  };
139
140
 
140
- const style = {
141
- IconStyle: {
142
- display: "block",
143
- position: "absolute",
144
- top: "23px",
145
- },
146
- DivStyle: {
147
- marginLeft: "28px",
148
- },
149
- Details: {
150
- marginLeft: "28px",
151
- },
152
- Heading: {
153
- display: "inline-block",
154
- },
155
- Children: {
156
- display: "none",
157
- },
158
- };
159
- const sheet = createStyleSheet(style);
160
- const styleString = sheet.toString();
161
- 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) {
162
- if (!missingProps)
163
- return false;
164
- const host = _();
165
- const [detailsOpen, setDetailsOpen] = useState(false);
166
- return (h$1("sl-alert", { type: "danger", open: true },
167
- h$1("style", { type: "text/css" }, styleString),
168
- h$1("div", { slot: "icon", class: sheet.classes.IconStyle },
169
- h$1("sl-icon", { name: "exclamation-octagon" })),
170
- h$1("div", { class: sheet.classes.DivStyle },
171
- h$1("h2", { class: sheet.classes.Heading }, intl.formatMessage({
172
- id: `error-heading`,
173
- defaultMessage: heading,
174
- })),
175
- h$1("p", null, intl.formatMessage({
176
- id: `error-subheading`,
177
- defaultMessage: subheading,
178
- }))),
179
- h$1("details", { class: sheet.classes.Details },
180
- h$1("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
181
- detailsOpen ? "Less" : "More",
182
- " details"),
183
- h$1("p", null, intl.formatMessage({
184
- id: `error-description`,
185
- defaultMessage: description,
186
- }, { tagName: host.tagName.toLowerCase() })),
187
- h$1("ul", null, missingProps.map((prop) => (h$1("li", null,
188
- h$1("strong", null, prop.attribute)))))),
189
- h$1("div", { class: sheet.classes.Children }, children)));
190
- }
191
-
192
141
  function useCheckboxField(props) {
193
142
  var _a;
194
143
  const registrationFormState = d(REGISTRATION_FORM_STATE_CONTEXT);
@@ -1340,27 +1289,32 @@ function useInputFieldDemo(props) {
1340
1289
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1341
1290
  }
1342
1291
 
1343
- const LEAD_FORM_STATE_CONTEXT = "sq:lead-form-state";
1344
- const LEAD_FORM_STATE_CONTEXT_INTERNAL = "sq:lead-form-state-internal";
1345
- function useLeadFormState(formState) {
1346
- const host = _();
1347
- const [leadFormState, setLeadFormState] = y(host, LEAD_FORM_STATE_CONTEXT, formState);
1348
- y(host, LEAD_FORM_STATE_CONTEXT_INTERNAL, [leadFormState, setLeadFormState]);
1349
- return { leadFormState, setLeadFormState };
1350
- }
1351
-
1352
1292
  const SUBMIT_LEAD = dist.gql `
1353
- mutation submitForm($formSubmissionInput: FormSubmissionInput) {
1293
+ mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1354
1294
  submitForm(formSubmissionInput: $formSubmissionInput) {
1355
1295
  success
1356
1296
  }
1357
1297
  }
1358
1298
  `;
1299
+ const GET_USER_DETAILS = dist.gql `
1300
+ query getUser($programId: ID) {
1301
+ viewer {
1302
+ ... on User {
1303
+ referralCode(programId: $programId)
1304
+ }
1305
+ }
1306
+ }
1307
+ `;
1359
1308
  function useLeadForm(props) {
1360
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1309
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1361
1310
  const formRef = useRef(null);
1362
1311
  const { leadFormState, setLeadFormState } = useLeadFormState({});
1312
+ const programId = H();
1313
+ const user = J();
1314
+ const { data: userDetails } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
1315
+ console.log({ userDetails });
1363
1316
  const [submitLead, { loading, errors, data }] = $e(SUBMIT_LEAD);
1317
+ const [success, setSuccess] = useState(false);
1364
1318
  useEffect(() => {
1365
1319
  if (!formRef.current)
1366
1320
  return;
@@ -1371,6 +1325,7 @@ function useLeadForm(props) {
1371
1325
  };
1372
1326
  }, [formRef.current]);
1373
1327
  const submit = async (event) => {
1328
+ var _a;
1374
1329
  let formControls = event.target.getFormControls();
1375
1330
  let formData = {};
1376
1331
  let validationErrors = {};
@@ -1417,8 +1372,8 @@ function useLeadForm(props) {
1417
1372
  error: "",
1418
1373
  validationErrors: {},
1419
1374
  });
1420
- if (result.success) {
1421
- jn.push(props.nextPage);
1375
+ if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
1376
+ setSuccess(true);
1422
1377
  }
1423
1378
  }
1424
1379
  catch (error) {
@@ -1448,12 +1403,14 @@ function useLeadForm(props) {
1448
1403
  errorMessage =
1449
1404
  ((_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);
1450
1405
  }
1406
+ console.log({ errors, errorMessage });
1451
1407
  return {
1452
1408
  states: {
1453
1409
  loading,
1454
1410
  error: errorMessage,
1411
+ success,
1455
1412
  leadFormState,
1456
- referralCode: "ABC123",
1413
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1457
1414
  },
1458
1415
  callbacks: {
1459
1416
  submit,
@@ -1469,13 +1426,6 @@ const LeadForm = class {
1469
1426
  constructor(hostRef) {
1470
1427
  registerInstance(this, hostRef);
1471
1428
  this.ignored = true;
1472
- /**
1473
- * Redirect participants to this page from their verification email
1474
- *
1475
- * @uiName Submission redirect
1476
- * @uiWidget pageSelect
1477
- */
1478
- this.nextPage = "/";
1479
1429
  /**
1480
1430
  * @uiName Email field label
1481
1431
  */
@@ -1492,18 +1442,42 @@ const LeadForm = class {
1492
1442
  * @uiName Submit button text
1493
1443
  */
1494
1444
  this.submitLabel = "Submit";
1445
+ /**
1446
+ * @uiName Submit another form button label
1447
+ */
1448
+ this.resubmitFormLabel = "Refer Another Friend";
1495
1449
  /**
1496
1450
  * @uiName Header text
1497
1451
  */
1498
- this.pageLabel = "Submit your information";
1452
+ this.pageLabel = "Refer your friend";
1499
1453
  this.formKey = "lead-form";
1454
+ /**
1455
+ * Optional support link for error messages.
1456
+ */
1457
+ this.supportLink = "Support";
1458
+ /**
1459
+ * Header text shown on successful submission.
1460
+ */
1461
+ this.submitSuccessHeader = "Referral submitted";
1462
+ /**
1463
+ * Description text shown on successful submission.
1464
+ */
1465
+ this.submitSuccessDescription = "Our team will contact your friend to see if they’re a good fit. In the meantime, you can track this referral on Activity page.";
1466
+ /**
1467
+ * Header text shown when an error occurs.
1468
+ */
1469
+ this.submitErrorHeader = "An error occurred while submitting";
1470
+ /**
1471
+ * Description text shown when an error occurs.
1472
+ */
1473
+ this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1500
1474
  /**
1501
1475
  * The message to be displayed when a required field is not filled.
1502
1476
  *
1503
1477
  * @uiName Required field message
1504
1478
  * @uiWidget textArea
1505
1479
  */
1506
- this.requiredFieldErrorMessage = "Cannot be empty";
1480
+ this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1507
1481
  /**
1508
1482
  * The message to be displayed when a the form submission fails unexpectedly.
1509
1483
  *
@@ -1529,7 +1503,13 @@ const LeadForm = class {
1529
1503
  formData: h$1("slot", { name: "formData" }),
1530
1504
  emailLabel: this.emailLabel,
1531
1505
  submitLabel: this.submitLabel,
1506
+ resubmitFormLabel: this.resubmitFormLabel,
1532
1507
  pageLabel: this.pageLabel,
1508
+ supportLink: this.supportLink,
1509
+ submitSuccessHeader: this.submitSuccessHeader,
1510
+ submitSuccessDescription: this.submitSuccessDescription,
1511
+ submitErrorHeader: this.submitErrorHeader,
1512
+ submitErrorDescription: this.submitErrorDescription,
1533
1513
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1534
1514
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1535
1515
  };
@@ -1541,6 +1521,7 @@ function useRegisterDemo(props) {
1541
1521
  states: {
1542
1522
  error: "",
1543
1523
  loading: false,
1524
+ success: false,
1544
1525
  },
1545
1526
  callbacks: {
1546
1527
  submit: async (_event) => {
@@ -1851,7 +1832,7 @@ function useLeaderboardDemo(props) {
1851
1832
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1852
1833
  }
1853
1834
 
1854
- const style$1 = {
1835
+ const style = {
1855
1836
  Container: { display: "contents" },
1856
1837
  Link: {
1857
1838
  textDecoration: "none",
@@ -1863,16 +1844,16 @@ const vanillaStyle = `
1863
1844
  display: inline;
1864
1845
  }
1865
1846
  `;
1866
- const sheet$1 = createStyleSheet(style$1);
1867
- const styleString$1 = sheet$1.toString();
1847
+ const sheet = createStyleSheet(style);
1848
+ const styleString = sheet.toString();
1868
1849
  function LinkButtonView(props) {
1869
1850
  const { onClick, buttonText } = props;
1870
- return (h$1("span", { class: sheet$1.classes.Container, part: "sqm-base" },
1851
+ return (h$1("span", { class: sheet.classes.Container, part: "sqm-base" },
1871
1852
  h$1("style", { type: "text/css" },
1872
- styleString$1,
1853
+ styleString,
1873
1854
  vanillaStyle),
1874
1855
  h$1("sl-button", { onClick: onClick, type: "primary", exportparts: "base: primarybutton-base" },
1875
- h$1("a", { class: sheet$1.classes.Link, part: "sqm-link" }, buttonText))));
1856
+ h$1("a", { class: sheet.classes.Link, part: "sqm-link" }, buttonText))));
1876
1857
  }
1877
1858
 
1878
1859
  const LinkButton = class {
@@ -2053,7 +2034,7 @@ function useNavigationMenuDemo(props) {
2053
2034
  }
2054
2035
  NavigationMenu.style = sqmNavigationMenuCss;
2055
2036
 
2056
- const style$2 = {
2037
+ const style$1 = {
2057
2038
  Wrapper: {
2058
2039
  maxWidth: "200px",
2059
2040
  marginLeft: "auto",
@@ -2064,16 +2045,16 @@ const style$2 = {
2064
2045
  margin: "0",
2065
2046
  },
2066
2047
  };
2067
- const sheet$2 = createStyleSheet(style$2);
2068
- const styleString$2 = sheet$2.toString();
2048
+ const sheet$1 = createStyleSheet(style$1);
2049
+ const styleString$1 = sheet$1.toString();
2069
2050
  function PayoutButtonScrollView(props) {
2070
2051
  const { text, states } = props;
2071
2052
  if (!states.payoutSettingsComplete)
2072
2053
  return h$1("div", null);
2073
- return (h$1("div", { class: sheet$2.classes.Wrapper },
2074
- h$1("style", { type: "text/css" }, styleString$2),
2054
+ return (h$1("div", { class: sheet$1.classes.Wrapper },
2055
+ h$1("style", { type: "text/css" }, styleString$1),
2075
2056
  h$1("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.payoutButtonText, "scroll-animation": "smooth" }),
2076
- h$1("p", { class: sheet$2.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2057
+ h$1("p", { class: sheet$1.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2077
2058
  }
2078
2059
 
2079
2060
  const GET_PAYOUT_DETAILS = dist.gql `
@@ -2146,7 +2127,7 @@ function useDemoPayoutButtonScroll(props) {
2146
2127
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
2147
2128
  }
2148
2129
 
2149
- const style$3 = {
2130
+ const style$2 = {
2150
2131
  SkeletonOne: {
2151
2132
  width: "50%",
2152
2133
  height: "16px",
@@ -2197,8 +2178,8 @@ const style$3 = {
2197
2178
  "&::part(footer)": {},
2198
2179
  },
2199
2180
  };
2200
- const sheet$3 = createStyleSheet(style$3);
2201
- const styleString$3 = sheet$3.toString();
2181
+ const sheet$2 = createStyleSheet(style$2);
2182
+ const styleString$2 = sheet$2.toString();
2202
2183
  function PayoutStatusAlertView(props) {
2203
2184
  const { text, states, data, callbacks } = props;
2204
2185
  function getAlert(status) {
@@ -2209,7 +2190,7 @@ function PayoutStatusAlertView(props) {
2209
2190
  buttonText: null,
2210
2191
  alertType: "critical",
2211
2192
  icon: "exclamation-triangle",
2212
- class: sheet$3.classes.ErrorAlertContainer,
2193
+ class: sheet$2.classes.ErrorAlertContainer,
2213
2194
  };
2214
2195
  switch (status) {
2215
2196
  case "INFORMATION_REQUIRED":
@@ -2219,7 +2200,7 @@ function PayoutStatusAlertView(props) {
2219
2200
  buttonText: text.informationRequiredButtonText,
2220
2201
  alertType: "info",
2221
2202
  icon: "info-circle",
2222
- class: sheet$3.classes.InfoAlertContainer,
2203
+ class: sheet$2.classes.InfoAlertContainer,
2223
2204
  };
2224
2205
  case "VERIFICATION:REQUIRED":
2225
2206
  return {
@@ -2233,7 +2214,7 @@ function PayoutStatusAlertView(props) {
2233
2214
  buttonText: text.verificationRequiredButtonText,
2234
2215
  alertType: "warning",
2235
2216
  icon: "exclamation-triangle",
2236
- class: sheet$3.classes.WarningAlertContainer,
2217
+ class: sheet$2.classes.WarningAlertContainer,
2237
2218
  };
2238
2219
  case "VERIFICATION:INTERNAL":
2239
2220
  return {
@@ -2246,7 +2227,7 @@ function PayoutStatusAlertView(props) {
2246
2227
  }),
2247
2228
  alertType: "warning",
2248
2229
  icon: "exclamation-triangle",
2249
- class: sheet$3.classes.WarningAlertContainer,
2230
+ class: sheet$2.classes.WarningAlertContainer,
2250
2231
  };
2251
2232
  case "VERIFICATION:REVIEW":
2252
2233
  return {
@@ -2259,7 +2240,7 @@ function PayoutStatusAlertView(props) {
2259
2240
  }),
2260
2241
  alertType: "warning",
2261
2242
  icon: "exclamation-triangle",
2262
- class: sheet$3.classes.WarningAlertContainer,
2243
+ class: sheet$2.classes.WarningAlertContainer,
2263
2244
  };
2264
2245
  case "VERIFICATION:FAILED":
2265
2246
  return {
@@ -2272,7 +2253,7 @@ function PayoutStatusAlertView(props) {
2272
2253
  }),
2273
2254
  alertType: "critical",
2274
2255
  icon: "exclamation-octagon",
2275
- class: sheet$3.classes.ErrorAlertContainer,
2256
+ class: sheet$2.classes.ErrorAlertContainer,
2276
2257
  };
2277
2258
  case "HOLD":
2278
2259
  return {
@@ -2286,7 +2267,7 @@ function PayoutStatusAlertView(props) {
2286
2267
  buttonText: null,
2287
2268
  alertType: "warning",
2288
2269
  icon: "exclamation-triangle",
2289
- class: sheet$3.classes.WarningAlertContainer,
2270
+ class: sheet$2.classes.WarningAlertContainer,
2290
2271
  };
2291
2272
  default:
2292
2273
  return;
@@ -2305,18 +2286,18 @@ function PayoutStatusAlertView(props) {
2305
2286
  }
2306
2287
  }
2307
2288
  if (states.loading) {
2308
- return h$1("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
2289
+ return h$1("sl-skeleton", { class: sheet$2.classes.SkeletonOne });
2309
2290
  }
2310
2291
  const alertDetails = getAlert(states.status);
2311
2292
  if (states.status === "DONE" || !alertDetails) {
2312
2293
  return h$1("div", null);
2313
2294
  }
2314
2295
  return (h$1("div", { part: "sqm-base" },
2315
- h$1("style", { type: "text/css" }, styleString$3),
2296
+ h$1("style", { type: "text/css" }, styleString$2),
2316
2297
  h$1("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: alertDetails.alertType, class: alertDetails.class, open: true },
2317
2298
  h$1("sl-icon", { slot: "icon", name: alertDetails.icon }),
2318
2299
  h$1("strong", null, alertDetails.header),
2319
- h$1("p", { class: sheet$3.classes.AlertDescriptionText }, alertDetails.description),
2300
+ h$1("p", { class: sheet$2.classes.AlertDescriptionText }, alertDetails.description),
2320
2301
  getButton(states.status))));
2321
2302
  }
2322
2303
 
@@ -3470,7 +3451,7 @@ const ProgramMenu = class {
3470
3451
  }
3471
3452
  };
3472
3453
 
3473
- const style$4 = {
3454
+ const style$3 = {
3474
3455
  Container: {
3475
3456
  borderRadius: "var(--sl-border-radius-large)",
3476
3457
  color: "var(--sl-color-neutral-900)",
@@ -3498,15 +3479,15 @@ const style$4 = {
3498
3479
  },
3499
3480
  },
3500
3481
  };
3501
- const sheet$4 = createStyleSheet(style$4);
3502
- const styleString$4 = sheet$4.toString();
3482
+ const sheet$3 = createStyleSheet(style$3);
3483
+ const styleString$3 = sheet$3.toString();
3503
3484
  const vanillaStyle$1 = `
3504
3485
  :host{
3505
3486
  display: block;
3506
3487
  }
3507
3488
  `;
3508
3489
  function ReferralCardView(props) {
3509
- return (h$1("div", { part: "sqm-base", class: sheet$4.classes.Container, style: {
3490
+ return (h$1("div", { part: "sqm-base", class: sheet$3.classes.Container, style: {
3510
3491
  border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
3511
3492
  "padding-top": `var(--sl-spacing-${props.paddingTop})`,
3512
3493
  "padding-right": `var(--sl-spacing-${props.paddingRight})`,
@@ -3517,15 +3498,15 @@ function ReferralCardView(props) {
3517
3498
  margin: `${props.limitWidth ? "auto" : "none"}`,
3518
3499
  } },
3519
3500
  h$1("style", { type: "text/css" },
3520
- styleString$4,
3501
+ styleString$3,
3521
3502
  vanillaStyle$1),
3522
- props.hasHeader && (h$1("div", { class: sheet$4.classes.EndContainer }, props.slots.header)),
3523
- h$1("div", { part: "sqm-column-container", class: sheet$4.classes.ColumnContainer, style: {
3503
+ props.hasHeader && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.header)),
3504
+ h$1("div", { part: "sqm-column-container", class: sheet$3.classes.ColumnContainer, style: {
3524
3505
  alignItems: props.verticalAlignment,
3525
3506
  } },
3526
3507
  props.slots.left,
3527
3508
  props.slots.right),
3528
- props.hasFooter && (h$1("div", { class: sheet$4.classes.EndContainer }, props.slots.footer))));
3509
+ props.hasFooter && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.footer))));
3529
3510
  }
3530
3511
 
3531
3512
  const ReferralCard = class {
@@ -3600,7 +3581,7 @@ const ReferralCard = class {
3600
3581
  }
3601
3582
  };
3602
3583
 
3603
- const GET_USER_DETAILS = dist.gql `
3584
+ const GET_USER_DETAILS$1 = dist.gql `
3604
3585
  query getUser($programId: ID) {
3605
3586
  viewer {
3606
3587
  ... on User {
@@ -3613,7 +3594,7 @@ function useReferralIframe(props) {
3613
3594
  var _a;
3614
3595
  const programId = H();
3615
3596
  const user = J();
3616
- const { data } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3597
+ const { data } = wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3617
3598
  return {
3618
3599
  states: {
3619
3600
  content: props,
@@ -5248,7 +5229,7 @@ const Gift = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24"
5248
5229
  const Circle = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5249
5230
  h$1("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
5250
5231
 
5251
- const style$5 = {
5232
+ const style$4 = {
5252
5233
  TimelineReward: {
5253
5234
  color: "var(--sl-color-neutral-900)",
5254
5235
  lineHeight: "var(--sl-line-height-dense)",
@@ -5291,8 +5272,8 @@ const style$5 = {
5291
5272
  },
5292
5273
  },
5293
5274
  };
5294
- const sheet$5 = createStyleSheet(style$5);
5295
- const styleString$5 = sheet$5.toString();
5275
+ const sheet$4 = createStyleSheet(style$4);
5276
+ const styleString$4 = sheet$4.toString();
5296
5277
  const vanillaStyle$2 = `
5297
5278
  :host{
5298
5279
  display: block;
@@ -5305,9 +5286,9 @@ const vanillaStyle$2 = `
5305
5286
  function TimelineEntryView(props) {
5306
5287
  var _a;
5307
5288
  const timeline_icon = (_a = props.icon) !== null && _a !== void 0 ? _a : props.iconState;
5308
- return (h$1("div", { class: sheet$5.classes.TimelineReward, part: "sqm-base" },
5289
+ return (h$1("div", { class: sheet$4.classes.TimelineReward, part: "sqm-base" },
5309
5290
  h$1("style", { type: "text/css" },
5310
- styleString$5,
5291
+ styleString$4,
5311
5292
  vanillaStyle$2),
5312
5293
  h$1("div", { class: "container", part: "sqm-entry-container" },
5313
5294
  h$1("div", { class: "line" }, "/"),
@@ -0,0 +1,67 @@
1
+ import { h } from './index-91e7729f.js';
2
+ import { i as intl } from './global-be1f9992.js';
3
+ import { j as jss, a as create } from './JSS-67b5cff8.js';
4
+
5
+ const style = {
6
+ ErrorStyle: {
7
+ "--sl-input-border-color": "var(--sl-color-danger-500)",
8
+ "--sl-input-background-color": "var(--sl-color-danger-10)",
9
+ "--sl-input-border-color-focus": "var(--sl-color-danger-500)",
10
+ "--sl-input-border-color-hover": "var(--sl-color-danger-500)",
11
+ },
12
+ ErrorMessageStyle: {
13
+ margin: 0,
14
+ color: "var(--sl-color-danger-500)",
15
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
16
+ },
17
+ FieldContainer: {
18
+ "margin-bottom": "var(--sl-spacing-large)",
19
+ },
20
+ };
21
+ const vanillaStyle = `
22
+ :host {
23
+ margin: 0 auto;
24
+ width: 100%;
25
+ display: block;
26
+ }
27
+ sl-select::part(label){
28
+ font-size: var(--sl-input-label-font-size-small);
29
+ font-weight: var(--sl-font-weight-semibold);
30
+ }
31
+ `;
32
+ jss.setup(create());
33
+ const sheet = jss.createStyleSheet(style);
34
+ const styleString = sheet.toString();
35
+ function LeadDropdownFieldView(props) {
36
+ var _a, _b, _c, _d, _e, _f, _g;
37
+ const { states, content } = props;
38
+ const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
39
+ const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => intl.formatMessage({
40
+ id: "requiredFieldErrorMessage",
41
+ defaultMessage: content.requiredFieldErrorMessage,
42
+ }, {
43
+ dropdownLabel,
44
+ });
45
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
46
+ h("style", { type: "text/css" },
47
+ vanillaStyle,
48
+ styleString),
49
+ h("sl-select", Object.assign({ exportparts: "label: input-label, base: input-base", label: content.dropdownLabel, name: `/${content.dropdownName}` }, (!content.dropdownOptional ? { required: true } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
50
+ if (!value) {
51
+ return getRequiredFieldErrorMessage({
52
+ dropdownLabel: content.dropdownLabel,
53
+ });
54
+ }
55
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e.firstName) ? {
56
+ class: sheet.classes.ErrorStyle,
57
+ helpText: ((_g = (_f = states.leadFormState) === null || _f === void 0 ? void 0 : _f.validationErrors) === null || _g === void 0 ? void 0 : _g.firstName) ||
58
+ content.requiredFieldErrorMessage,
59
+ }
60
+ : [])), content.selectOptions),
61
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, intl.formatMessage({
62
+ id: `errorMessage-${content.dropdownName}`,
63
+ defaultMessage: content.requiredFieldErrorMessage,
64
+ })))));
65
+ }
66
+
67
+ export { LeadDropdownFieldView as L };
@@ -0,0 +1,77 @@
1
+ import { r as registerInstance, h as h$1 } from './index-91e7729f.js';
2
+ import { i as d, n as h } from './stencil-hooks.module-4bc38af4.js';
3
+ import './global-be1f9992.js';
4
+ import { i as isDemo } from './index.module-89a79f66.js';
5
+ import { c as cjs } from './cjs-bdfb4486.js';
6
+ import { a as getMissingProps, g as getProps } from './utils-334c1e34.js';
7
+ import './JSS-67b5cff8.js';
8
+ import { L as LEAD_FORM_STATE_CONTEXT, R as RequiredPropsError } from './useLeadFormState-9016d812.js';
9
+ import { L as LeadDropdownFieldView } from './sqm-lead-dropdown-field-view-4c85fe20.js';
10
+
11
+ function useLeadDropdownField() {
12
+ const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
13
+ return {
14
+ states: {
15
+ leadFormState,
16
+ },
17
+ };
18
+ }
19
+
20
+ const LeadDropdownField = class {
21
+ constructor(hostRef) {
22
+ registerInstance(this, hostRef);
23
+ this.ignored = true;
24
+ /**
25
+ * @uiName Dropdown label
26
+ */
27
+ this.dropdownLabel = "Select an option";
28
+ /**
29
+ * The message to be displayed when a required field is not filled.
30
+ *
31
+ * @uiName Required field message
32
+ * @uiWidget textArea
33
+ */
34
+ this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
35
+ /**
36
+ * @uiName Optional
37
+ * @default
38
+ */
39
+ this.dropdownOptional = false;
40
+ h(this);
41
+ }
42
+ disconnectedCallback() { }
43
+ render() {
44
+ const missingProps = getMissingProps([
45
+ {
46
+ attribute: "dropdown-name",
47
+ value: this.dropdownName,
48
+ },
49
+ ]);
50
+ if (!isDemo() && missingProps) {
51
+ return (h$1(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }, h$1("slot", null)));
52
+ }
53
+ const content = {
54
+ ...getProps(this),
55
+ selectOptions: h$1("slot", null),
56
+ };
57
+ const { states } = isDemo()
58
+ ? useLeadDropdownFieldDemo(this)
59
+ : useLeadDropdownField();
60
+ return (h$1(LeadDropdownFieldView, { states: states, content: content }));
61
+ }
62
+ };
63
+ function useLeadDropdownFieldDemo(props) {
64
+ return cjs({
65
+ states: {
66
+ leadFormState: {},
67
+ },
68
+ content: {
69
+ dropdownName: props.dropdownName,
70
+ dropdownLabel: props.dropdownLabel,
71
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
72
+ dropdownOptional: props.dropdownOptional,
73
+ },
74
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
75
+ }
76
+
77
+ export { LeadDropdownField as sqm_lead_dropdown_field };