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

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 +108 -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 +30 -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 +105 -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-10343b27.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-4056c0ea.system.entry.js +1 -0
  52. package/dist/mint-components/{p-373a92a2.js → p-460974bf.js} +3 -3
  53. package/dist/mint-components/p-4d5b02af.js +1 -0
  54. package/dist/mint-components/p-59970cb1.system.entry.js +1 -0
  55. package/dist/mint-components/p-6b093d8c.entry.js +1 -0
  56. package/dist/mint-components/p-79e1a189.entry.js +273 -0
  57. package/dist/mint-components/p-87384d9e.system.js +1 -0
  58. package/dist/mint-components/{p-72e5e84f.system.js → p-ad128614.system.js} +1 -1
  59. package/dist/mint-components/{p-8dc110b0.entry.js → p-ba585a4b.entry.js} +2 -2
  60. package/dist/mint-components/p-c5a55554.entry.js +1 -0
  61. package/dist/mint-components/p-de5356d9.system.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 +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, _b, _c;
1374
1329
  let formControls = event.target.getFormControls();
1375
1330
  let formData = {};
1376
1331
  let validationErrors = {};
@@ -1409,6 +1364,11 @@ function useLeadForm(props) {
1409
1364
  };
1410
1365
  try {
1411
1366
  const result = await submitLead({ formSubmissionInput: variables });
1367
+ console.log({
1368
+ result,
1369
+ success: (_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success,
1370
+ isError: result instanceof Error,
1371
+ });
1412
1372
  if (result instanceof Error) {
1413
1373
  throw result;
1414
1374
  }
@@ -1417,11 +1377,12 @@ function useLeadForm(props) {
1417
1377
  error: "",
1418
1378
  validationErrors: {},
1419
1379
  });
1420
- if (result.success) {
1421
- jn.push(props.nextPage);
1380
+ if ((_c = (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.submitForm) === null || _c === void 0 ? void 0 : _c.success) {
1381
+ setSuccess(true);
1422
1382
  }
1423
1383
  }
1424
1384
  catch (error) {
1385
+ console.log({ error });
1425
1386
  setLeadFormState({
1426
1387
  loading: false,
1427
1388
  error: props.networkErrorMessage,
@@ -1448,12 +1409,14 @@ function useLeadForm(props) {
1448
1409
  errorMessage =
1449
1410
  ((_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
1411
  }
1412
+ console.log({ errors, errorMessage });
1451
1413
  return {
1452
1414
  states: {
1453
1415
  loading,
1454
1416
  error: errorMessage,
1417
+ success,
1455
1418
  leadFormState,
1456
- referralCode: "ABC123",
1419
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1457
1420
  },
1458
1421
  callbacks: {
1459
1422
  submit,
@@ -1469,13 +1432,6 @@ const LeadForm = class {
1469
1432
  constructor(hostRef) {
1470
1433
  registerInstance(this, hostRef);
1471
1434
  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
1435
  /**
1480
1436
  * @uiName Email field label
1481
1437
  */
@@ -1492,18 +1448,42 @@ const LeadForm = class {
1492
1448
  * @uiName Submit button text
1493
1449
  */
1494
1450
  this.submitLabel = "Submit";
1451
+ /**
1452
+ * @uiName Submit another form button label
1453
+ */
1454
+ this.resubmitFormLabel = "Refer Another Friend";
1495
1455
  /**
1496
1456
  * @uiName Header text
1497
1457
  */
1498
- this.pageLabel = "Submit your information";
1458
+ this.pageLabel = "Refer your friend";
1499
1459
  this.formKey = "lead-form";
1460
+ /**
1461
+ * Optional support link for error messages.
1462
+ */
1463
+ this.supportLink = "Support";
1464
+ /**
1465
+ * Header text shown on successful submission.
1466
+ */
1467
+ this.submitSuccessHeader = "Referral submitted";
1468
+ /**
1469
+ * Description text shown on successful submission.
1470
+ */
1471
+ 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.";
1472
+ /**
1473
+ * Header text shown when an error occurs.
1474
+ */
1475
+ this.submitErrorHeader = "An error occurred while submitting";
1476
+ /**
1477
+ * Description text shown when an error occurs.
1478
+ */
1479
+ this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1500
1480
  /**
1501
1481
  * The message to be displayed when a required field is not filled.
1502
1482
  *
1503
1483
  * @uiName Required field message
1504
1484
  * @uiWidget textArea
1505
1485
  */
1506
- this.requiredFieldErrorMessage = "Cannot be empty";
1486
+ this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1507
1487
  /**
1508
1488
  * The message to be displayed when a the form submission fails unexpectedly.
1509
1489
  *
@@ -1529,7 +1509,13 @@ const LeadForm = class {
1529
1509
  formData: h$1("slot", { name: "formData" }),
1530
1510
  emailLabel: this.emailLabel,
1531
1511
  submitLabel: this.submitLabel,
1512
+ resubmitFormLabel: this.resubmitFormLabel,
1532
1513
  pageLabel: this.pageLabel,
1514
+ supportLink: this.supportLink,
1515
+ submitSuccessHeader: this.submitSuccessHeader,
1516
+ submitSuccessDescription: this.submitSuccessDescription,
1517
+ submitErrorHeader: this.submitErrorHeader,
1518
+ submitErrorDescription: this.submitErrorDescription,
1533
1519
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1534
1520
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1535
1521
  };
@@ -1541,6 +1527,7 @@ function useRegisterDemo(props) {
1541
1527
  states: {
1542
1528
  error: "",
1543
1529
  loading: false,
1530
+ success: false,
1544
1531
  },
1545
1532
  callbacks: {
1546
1533
  submit: async (_event) => {
@@ -1851,7 +1838,7 @@ function useLeaderboardDemo(props) {
1851
1838
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1852
1839
  }
1853
1840
 
1854
- const style$1 = {
1841
+ const style = {
1855
1842
  Container: { display: "contents" },
1856
1843
  Link: {
1857
1844
  textDecoration: "none",
@@ -1863,16 +1850,16 @@ const vanillaStyle = `
1863
1850
  display: inline;
1864
1851
  }
1865
1852
  `;
1866
- const sheet$1 = createStyleSheet(style$1);
1867
- const styleString$1 = sheet$1.toString();
1853
+ const sheet = createStyleSheet(style);
1854
+ const styleString = sheet.toString();
1868
1855
  function LinkButtonView(props) {
1869
1856
  const { onClick, buttonText } = props;
1870
- return (h$1("span", { class: sheet$1.classes.Container, part: "sqm-base" },
1857
+ return (h$1("span", { class: sheet.classes.Container, part: "sqm-base" },
1871
1858
  h$1("style", { type: "text/css" },
1872
- styleString$1,
1859
+ styleString,
1873
1860
  vanillaStyle),
1874
1861
  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))));
1862
+ h$1("a", { class: sheet.classes.Link, part: "sqm-link" }, buttonText))));
1876
1863
  }
1877
1864
 
1878
1865
  const LinkButton = class {
@@ -2053,7 +2040,7 @@ function useNavigationMenuDemo(props) {
2053
2040
  }
2054
2041
  NavigationMenu.style = sqmNavigationMenuCss;
2055
2042
 
2056
- const style$2 = {
2043
+ const style$1 = {
2057
2044
  Wrapper: {
2058
2045
  maxWidth: "200px",
2059
2046
  marginLeft: "auto",
@@ -2064,16 +2051,16 @@ const style$2 = {
2064
2051
  margin: "0",
2065
2052
  },
2066
2053
  };
2067
- const sheet$2 = createStyleSheet(style$2);
2068
- const styleString$2 = sheet$2.toString();
2054
+ const sheet$1 = createStyleSheet(style$1);
2055
+ const styleString$1 = sheet$1.toString();
2069
2056
  function PayoutButtonScrollView(props) {
2070
2057
  const { text, states } = props;
2071
2058
  if (!states.payoutSettingsComplete)
2072
2059
  return h$1("div", null);
2073
- return (h$1("div", { class: sheet$2.classes.Wrapper },
2074
- h$1("style", { type: "text/css" }, styleString$2),
2060
+ return (h$1("div", { class: sheet$1.classes.Wrapper },
2061
+ h$1("style", { type: "text/css" }, styleString$1),
2075
2062
  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)));
2063
+ h$1("p", { class: sheet$1.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2077
2064
  }
2078
2065
 
2079
2066
  const GET_PAYOUT_DETAILS = dist.gql `
@@ -2146,7 +2133,7 @@ function useDemoPayoutButtonScroll(props) {
2146
2133
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
2147
2134
  }
2148
2135
 
2149
- const style$3 = {
2136
+ const style$2 = {
2150
2137
  SkeletonOne: {
2151
2138
  width: "50%",
2152
2139
  height: "16px",
@@ -2197,8 +2184,8 @@ const style$3 = {
2197
2184
  "&::part(footer)": {},
2198
2185
  },
2199
2186
  };
2200
- const sheet$3 = createStyleSheet(style$3);
2201
- const styleString$3 = sheet$3.toString();
2187
+ const sheet$2 = createStyleSheet(style$2);
2188
+ const styleString$2 = sheet$2.toString();
2202
2189
  function PayoutStatusAlertView(props) {
2203
2190
  const { text, states, data, callbacks } = props;
2204
2191
  function getAlert(status) {
@@ -2209,7 +2196,7 @@ function PayoutStatusAlertView(props) {
2209
2196
  buttonText: null,
2210
2197
  alertType: "critical",
2211
2198
  icon: "exclamation-triangle",
2212
- class: sheet$3.classes.ErrorAlertContainer,
2199
+ class: sheet$2.classes.ErrorAlertContainer,
2213
2200
  };
2214
2201
  switch (status) {
2215
2202
  case "INFORMATION_REQUIRED":
@@ -2219,7 +2206,7 @@ function PayoutStatusAlertView(props) {
2219
2206
  buttonText: text.informationRequiredButtonText,
2220
2207
  alertType: "info",
2221
2208
  icon: "info-circle",
2222
- class: sheet$3.classes.InfoAlertContainer,
2209
+ class: sheet$2.classes.InfoAlertContainer,
2223
2210
  };
2224
2211
  case "VERIFICATION:REQUIRED":
2225
2212
  return {
@@ -2233,7 +2220,7 @@ function PayoutStatusAlertView(props) {
2233
2220
  buttonText: text.verificationRequiredButtonText,
2234
2221
  alertType: "warning",
2235
2222
  icon: "exclamation-triangle",
2236
- class: sheet$3.classes.WarningAlertContainer,
2223
+ class: sheet$2.classes.WarningAlertContainer,
2237
2224
  };
2238
2225
  case "VERIFICATION:INTERNAL":
2239
2226
  return {
@@ -2246,7 +2233,7 @@ function PayoutStatusAlertView(props) {
2246
2233
  }),
2247
2234
  alertType: "warning",
2248
2235
  icon: "exclamation-triangle",
2249
- class: sheet$3.classes.WarningAlertContainer,
2236
+ class: sheet$2.classes.WarningAlertContainer,
2250
2237
  };
2251
2238
  case "VERIFICATION:REVIEW":
2252
2239
  return {
@@ -2259,7 +2246,7 @@ function PayoutStatusAlertView(props) {
2259
2246
  }),
2260
2247
  alertType: "warning",
2261
2248
  icon: "exclamation-triangle",
2262
- class: sheet$3.classes.WarningAlertContainer,
2249
+ class: sheet$2.classes.WarningAlertContainer,
2263
2250
  };
2264
2251
  case "VERIFICATION:FAILED":
2265
2252
  return {
@@ -2272,7 +2259,7 @@ function PayoutStatusAlertView(props) {
2272
2259
  }),
2273
2260
  alertType: "critical",
2274
2261
  icon: "exclamation-octagon",
2275
- class: sheet$3.classes.ErrorAlertContainer,
2262
+ class: sheet$2.classes.ErrorAlertContainer,
2276
2263
  };
2277
2264
  case "HOLD":
2278
2265
  return {
@@ -2286,7 +2273,7 @@ function PayoutStatusAlertView(props) {
2286
2273
  buttonText: null,
2287
2274
  alertType: "warning",
2288
2275
  icon: "exclamation-triangle",
2289
- class: sheet$3.classes.WarningAlertContainer,
2276
+ class: sheet$2.classes.WarningAlertContainer,
2290
2277
  };
2291
2278
  default:
2292
2279
  return;
@@ -2305,18 +2292,18 @@ function PayoutStatusAlertView(props) {
2305
2292
  }
2306
2293
  }
2307
2294
  if (states.loading) {
2308
- return h$1("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
2295
+ return h$1("sl-skeleton", { class: sheet$2.classes.SkeletonOne });
2309
2296
  }
2310
2297
  const alertDetails = getAlert(states.status);
2311
2298
  if (states.status === "DONE" || !alertDetails) {
2312
2299
  return h$1("div", null);
2313
2300
  }
2314
2301
  return (h$1("div", { part: "sqm-base" },
2315
- h$1("style", { type: "text/css" }, styleString$3),
2302
+ h$1("style", { type: "text/css" }, styleString$2),
2316
2303
  h$1("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: alertDetails.alertType, class: alertDetails.class, open: true },
2317
2304
  h$1("sl-icon", { slot: "icon", name: alertDetails.icon }),
2318
2305
  h$1("strong", null, alertDetails.header),
2319
- h$1("p", { class: sheet$3.classes.AlertDescriptionText }, alertDetails.description),
2306
+ h$1("p", { class: sheet$2.classes.AlertDescriptionText }, alertDetails.description),
2320
2307
  getButton(states.status))));
2321
2308
  }
2322
2309
 
@@ -3470,7 +3457,7 @@ const ProgramMenu = class {
3470
3457
  }
3471
3458
  };
3472
3459
 
3473
- const style$4 = {
3460
+ const style$3 = {
3474
3461
  Container: {
3475
3462
  borderRadius: "var(--sl-border-radius-large)",
3476
3463
  color: "var(--sl-color-neutral-900)",
@@ -3498,15 +3485,15 @@ const style$4 = {
3498
3485
  },
3499
3486
  },
3500
3487
  };
3501
- const sheet$4 = createStyleSheet(style$4);
3502
- const styleString$4 = sheet$4.toString();
3488
+ const sheet$3 = createStyleSheet(style$3);
3489
+ const styleString$3 = sheet$3.toString();
3503
3490
  const vanillaStyle$1 = `
3504
3491
  :host{
3505
3492
  display: block;
3506
3493
  }
3507
3494
  `;
3508
3495
  function ReferralCardView(props) {
3509
- return (h$1("div", { part: "sqm-base", class: sheet$4.classes.Container, style: {
3496
+ return (h$1("div", { part: "sqm-base", class: sheet$3.classes.Container, style: {
3510
3497
  border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
3511
3498
  "padding-top": `var(--sl-spacing-${props.paddingTop})`,
3512
3499
  "padding-right": `var(--sl-spacing-${props.paddingRight})`,
@@ -3517,15 +3504,15 @@ function ReferralCardView(props) {
3517
3504
  margin: `${props.limitWidth ? "auto" : "none"}`,
3518
3505
  } },
3519
3506
  h$1("style", { type: "text/css" },
3520
- styleString$4,
3507
+ styleString$3,
3521
3508
  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: {
3509
+ props.hasHeader && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.header)),
3510
+ h$1("div", { part: "sqm-column-container", class: sheet$3.classes.ColumnContainer, style: {
3524
3511
  alignItems: props.verticalAlignment,
3525
3512
  } },
3526
3513
  props.slots.left,
3527
3514
  props.slots.right),
3528
- props.hasFooter && (h$1("div", { class: sheet$4.classes.EndContainer }, props.slots.footer))));
3515
+ props.hasFooter && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.footer))));
3529
3516
  }
3530
3517
 
3531
3518
  const ReferralCard = class {
@@ -3600,7 +3587,7 @@ const ReferralCard = class {
3600
3587
  }
3601
3588
  };
3602
3589
 
3603
- const GET_USER_DETAILS = dist.gql `
3590
+ const GET_USER_DETAILS$1 = dist.gql `
3604
3591
  query getUser($programId: ID) {
3605
3592
  viewer {
3606
3593
  ... on User {
@@ -3613,7 +3600,7 @@ function useReferralIframe(props) {
3613
3600
  var _a;
3614
3601
  const programId = H();
3615
3602
  const user = J();
3616
- const { data } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3603
+ const { data } = wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3617
3604
  return {
3618
3605
  states: {
3619
3606
  content: props,
@@ -5248,7 +5235,7 @@ const Gift = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24"
5248
5235
  const Circle = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5249
5236
  h$1("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
5250
5237
 
5251
- const style$5 = {
5238
+ const style$4 = {
5252
5239
  TimelineReward: {
5253
5240
  color: "var(--sl-color-neutral-900)",
5254
5241
  lineHeight: "var(--sl-line-height-dense)",
@@ -5291,8 +5278,8 @@ const style$5 = {
5291
5278
  },
5292
5279
  },
5293
5280
  };
5294
- const sheet$5 = createStyleSheet(style$5);
5295
- const styleString$5 = sheet$5.toString();
5281
+ const sheet$4 = createStyleSheet(style$4);
5282
+ const styleString$4 = sheet$4.toString();
5296
5283
  const vanillaStyle$2 = `
5297
5284
  :host{
5298
5285
  display: block;
@@ -5305,9 +5292,9 @@ const vanillaStyle$2 = `
5305
5292
  function TimelineEntryView(props) {
5306
5293
  var _a;
5307
5294
  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" },
5295
+ return (h$1("div", { class: sheet$4.classes.TimelineReward, part: "sqm-base" },
5309
5296
  h$1("style", { type: "text/css" },
5310
- styleString$5,
5297
+ styleString$4,
5311
5298
  vanillaStyle$2),
5312
5299
  h$1("div", { class: "container", part: "sqm-entry-container" },
5313
5300
  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 };