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

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 (79) hide show
  1. package/dist/cjs/{ShadowViewAddon-40f0bc74.js → ShadowViewAddon-cfd0e201.js} +115 -48
  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 → sqm-big-stat_43.cjs.entry.js} +136 -22
  5. package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
  6. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +12 -2
  7. package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
  8. package/dist/collection/collection-manifest.json +1 -1
  9. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
  10. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
  11. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
  12. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
  13. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +8 -10
  14. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +62 -2
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +56 -50
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +64 -34
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +34 -3
  19. package/dist/collection/components/sqm-lead-form/useLeadForm.js +32 -6
  20. package/dist/esm/{ShadowViewAddon-8a0d9e83.js → ShadowViewAddon-00515b50.js} +116 -50
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/mint-components.js +1 -1
  23. package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_43.entry.js} +136 -23
  24. package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
  25. package/dist/esm/sqm-lead-input-field.entry.js +12 -2
  26. package/dist/esm/sqm-stencilbook.entry.js +12 -5
  27. package/dist/esm-es5/ShadowViewAddon-00515b50.js +1 -0
  28. package/dist/esm-es5/loader.js +1 -1
  29. package/dist/esm-es5/mint-components.js +1 -1
  30. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
  31. package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
  32. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  33. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  34. package/dist/mint-components/mint-components.esm.js +1 -1
  35. package/dist/mint-components/p-01dd541f.system.js +1 -0
  36. package/dist/mint-components/p-37996351.system.js +1 -1
  37. package/dist/mint-components/p-6544656d.system.js +1 -0
  38. package/dist/mint-components/p-6ba44ca9.js +1 -0
  39. package/dist/mint-components/{p-cd1c6113.entry.js → p-ad24132a.entry.js} +2 -2
  40. package/dist/mint-components/p-c2375fad.system.entry.js +1 -0
  41. package/dist/mint-components/{p-e358f0c1.entry.js → p-cc9ec01e.entry.js} +28 -20
  42. package/dist/mint-components/p-d3144467.system.entry.js +1 -0
  43. package/dist/mint-components/p-d3e72503.entry.js +1 -0
  44. package/dist/mint-components/{p-4139feb5.js → p-eb9ecf25.js} +24 -24
  45. package/dist/mint-components/p-fbbb85f0.system.entry.js +1 -0
  46. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
  47. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
  48. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +10 -1
  49. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
  50. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +18 -9
  51. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
  52. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -0
  53. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +2 -1
  54. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  55. package/dist/types/components.d.ts +63 -19
  56. package/docs/docs.docx +0 -0
  57. package/docs/raisins.json +1 -1
  58. package/grapesjs/grapesjs.js +1 -1
  59. package/package.json +1 -1
  60. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
  61. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -75
  62. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
  63. package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -71
  64. package/dist/esm-es5/ShadowViewAddon-8a0d9e83.js +0 -1
  65. package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
  66. package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
  67. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
  68. package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
  69. package/dist/mint-components/p-13c67985.system.entry.js +0 -1
  70. package/dist/mint-components/p-15f1ff1d.system.js +0 -1
  71. package/dist/mint-components/p-26da31c6.js +0 -1
  72. package/dist/mint-components/p-4d5b02af.js +0 -1
  73. package/dist/mint-components/p-87384d9e.system.js +0 -1
  74. package/dist/mint-components/p-875861d7.system.entry.js +0 -1
  75. package/dist/mint-components/p-8af8ab01.system.entry.js +0 -1
  76. package/dist/mint-components/p-9e1570bf.system.entry.js +0 -1
  77. package/dist/mint-components/p-ad6420a2.system.js +0 -1
  78. package/dist/mint-components/p-b8c15858.entry.js +0 -1
  79. package/dist/mint-components/p-f59d6012.entry.js +0 -1
@@ -15,13 +15,13 @@ 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';
19
18
  import { P as PortalLoginView } from './sqm-portal-login-view-7e49609a.js';
20
19
  import { u as usePortalLogin } from './usePortalLogin-ef647a50.js';
21
20
  import { A as AsYouType } from './AsYouType-46f67d0d.js';
22
21
  import { i as isEmpty } from './utilities-5b0ca040.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-8a0d9e83.js';
22
+ import { b as useDemoBigStat, W as useBigStat, B as BigStatView, U as autoColorScaleCss, J as CardFeedView, i as CheckboxFieldView, K as CouponCodeView, D as DropdownFieldView, E as EditProfileView, H as HeroView, I as InputFieldView, Q as LeadDropdownFieldView, O as LeadFormView, X 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, Y as demoRewardExchange, j as RewardExchangeView, a as useShareButton, S as ShareButtonView, u as useShareLink, c as StatContainerView, T as TaskCardView } from './ShadowViewAddon-00515b50.js';
24
23
  import './sqm-portal-container-view-1683ae32.js';
24
+ import { R as RequiredPropsError, L as LEAD_FORM_STATE_CONTEXT, u as useLeadFormState } from './useLeadFormState-9016d812.js';
25
25
  import { u as usePayoutStatus } from './usePayoutStatus-fed17fc9.js';
26
26
 
27
27
  const BigStat = class {
@@ -1289,6 +1289,81 @@ function useInputFieldDemo(props) {
1289
1289
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1290
1290
  }
1291
1291
 
1292
+ function useLeadDropdownField() {
1293
+ const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
1294
+ return {
1295
+ states: {
1296
+ leadFormState,
1297
+ },
1298
+ };
1299
+ }
1300
+
1301
+ const LeadDropdownField = class {
1302
+ constructor(hostRef) {
1303
+ registerInstance(this, hostRef);
1304
+ this.ignored = true;
1305
+ /**
1306
+ * @uiName Dropdown label
1307
+ */
1308
+ this.dropdownLabel = "Select an option";
1309
+ /**
1310
+ * The message to be displayed when a required field is not filled.
1311
+ *
1312
+ * @uiName Required field message
1313
+ * @uiWidget textArea
1314
+ */
1315
+ this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
1316
+ /**
1317
+ * @uiName Optional label
1318
+ */
1319
+ this.optionalLabel = "(optional)";
1320
+ /**
1321
+ * @uiName Optional
1322
+ * @default
1323
+ */
1324
+ this.dropdownOptional = false;
1325
+ /**
1326
+ * @uiName Multiple selection
1327
+ * @default
1328
+ */
1329
+ this.multiple = false;
1330
+ h(this);
1331
+ }
1332
+ disconnectedCallback() { }
1333
+ render() {
1334
+ const missingProps = getMissingProps([
1335
+ {
1336
+ attribute: "dropdown-name",
1337
+ value: this.dropdownName,
1338
+ },
1339
+ ]);
1340
+ if (!isDemo() && missingProps) {
1341
+ 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)));
1342
+ }
1343
+ const content = {
1344
+ ...getProps(this),
1345
+ selectOptions: h$1("slot", null),
1346
+ };
1347
+ const { states } = isDemo()
1348
+ ? useLeadDropdownFieldDemo(this)
1349
+ : useLeadDropdownField();
1350
+ return (h$1(LeadDropdownFieldView, { states: states, content: content }));
1351
+ }
1352
+ };
1353
+ function useLeadDropdownFieldDemo(props) {
1354
+ return cjs({
1355
+ states: {
1356
+ leadFormState: {},
1357
+ },
1358
+ content: {
1359
+ dropdownName: props.dropdownName,
1360
+ dropdownLabel: props.dropdownLabel,
1361
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
1362
+ dropdownOptional: props.dropdownOptional,
1363
+ },
1364
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
1365
+ }
1366
+
1292
1367
  const SUBMIT_LEAD = dist.gql `
1293
1368
  mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1294
1369
  submitForm(formSubmissionInput: $formSubmissionInput) {
@@ -1296,10 +1371,23 @@ const SUBMIT_LEAD = dist.gql `
1296
1371
  }
1297
1372
  }
1298
1373
  `;
1374
+ const GET_USER_DETAILS = dist.gql `
1375
+ query getUser($programId: ID) {
1376
+ viewer {
1377
+ ... on User {
1378
+ referralCode(programId: $programId)
1379
+ }
1380
+ }
1381
+ }
1382
+ `;
1299
1383
  function useLeadForm(props) {
1300
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1384
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1301
1385
  const formRef = useRef(null);
1302
1386
  const { leadFormState, setLeadFormState } = useLeadFormState({});
1387
+ const programId = H();
1388
+ const user = J();
1389
+ const { data: userDetails } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
1390
+ console.log({ userDetails });
1303
1391
  const [submitLead, { loading, errors, data }] = $e(SUBMIT_LEAD);
1304
1392
  const [success, setSuccess] = useState(false);
1305
1393
  useEffect(() => {
@@ -1312,7 +1400,7 @@ function useLeadForm(props) {
1312
1400
  };
1313
1401
  }, [formRef.current]);
1314
1402
  const submit = async (event) => {
1315
- var _a, _b;
1403
+ var _a;
1316
1404
  let formControls = event.target.getFormControls();
1317
1405
  let formData = {};
1318
1406
  let validationErrors = {};
@@ -1359,8 +1447,7 @@ function useLeadForm(props) {
1359
1447
  error: "",
1360
1448
  validationErrors: {},
1361
1449
  });
1362
- console.log({ success: result.data.submitForm.success });
1363
- if ((_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.submitForm) === null || _b === void 0 ? void 0 : _b.success) {
1450
+ if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
1364
1451
  setSuccess(true);
1365
1452
  }
1366
1453
  }
@@ -1380,6 +1467,18 @@ function useLeadForm(props) {
1380
1467
  const asYouType = new AsYouType("US");
1381
1468
  e.target.value = asYouType.input(e.target.value);
1382
1469
  }, []);
1470
+ function resetForm() {
1471
+ var _a, _b;
1472
+ setLeadFormState({
1473
+ loading: false,
1474
+ error: "",
1475
+ validationErrors: {},
1476
+ });
1477
+ (_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
1478
+ c.value = "";
1479
+ });
1480
+ setSuccess(false);
1481
+ }
1383
1482
  let errorMessage = "";
1384
1483
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1385
1484
  errorMessage = props.networkErrorMessage;
@@ -1391,17 +1490,19 @@ function useLeadForm(props) {
1391
1490
  errorMessage =
1392
1491
  ((_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);
1393
1492
  }
1493
+ console.log({ errors, errorMessage });
1394
1494
  return {
1395
1495
  states: {
1396
1496
  loading,
1397
1497
  error: errorMessage,
1398
1498
  success,
1399
1499
  leadFormState,
1400
- referralCode: "ABC123",
1500
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1401
1501
  },
1402
1502
  callbacks: {
1403
1503
  submit,
1404
1504
  inputFunction,
1505
+ resetForm,
1405
1506
  },
1406
1507
  refs: {
1407
1508
  formRef,
@@ -1420,11 +1521,11 @@ const LeadForm = class {
1420
1521
  /**
1421
1522
  * @uiName First Name field label
1422
1523
  */
1423
- this.firstNameLabel = "First Name";
1524
+ this.firstNameLabel = "First name";
1424
1525
  /**
1425
1526
  * @uiName Last Name field label
1426
1527
  */
1427
- this.lastNameLabel = "Last Name";
1528
+ this.lastNameLabel = "Last name";
1428
1529
  /**
1429
1530
  * @uiName Submit button text
1430
1531
  */
@@ -1437,43 +1538,52 @@ const LeadForm = class {
1437
1538
  * @uiName Header text
1438
1539
  */
1439
1540
  this.pageLabel = "Refer your friend";
1541
+ /**
1542
+ * Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
1543
+ * @uiName Form key
1544
+ */
1440
1545
  this.formKey = "lead-form";
1441
1546
  /**
1442
- * Optional support link for error messages.
1547
+ * Optional support link text for error messages.
1548
+ * @uiName Support link text
1443
1549
  */
1444
- this.supportLink = "Support";
1550
+ this.supportLinkText = "Support";
1445
1551
  /**
1446
- * Header text shown on successful submission.
1552
+ * Header text shown on successful lead submission.
1553
+ * @uiName Submit success header
1447
1554
  */
1448
- this.submitSuccessHeader = "Referral submitted";
1555
+ this.submitSuccessHeader = "Lead submitted";
1449
1556
  /**
1450
- * Description text shown on successful submission.
1557
+ * Description text shown on successful lead submission.
1558
+ * @uiName Submit success description
1451
1559
  */
1452
1560
  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.";
1453
1561
  /**
1454
- * Header text shown when an error occurs.
1562
+ * Header text shown if an error occurs.
1563
+ * @uiName Submit error header
1455
1564
  */
1456
1565
  this.submitErrorHeader = "An error occurred while submitting";
1457
1566
  /**
1458
- * Description text shown when an error occurs.
1567
+ * Description text shown if an error occurs.
1568
+ * @uiName Submit error description
1459
1569
  */
1460
1570
  this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1461
1571
  /**
1462
- * The message to be displayed when a required field is not filled.
1572
+ * The message to be displayed if a required field is not filled.
1463
1573
  *
1464
1574
  * @uiName Required field message
1465
1575
  * @uiWidget textArea
1466
1576
  */
1467
1577
  this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1468
1578
  /**
1469
- * The message to be displayed when a the form submission fails unexpectedly.
1579
+ * The message to be displayed if a the form submission fails unexpectedly.
1470
1580
  *
1471
1581
  * @uiName Network error message
1472
1582
  * @uiWidget textArea
1473
1583
  */
1474
1584
  this.networkErrorMessage = "Network request failed.";
1475
1585
  /**
1476
- * The message to be displayed when the email used is invalid or blocked.
1586
+ * The message to be displayed if the email used is invalid.
1477
1587
  *
1478
1588
  * @uiName Invalid email message
1479
1589
  * @uiWidget textArea
@@ -1492,13 +1602,15 @@ const LeadForm = class {
1492
1602
  submitLabel: this.submitLabel,
1493
1603
  resubmitFormLabel: this.resubmitFormLabel,
1494
1604
  pageLabel: this.pageLabel,
1495
- supportLink: this.supportLink,
1605
+ supportLinkText: this.supportLinkText,
1496
1606
  submitSuccessHeader: this.submitSuccessHeader,
1497
1607
  submitSuccessDescription: this.submitSuccessDescription,
1498
1608
  submitErrorHeader: this.submitErrorHeader,
1499
1609
  submitErrorDescription: this.submitErrorDescription,
1500
1610
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1501
1611
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1612
+ firstNameLabel: this.firstNameLabel,
1613
+ lastNameLabel: this.lastNameLabel,
1502
1614
  };
1503
1615
  return (h$1(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1504
1616
  }
@@ -1515,6 +1627,7 @@ function useRegisterDemo(props) {
1515
1627
  console.log("submit");
1516
1628
  },
1517
1629
  inputFunction: () => { },
1630
+ resetForm: () => { },
1518
1631
  },
1519
1632
  refs: {
1520
1633
  formRef: {},
@@ -3568,7 +3681,7 @@ const ReferralCard = class {
3568
3681
  }
3569
3682
  };
3570
3683
 
3571
- const GET_USER_DETAILS = dist.gql `
3684
+ const GET_USER_DETAILS$1 = dist.gql `
3572
3685
  query getUser($programId: ID) {
3573
3686
  viewer {
3574
3687
  ... on User {
@@ -3581,7 +3694,7 @@ function useReferralIframe(props) {
3581
3694
  var _a;
3582
3695
  const programId = H();
3583
3696
  const user = J();
3584
- const { data } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3697
+ const { data } = wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3585
3698
  return {
3586
3699
  states: {
3587
3700
  content: props,
@@ -5366,4 +5479,4 @@ function useUserNameDemo(props) {
5366
5479
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
5367
5480
  }
5368
5481
 
5369
- export { BigStat as sqm_big_stat, BrandComponent as sqm_brand, CardFeed as sqm_card_feed, CheckboxField as sqm_checkbox_field, CouponCode as sqm_coupon_code, DividedLayout as sqm_divided_layout, DropdownField as sqm_dropdown_field, EditProfile as sqm_edit_profile, Hero as sqm_hero, HeroImage as sqm_hero_image, SqmHookStoryContainer as sqm_hook_story_container, Image as sqm_image, InputField as sqm_input_field, LeadForm as sqm_lead_form, Leaderboard as sqm_leaderboard, LinkButton as sqm_link_button, MarketingEmailsCheckbox as sqm_marketing_emails_checkbox, NameFields as sqm_name_fields, NavigationMenu as sqm_navigation_menu, PayoutButtonScroll as sqm_payout_button_scroll, PayoutStatusAlert as sqm_payout_status_alert, PortalChangeMarketing as sqm_portal_change_marketing, PortalChangePassword as sqm_portal_change_password, PortalFooter as sqm_portal_footer, PortalFrame as sqm_portal_frame, PortalLogin as sqm_portal_login, PortalRegister as sqm_portal_register, ProgramExplainer as sqm_program_explainer, ProgramExplainerStep as sqm_program_explainer_step, ProgramMenu as sqm_program_menu, ReferralCard as sqm_referral_card, SqmReferralIframe as sqm_referral_iframe, SqmRewardExchangeList as sqm_reward_exchange_list, SqmRouter as sqm_router, ShareButton as sqm_share_button, ShareCode as sqm_share_code, ShareLink as sqm_share_link, StatContainer as sqm_stat_container, TaskCard as sqm_task_card, Timeline as sqm_timeline, TimelineReward as sqm_timeline_entry, UserName as sqm_user_name };
5482
+ export { BigStat as sqm_big_stat, BrandComponent as sqm_brand, CardFeed as sqm_card_feed, CheckboxField as sqm_checkbox_field, CouponCode as sqm_coupon_code, DividedLayout as sqm_divided_layout, DropdownField as sqm_dropdown_field, EditProfile as sqm_edit_profile, Hero as sqm_hero, HeroImage as sqm_hero_image, SqmHookStoryContainer as sqm_hook_story_container, Image as sqm_image, InputField as sqm_input_field, LeadDropdownField as sqm_lead_dropdown_field, LeadForm as sqm_lead_form, Leaderboard as sqm_leaderboard, LinkButton as sqm_link_button, MarketingEmailsCheckbox as sqm_marketing_emails_checkbox, NameFields as sqm_name_fields, NavigationMenu as sqm_navigation_menu, PayoutButtonScroll as sqm_payout_button_scroll, PayoutStatusAlert as sqm_payout_status_alert, PortalChangeMarketing as sqm_portal_change_marketing, PortalChangePassword as sqm_portal_change_password, PortalFooter as sqm_portal_footer, PortalFrame as sqm_portal_frame, PortalLogin as sqm_portal_login, PortalRegister as sqm_portal_register, ProgramExplainer as sqm_program_explainer, ProgramExplainerStep as sqm_program_explainer_step, ProgramMenu as sqm_program_menu, ReferralCard as sqm_referral_card, SqmReferralIframe as sqm_referral_iframe, SqmRewardExchangeList as sqm_reward_exchange_list, SqmRouter as sqm_router, ShareButton as sqm_share_button, ShareCode as sqm_share_code, ShareLink as sqm_share_link, StatContainer as sqm_stat_container, TaskCard as sqm_task_card, Timeline as sqm_timeline, TimelineReward as sqm_timeline_entry, UserName as sqm_user_name };
@@ -6,7 +6,7 @@ import { E as ErrorStyles } from './mixins-83f90fa1.js';
6
6
  const style = {
7
7
  ErrorStyle: ErrorStyles,
8
8
  FieldContainer: {
9
- "margin-bottom": "var(--sl-spacing-large)",
9
+ "margin-bottom": "var(--sl-spacing-medium)",
10
10
  },
11
11
  };
12
12
  const vanillaStyle = `
@@ -23,24 +23,24 @@ function LeadInputFieldView(props) {
23
23
  var _a, _b, _c, _d, _e, _f;
24
24
  const { states, content } = props;
25
25
  const getRequiredFieldErrorMessage = ({ fieldLabel, }) => intl.formatMessage({
26
- id: "requiredFieldErrorMessage",
26
+ id: `requiredFieldErrorMessage-${fieldLabel}`,
27
27
  defaultMessage: content.requiredFieldErrorMessage,
28
28
  }, {
29
29
  fieldLabel,
30
30
  });
31
- return (h("div", { part: "sqm-base" },
31
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
32
32
  h("style", { type: "text/css" },
33
33
  vanillaStyle,
34
34
  styleString),
35
- h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
36
- if (!value) {
35
+ h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: `${content.fieldLabel}${content.fieldOptional ? ` ${content.optionalLabel}` : ""}` }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
36
+ if (!value && !content.fieldOptional) {
37
37
  return getRequiredFieldErrorMessage({
38
38
  fieldLabel: content.fieldLabel,
39
39
  });
40
40
  }
41
- } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.firstName) ? {
41
+ } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.fieldName]) ? {
42
42
  class: sheet.classes.ErrorStyle,
43
- helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.firstName) ||
43
+ helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.fieldName]) ||
44
44
  content.requiredFieldErrorMessage,
45
45
  }
46
46
  : [])))));
@@ -6,8 +6,8 @@ import { c as cjs } from './cjs-bdfb4486.js';
6
6
  import { g as getProps, a as getMissingProps } from './utils-334c1e34.js';
7
7
  import './JSS-67b5cff8.js';
8
8
  import './mixins-83f90fa1.js';
9
+ import { L as LeadInputFieldView } from './sqm-lead-input-field-view-4ede5d7f.js';
9
10
  import { L as LEAD_FORM_STATE_CONTEXT, R as RequiredPropsError } from './useLeadFormState-9016d812.js';
10
- import { L as LeadInputFieldView } from './sqm-lead-input-field-view-f1dd4b77.js';
11
11
 
12
12
  function useLeadInputField() {
13
13
  const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
@@ -22,6 +22,10 @@ const LeadInputField = class {
22
22
  constructor(hostRef) {
23
23
  registerInstance(this, hostRef);
24
24
  this.ignored = true;
25
+ /**
26
+ * @uiName Optional label
27
+ */
28
+ this.optionalLabel = "(optional)";
25
29
  /**
26
30
  * @uiName Input type
27
31
  * @uiType string
@@ -35,7 +39,7 @@ const LeadInputField = class {
35
39
  * @uiName Required field message
36
40
  * @uiWidget textArea
37
41
  */
38
- this.requiredFieldErrorMessage = "Please enter a {fieldName}";
42
+ this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
39
43
  /**
40
44
  * @uiName Optional
41
45
  * @default
@@ -68,6 +72,12 @@ function useLeadInputFieldDemo(props) {
68
72
  states: {
69
73
  leadForState: {},
70
74
  },
75
+ content: {
76
+ fieldName: props.fieldName,
77
+ fieldLabel: props.fieldLabel,
78
+ fieldType: props.fieldType,
79
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
80
+ },
71
81
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
72
82
  }
73
83
 
@@ -16,7 +16,6 @@ import { A as AssetCardView } from './sqm-asset-card-view-fe5db3c0.js';
16
16
  import { C as CloseButtonView } from './sqm-close-button-view-f9819751.js';
17
17
  import './index-ffa26b43.js';
18
18
  import { E as EmailRegistrationView } from './email-registration-view-a7818cf2.js';
19
- import { L as LeadDropdownFieldView } from './sqm-lead-dropdown-field-view-4c85fe20.js';
20
19
  import { L as LeaderboardRankView } from './sqm-leaderboard-rank-view-753c8d4a.js';
21
20
  import { L as LogoutCurrentUserView } from './sqm-logout-current-user-view-8ef8180f.js';
22
21
  import { N as NavigationSidebarView } from './sqm-navigation-sidebar-view-9d802b78.js';
@@ -32,10 +31,10 @@ import { P as PortalResetPasswordView } from './sqm-portal-reset-password-view-5
32
31
  import { P as PortalVerifyEmailView } from './sqm-portal-verify-email-view-b12cb894.js';
33
32
  import './ErrorView-48e2b969.js';
34
33
  import { Q as QrCodeView } from './sqm-qr-code-view-f1d0763b.js';
35
- import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as LeadFormView, Q as autoColorScaleCss, U as ShadowViewAddon } from './ShadowViewAddon-8a0d9e83.js';
34
+ import { S as ShareButtonView, L as LeaderboardView, B as BigStatView, P as PortalFrameView, E as EditProfileView, u as useShareLink, a as useShareButton, b as useDemoBigStat, c as StatContainerView, d as PortalChangePasswordView, e as PortalRegisterView, C as ChangeMarktingView, T as TaskCardView, f as ProgressBarView, g as PoweredByImg$1, h as PortalFooterView, H as HeroView, R as ReferralIframeView, N as NameFieldsView, i as CheckboxFieldView, D as DropdownFieldView, I as InputFieldView, j as RewardExchangeView, r as rewardExchangeCustomErrorMsg, k as rewardExchangeLongText, l as rewardExchangeSelected, m as chooseAmountFixed, n as chooseAmountFixedNoDescription, o as chooseAmountVariable, p as chooseAmountVariableNoDescription, q as chooseAmountVariableDisabled, s as chooseAmountVariableUnavailable, t as confirmFixed, v as confirmVariable, w as redemptionError, x as queryError, y as success, z as successVariable, A as loading, F as empty$1, G as rewardExchange, J as CardFeedView, K as CouponCodeView, M as ProgressBar$2, O as LeadFormView, Q as LeadDropdownFieldView, U as autoColorScaleCss, V as ShadowViewAddon } from './ShadowViewAddon-00515b50.js';
36
35
  import { P as PortalContainerView, a as PortalSectionView } from './sqm-portal-container-view-1683ae32.js';
37
36
  import { O as OtherRegionSlotView, I as InvoiceTableView, T as TaxForm } from './sqm-invoice-table-view-7f376a75.js';
38
- import { L as LeadInputFieldView } from './sqm-lead-input-field-view-f1dd4b77.js';
37
+ import { L as LeadInputFieldView } from './sqm-lead-input-field-view-4ede5d7f.js';
39
38
 
40
39
  /**
41
40
  * lodash (Custom Build) <https://lodash.com/>
@@ -15843,6 +15842,7 @@ const defaultProps$t = {
15843
15842
  callbacks: {
15844
15843
  submit: () => console.log("Submit!"),
15845
15844
  inputFunction: () => { },
15845
+ resetForm: () => { },
15846
15846
  },
15847
15847
  refs: {
15848
15848
  formRef: {},
@@ -15897,8 +15897,10 @@ const slottedProps$2 = {
15897
15897
  content: {
15898
15898
  ...defaultProps$t.content,
15899
15899
  formData: (h("div", null,
15900
- h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
15901
- h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
15900
+ h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
15901
+ h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
15902
+ h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
15903
+ h("sqm-lead-dropdown-field", null))),
15902
15904
  },
15903
15905
  };
15904
15906
  const Default$r = () => h(LeadFormView, Object.assign({}, defaultProps$t));
@@ -15945,6 +15947,7 @@ const defaultProps$u = {
15945
15947
  fieldName: "firstName",
15946
15948
  fieldLabel: "First Name",
15947
15949
  fieldType: "text",
15950
+ optionalLabel: "(Optional)",
15948
15951
  requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
15949
15952
  fieldOptional: false,
15950
15953
  },
@@ -16001,7 +16004,9 @@ const defaultProps$v = {
16001
16004
  dropdownName: "country",
16002
16005
  dropdownLabel: "Country",
16003
16006
  requiredFieldErrorMessage: "Please select a country",
16007
+ optionalLabel: "(Optional)",
16004
16008
  dropdownOptional: false,
16009
+ multiple: false,
16005
16010
  selectOptions: [
16006
16011
  h("sl-menu-item", { value: "red" }, "Canada"),
16007
16012
  h("sl-menu-item", { value: "blue" }, "United States"),
@@ -16010,6 +16015,7 @@ const defaultProps$v = {
16010
16015
  },
16011
16016
  };
16012
16017
  const Default$t = () => h(LeadDropdownFieldView, Object.assign({}, defaultProps$v));
16018
+ const Multiple = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps$v, { content: { ...defaultProps$v.content, multiple: true } })));
16013
16019
  const WithError$1 = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16014
16020
  ...defaultProps$v.states,
16015
16021
  leadFormState: {
@@ -16047,6 +16053,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
16047
16053
  __proto__: null,
16048
16054
  'default': LeadFormDropdownField_stories,
16049
16055
  Default: Default$t,
16056
+ Multiple: Multiple,
16050
16057
  WithError: WithError$1,
16051
16058
  Disabled: Disabled$3,
16052
16059
  Loading: Loading$d,