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

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 (85) hide show
  1. package/dist/cjs/{ShadowViewAddon-c0a5fdf8.js → ShadowViewAddon-f5ca0367.js} +75 -47
  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 +117 -120
  5. package/dist/cjs/sqm-lead-dropdown-field-view-0211d640.js +67 -0
  6. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +81 -0
  7. package/dist/cjs/sqm-lead-input-field-view-5a0b1aed.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 +167 -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 +35 -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 +63 -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 +77 -48
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +150 -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 +36 -7
  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-b360202a.js} +76 -48
  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 +114 -117
  29. package/dist/esm/sqm-lead-dropdown-field-view-62e74a36.js +65 -0
  30. package/dist/esm/sqm-lead-dropdown-field.entry.js +77 -0
  31. package/dist/esm/sqm-lead-input-field-view-9b23f22c.js +49 -0
  32. package/dist/esm/sqm-lead-input-field.entry.js +80 -0
  33. package/dist/esm/sqm-stencilbook.entry.js +167 -49
  34. package/dist/esm/useLeadFormState-9016d812.js +68 -0
  35. package/dist/esm-es5/ShadowViewAddon-b360202a.js +1 -0
  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-62e74a36.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-9b23f22c.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-00590b7a.system.js +1 -0
  47. package/dist/mint-components/p-036e8dad.system.js +1 -0
  48. package/dist/mint-components/{p-8dc110b0.entry.js → p-0f2bbd2a.entry.js} +2 -2
  49. package/dist/mint-components/p-1d704c40.system.js +1 -0
  50. package/dist/mint-components/p-2192104c.entry.js +1 -0
  51. package/dist/mint-components/p-2d15db9b.system.entry.js +1 -0
  52. package/dist/mint-components/{p-373a92a2.js → p-2efc0d36.js} +24 -24
  53. package/dist/mint-components/p-37996351.system.js +1 -1
  54. package/dist/mint-components/p-3e327cc8.system.entry.js +1 -0
  55. package/dist/mint-components/p-789e2217.entry.js +273 -0
  56. package/dist/mint-components/p-84a9e392.system.entry.js +1 -0
  57. package/dist/mint-components/p-8698266c.system.js +1 -0
  58. package/dist/mint-components/p-b54f8e03.entry.js +1 -0
  59. package/dist/mint-components/p-cd10001b.js +1 -0
  60. package/dist/mint-components/p-de5321fc.system.entry.js +1 -0
  61. package/dist/mint-components/p-f6717dd7.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 +8 -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 +6 -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/esm-es5/ShadowViewAddon-aa7177fe.js +0 -1
  82. package/dist/mint-components/p-02a6e0df.system.entry.js +0 -1
  83. package/dist/mint-components/p-0c6ab3ec.system.entry.js +0 -1
  84. package/dist/mint-components/p-6349fb7c.entry.js +0 -265
  85. package/dist/mint-components/p-72e5e84f.system.js +0 -1
@@ -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-b360202a.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,15 +1289,6 @@ 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
1293
  mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1354
1294
  submitForm(formSubmissionInput: $formSubmissionInput) {
@@ -1356,11 +1296,25 @@ const SUBMIT_LEAD = dist.gql `
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) {
@@ -1437,6 +1392,18 @@ function useLeadForm(props) {
1437
1392
  const asYouType = new AsYouType("US");
1438
1393
  e.target.value = asYouType.input(e.target.value);
1439
1394
  }, []);
1395
+ function resetForm() {
1396
+ var _a, _b;
1397
+ setLeadFormState({
1398
+ loading: false,
1399
+ error: "",
1400
+ validationErrors: {},
1401
+ });
1402
+ (_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
1403
+ c.value = "";
1404
+ });
1405
+ setSuccess(false);
1406
+ }
1440
1407
  let errorMessage = "";
1441
1408
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1442
1409
  errorMessage = props.networkErrorMessage;
@@ -1448,16 +1415,19 @@ function useLeadForm(props) {
1448
1415
  errorMessage =
1449
1416
  ((_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
1417
  }
1418
+ console.log({ errors, errorMessage });
1451
1419
  return {
1452
1420
  states: {
1453
1421
  loading,
1454
1422
  error: errorMessage,
1423
+ success,
1455
1424
  leadFormState,
1456
- referralCode: "ABC123",
1425
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1457
1426
  },
1458
1427
  callbacks: {
1459
1428
  submit,
1460
1429
  inputFunction,
1430
+ resetForm,
1461
1431
  },
1462
1432
  refs: {
1463
1433
  formRef,
@@ -1469,13 +1439,6 @@ const LeadForm = class {
1469
1439
  constructor(hostRef) {
1470
1440
  registerInstance(this, hostRef);
1471
1441
  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
1442
  /**
1480
1443
  * @uiName Email field label
1481
1444
  */
@@ -1492,18 +1455,42 @@ const LeadForm = class {
1492
1455
  * @uiName Submit button text
1493
1456
  */
1494
1457
  this.submitLabel = "Submit";
1458
+ /**
1459
+ * @uiName Submit another form button label
1460
+ */
1461
+ this.resubmitFormLabel = "Refer Another Friend";
1495
1462
  /**
1496
1463
  * @uiName Header text
1497
1464
  */
1498
- this.pageLabel = "Submit your information";
1465
+ this.pageLabel = "Refer your friend";
1499
1466
  this.formKey = "lead-form";
1467
+ /**
1468
+ * Optional support link for error messages.
1469
+ */
1470
+ this.supportLink = "Support";
1471
+ /**
1472
+ * Header text shown on successful submission.
1473
+ */
1474
+ this.submitSuccessHeader = "Referral submitted";
1475
+ /**
1476
+ * Description text shown on successful submission.
1477
+ */
1478
+ 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.";
1479
+ /**
1480
+ * Header text shown when an error occurs.
1481
+ */
1482
+ this.submitErrorHeader = "An error occurred while submitting";
1483
+ /**
1484
+ * Description text shown when an error occurs.
1485
+ */
1486
+ this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1500
1487
  /**
1501
1488
  * The message to be displayed when a required field is not filled.
1502
1489
  *
1503
1490
  * @uiName Required field message
1504
1491
  * @uiWidget textArea
1505
1492
  */
1506
- this.requiredFieldErrorMessage = "Cannot be empty";
1493
+ this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1507
1494
  /**
1508
1495
  * The message to be displayed when a the form submission fails unexpectedly.
1509
1496
  *
@@ -1529,9 +1516,17 @@ const LeadForm = class {
1529
1516
  formData: h$1("slot", { name: "formData" }),
1530
1517
  emailLabel: this.emailLabel,
1531
1518
  submitLabel: this.submitLabel,
1519
+ resubmitFormLabel: this.resubmitFormLabel,
1532
1520
  pageLabel: this.pageLabel,
1521
+ supportLink: this.supportLink,
1522
+ submitSuccessHeader: this.submitSuccessHeader,
1523
+ submitSuccessDescription: this.submitSuccessDescription,
1524
+ submitErrorHeader: this.submitErrorHeader,
1525
+ submitErrorDescription: this.submitErrorDescription,
1533
1526
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1534
1527
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1528
+ firstNameLabel: this.firstNameLabel,
1529
+ lastNameLabel: this.lastNameLabel,
1535
1530
  };
1536
1531
  return (h$1(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1537
1532
  }
@@ -1541,12 +1536,14 @@ function useRegisterDemo(props) {
1541
1536
  states: {
1542
1537
  error: "",
1543
1538
  loading: false,
1539
+ success: false,
1544
1540
  },
1545
1541
  callbacks: {
1546
1542
  submit: async (_event) => {
1547
1543
  console.log("submit");
1548
1544
  },
1549
1545
  inputFunction: () => { },
1546
+ resetForm: () => { },
1550
1547
  },
1551
1548
  refs: {
1552
1549
  formRef: {},
@@ -1851,7 +1848,7 @@ function useLeaderboardDemo(props) {
1851
1848
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1852
1849
  }
1853
1850
 
1854
- const style$1 = {
1851
+ const style = {
1855
1852
  Container: { display: "contents" },
1856
1853
  Link: {
1857
1854
  textDecoration: "none",
@@ -1863,16 +1860,16 @@ const vanillaStyle = `
1863
1860
  display: inline;
1864
1861
  }
1865
1862
  `;
1866
- const sheet$1 = createStyleSheet(style$1);
1867
- const styleString$1 = sheet$1.toString();
1863
+ const sheet = createStyleSheet(style);
1864
+ const styleString = sheet.toString();
1868
1865
  function LinkButtonView(props) {
1869
1866
  const { onClick, buttonText } = props;
1870
- return (h$1("span", { class: sheet$1.classes.Container, part: "sqm-base" },
1867
+ return (h$1("span", { class: sheet.classes.Container, part: "sqm-base" },
1871
1868
  h$1("style", { type: "text/css" },
1872
- styleString$1,
1869
+ styleString,
1873
1870
  vanillaStyle),
1874
1871
  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))));
1872
+ h$1("a", { class: sheet.classes.Link, part: "sqm-link" }, buttonText))));
1876
1873
  }
1877
1874
 
1878
1875
  const LinkButton = class {
@@ -2053,7 +2050,7 @@ function useNavigationMenuDemo(props) {
2053
2050
  }
2054
2051
  NavigationMenu.style = sqmNavigationMenuCss;
2055
2052
 
2056
- const style$2 = {
2053
+ const style$1 = {
2057
2054
  Wrapper: {
2058
2055
  maxWidth: "200px",
2059
2056
  marginLeft: "auto",
@@ -2064,16 +2061,16 @@ const style$2 = {
2064
2061
  margin: "0",
2065
2062
  },
2066
2063
  };
2067
- const sheet$2 = createStyleSheet(style$2);
2068
- const styleString$2 = sheet$2.toString();
2064
+ const sheet$1 = createStyleSheet(style$1);
2065
+ const styleString$1 = sheet$1.toString();
2069
2066
  function PayoutButtonScrollView(props) {
2070
2067
  const { text, states } = props;
2071
2068
  if (!states.payoutSettingsComplete)
2072
2069
  return h$1("div", null);
2073
- return (h$1("div", { class: sheet$2.classes.Wrapper },
2074
- h$1("style", { type: "text/css" }, styleString$2),
2070
+ return (h$1("div", { class: sheet$1.classes.Wrapper },
2071
+ h$1("style", { type: "text/css" }, styleString$1),
2075
2072
  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)));
2073
+ h$1("p", { class: sheet$1.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2077
2074
  }
2078
2075
 
2079
2076
  const GET_PAYOUT_DETAILS = dist.gql `
@@ -2146,7 +2143,7 @@ function useDemoPayoutButtonScroll(props) {
2146
2143
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
2147
2144
  }
2148
2145
 
2149
- const style$3 = {
2146
+ const style$2 = {
2150
2147
  SkeletonOne: {
2151
2148
  width: "50%",
2152
2149
  height: "16px",
@@ -2197,8 +2194,8 @@ const style$3 = {
2197
2194
  "&::part(footer)": {},
2198
2195
  },
2199
2196
  };
2200
- const sheet$3 = createStyleSheet(style$3);
2201
- const styleString$3 = sheet$3.toString();
2197
+ const sheet$2 = createStyleSheet(style$2);
2198
+ const styleString$2 = sheet$2.toString();
2202
2199
  function PayoutStatusAlertView(props) {
2203
2200
  const { text, states, data, callbacks } = props;
2204
2201
  function getAlert(status) {
@@ -2209,7 +2206,7 @@ function PayoutStatusAlertView(props) {
2209
2206
  buttonText: null,
2210
2207
  alertType: "critical",
2211
2208
  icon: "exclamation-triangle",
2212
- class: sheet$3.classes.ErrorAlertContainer,
2209
+ class: sheet$2.classes.ErrorAlertContainer,
2213
2210
  };
2214
2211
  switch (status) {
2215
2212
  case "INFORMATION_REQUIRED":
@@ -2219,7 +2216,7 @@ function PayoutStatusAlertView(props) {
2219
2216
  buttonText: text.informationRequiredButtonText,
2220
2217
  alertType: "info",
2221
2218
  icon: "info-circle",
2222
- class: sheet$3.classes.InfoAlertContainer,
2219
+ class: sheet$2.classes.InfoAlertContainer,
2223
2220
  };
2224
2221
  case "VERIFICATION:REQUIRED":
2225
2222
  return {
@@ -2233,7 +2230,7 @@ function PayoutStatusAlertView(props) {
2233
2230
  buttonText: text.verificationRequiredButtonText,
2234
2231
  alertType: "warning",
2235
2232
  icon: "exclamation-triangle",
2236
- class: sheet$3.classes.WarningAlertContainer,
2233
+ class: sheet$2.classes.WarningAlertContainer,
2237
2234
  };
2238
2235
  case "VERIFICATION:INTERNAL":
2239
2236
  return {
@@ -2246,7 +2243,7 @@ function PayoutStatusAlertView(props) {
2246
2243
  }),
2247
2244
  alertType: "warning",
2248
2245
  icon: "exclamation-triangle",
2249
- class: sheet$3.classes.WarningAlertContainer,
2246
+ class: sheet$2.classes.WarningAlertContainer,
2250
2247
  };
2251
2248
  case "VERIFICATION:REVIEW":
2252
2249
  return {
@@ -2259,7 +2256,7 @@ function PayoutStatusAlertView(props) {
2259
2256
  }),
2260
2257
  alertType: "warning",
2261
2258
  icon: "exclamation-triangle",
2262
- class: sheet$3.classes.WarningAlertContainer,
2259
+ class: sheet$2.classes.WarningAlertContainer,
2263
2260
  };
2264
2261
  case "VERIFICATION:FAILED":
2265
2262
  return {
@@ -2272,7 +2269,7 @@ function PayoutStatusAlertView(props) {
2272
2269
  }),
2273
2270
  alertType: "critical",
2274
2271
  icon: "exclamation-octagon",
2275
- class: sheet$3.classes.ErrorAlertContainer,
2272
+ class: sheet$2.classes.ErrorAlertContainer,
2276
2273
  };
2277
2274
  case "HOLD":
2278
2275
  return {
@@ -2286,7 +2283,7 @@ function PayoutStatusAlertView(props) {
2286
2283
  buttonText: null,
2287
2284
  alertType: "warning",
2288
2285
  icon: "exclamation-triangle",
2289
- class: sheet$3.classes.WarningAlertContainer,
2286
+ class: sheet$2.classes.WarningAlertContainer,
2290
2287
  };
2291
2288
  default:
2292
2289
  return;
@@ -2305,18 +2302,18 @@ function PayoutStatusAlertView(props) {
2305
2302
  }
2306
2303
  }
2307
2304
  if (states.loading) {
2308
- return h$1("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
2305
+ return h$1("sl-skeleton", { class: sheet$2.classes.SkeletonOne });
2309
2306
  }
2310
2307
  const alertDetails = getAlert(states.status);
2311
2308
  if (states.status === "DONE" || !alertDetails) {
2312
2309
  return h$1("div", null);
2313
2310
  }
2314
2311
  return (h$1("div", { part: "sqm-base" },
2315
- h$1("style", { type: "text/css" }, styleString$3),
2312
+ h$1("style", { type: "text/css" }, styleString$2),
2316
2313
  h$1("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: alertDetails.alertType, class: alertDetails.class, open: true },
2317
2314
  h$1("sl-icon", { slot: "icon", name: alertDetails.icon }),
2318
2315
  h$1("strong", null, alertDetails.header),
2319
- h$1("p", { class: sheet$3.classes.AlertDescriptionText }, alertDetails.description),
2316
+ h$1("p", { class: sheet$2.classes.AlertDescriptionText }, alertDetails.description),
2320
2317
  getButton(states.status))));
2321
2318
  }
2322
2319
 
@@ -3470,7 +3467,7 @@ const ProgramMenu = class {
3470
3467
  }
3471
3468
  };
3472
3469
 
3473
- const style$4 = {
3470
+ const style$3 = {
3474
3471
  Container: {
3475
3472
  borderRadius: "var(--sl-border-radius-large)",
3476
3473
  color: "var(--sl-color-neutral-900)",
@@ -3498,15 +3495,15 @@ const style$4 = {
3498
3495
  },
3499
3496
  },
3500
3497
  };
3501
- const sheet$4 = createStyleSheet(style$4);
3502
- const styleString$4 = sheet$4.toString();
3498
+ const sheet$3 = createStyleSheet(style$3);
3499
+ const styleString$3 = sheet$3.toString();
3503
3500
  const vanillaStyle$1 = `
3504
3501
  :host{
3505
3502
  display: block;
3506
3503
  }
3507
3504
  `;
3508
3505
  function ReferralCardView(props) {
3509
- return (h$1("div", { part: "sqm-base", class: sheet$4.classes.Container, style: {
3506
+ return (h$1("div", { part: "sqm-base", class: sheet$3.classes.Container, style: {
3510
3507
  border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
3511
3508
  "padding-top": `var(--sl-spacing-${props.paddingTop})`,
3512
3509
  "padding-right": `var(--sl-spacing-${props.paddingRight})`,
@@ -3517,15 +3514,15 @@ function ReferralCardView(props) {
3517
3514
  margin: `${props.limitWidth ? "auto" : "none"}`,
3518
3515
  } },
3519
3516
  h$1("style", { type: "text/css" },
3520
- styleString$4,
3517
+ styleString$3,
3521
3518
  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: {
3519
+ props.hasHeader && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.header)),
3520
+ h$1("div", { part: "sqm-column-container", class: sheet$3.classes.ColumnContainer, style: {
3524
3521
  alignItems: props.verticalAlignment,
3525
3522
  } },
3526
3523
  props.slots.left,
3527
3524
  props.slots.right),
3528
- props.hasFooter && (h$1("div", { class: sheet$4.classes.EndContainer }, props.slots.footer))));
3525
+ props.hasFooter && (h$1("div", { class: sheet$3.classes.EndContainer }, props.slots.footer))));
3529
3526
  }
3530
3527
 
3531
3528
  const ReferralCard = class {
@@ -3600,7 +3597,7 @@ const ReferralCard = class {
3600
3597
  }
3601
3598
  };
3602
3599
 
3603
- const GET_USER_DETAILS = dist.gql `
3600
+ const GET_USER_DETAILS$1 = dist.gql `
3604
3601
  query getUser($programId: ID) {
3605
3602
  viewer {
3606
3603
  ... on User {
@@ -3613,7 +3610,7 @@ function useReferralIframe(props) {
3613
3610
  var _a;
3614
3611
  const programId = H();
3615
3612
  const user = J();
3616
- const { data } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3613
+ const { data } = wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3617
3614
  return {
3618
3615
  states: {
3619
3616
  content: props,
@@ -5248,7 +5245,7 @@ const Gift = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24"
5248
5245
  const Circle = () => (h$1("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5249
5246
  h$1("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
5250
5247
 
5251
- const style$5 = {
5248
+ const style$4 = {
5252
5249
  TimelineReward: {
5253
5250
  color: "var(--sl-color-neutral-900)",
5254
5251
  lineHeight: "var(--sl-line-height-dense)",
@@ -5291,8 +5288,8 @@ const style$5 = {
5291
5288
  },
5292
5289
  },
5293
5290
  };
5294
- const sheet$5 = createStyleSheet(style$5);
5295
- const styleString$5 = sheet$5.toString();
5291
+ const sheet$4 = createStyleSheet(style$4);
5292
+ const styleString$4 = sheet$4.toString();
5296
5293
  const vanillaStyle$2 = `
5297
5294
  :host{
5298
5295
  display: block;
@@ -5305,9 +5302,9 @@ const vanillaStyle$2 = `
5305
5302
  function TimelineEntryView(props) {
5306
5303
  var _a;
5307
5304
  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" },
5305
+ return (h$1("div", { class: sheet$4.classes.TimelineReward, part: "sqm-base" },
5309
5306
  h$1("style", { type: "text/css" },
5310
- styleString$5,
5307
+ styleString$4,
5311
5308
  vanillaStyle$2),
5312
5309
  h$1("div", { class: "container", part: "sqm-entry-container" },
5313
5310
  h$1("div", { class: "line" }, "/"),
@@ -0,0 +1,65 @@
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;
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
+ console.log({ validationErrors });
40
+ const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => intl.formatMessage({
41
+ id: `requiredFieldErrorMessage-${dropdownLabel}`,
42
+ defaultMessage: content.requiredFieldErrorMessage,
43
+ }, {
44
+ dropdownLabel,
45
+ });
46
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
47
+ h("style", { type: "text/css" },
48
+ vanillaStyle,
49
+ styleString),
50
+ 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 }) => {
51
+ if (!value) {
52
+ return getRequiredFieldErrorMessage({
53
+ dropdownLabel: content.dropdownLabel,
54
+ });
55
+ }
56
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.dropdownName]) ? {
57
+ class: sheet.classes.ErrorStyle,
58
+ }
59
+ : [])), content.selectOptions),
60
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
61
+ dropdownLabel: content.dropdownLabel,
62
+ })))));
63
+ }
64
+
65
+ 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-62e74a36.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 };