@saasquatch/mint-components 1.14.6-8 → 1.14.6

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-d1dda2b0.js → ShadowViewAddon-3c344355.js} +116 -49
  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} +119 -25
  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 +6 -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 +10 -10
  14. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +57 -5
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +55 -51
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +65 -35
  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 +28 -5
  19. package/dist/collection/components/sqm-lead-form/useLeadForm.js +16 -10
  20. package/dist/esm/{ShadowViewAddon-81771102.js → ShadowViewAddon-64194d20.js} +117 -51
  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} +119 -26
  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 +6 -2
  26. package/dist/esm/sqm-stencilbook.entry.js +12 -5
  27. package/dist/esm-es5/ShadowViewAddon-64194d20.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-cbfa7a11.entry.js → p-0a4f1306.entry.js} +21 -21
  37. package/dist/mint-components/p-0d94d81a.system.js +1 -0
  38. package/dist/mint-components/{p-460974bf.js → p-30a11ec0.js} +24 -24
  39. package/dist/mint-components/p-37996351.system.js +1 -1
  40. package/dist/mint-components/p-6ba44ca9.js +1 -0
  41. package/dist/mint-components/p-74fdf750.system.entry.js +1 -0
  42. package/dist/mint-components/p-d3e72503.entry.js +1 -0
  43. package/dist/mint-components/p-eaf1a8a6.system.entry.js +1 -0
  44. package/dist/mint-components/{p-ba585a4b.entry.js → p-f60d1ae9.entry.js} +2 -2
  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 +11 -4
  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 +19 -10
  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 -2
  53. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +1 -0
  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 -81
  62. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
  63. package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -77
  64. package/dist/esm-es5/ShadowViewAddon-81771102.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-15f1ff1d.system.js +0 -1
  70. package/dist/mint-components/p-26da31c6.js +0 -1
  71. package/dist/mint-components/p-4056c0ea.system.entry.js +0 -1
  72. package/dist/mint-components/p-4d5b02af.js +0 -1
  73. package/dist/mint-components/p-59970cb1.system.entry.js +0 -1
  74. package/dist/mint-components/p-6b093d8c.entry.js +0 -1
  75. package/dist/mint-components/p-732849d6.system.entry.js +0 -1
  76. package/dist/mint-components/p-87384d9e.system.js +0 -1
  77. package/dist/mint-components/p-ad128614.system.js +0 -1
  78. package/dist/mint-components/p-c5a55554.entry.js +0 -1
  79. package/dist/mint-components/p-de5356d9.system.entry.js +0 -1
@@ -19,13 +19,13 @@ require('./luxon-2926d85f.js');
19
19
  require('./sqm-text-span-view-0aa82125.js');
20
20
  const index$1 = require('./index-8c6255f5.js');
21
21
  const useRegistrationFormState = require('./useRegistrationFormState-7b820f0c.js');
22
- const useLeadFormState = require('./useLeadFormState-c83d2034.js');
23
22
  const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
24
23
  const usePortalLogin = require('./usePortalLogin-63d896d1.js');
25
24
  const AsYouType = require('./AsYouType-6788393a.js');
26
25
  const utilities = require('./utilities-78f5e169.js');
27
- const ShadowViewAddon = require('./ShadowViewAddon-d1dda2b0.js');
26
+ const ShadowViewAddon = require('./ShadowViewAddon-3c344355.js');
28
27
  require('./sqm-portal-container-view-4f15143a.js');
28
+ const useLeadFormState = require('./useLeadFormState-c83d2034.js');
29
29
  const usePayoutStatus = require('./usePayoutStatus-feeac99b.js');
30
30
 
31
31
  const BigStat = class {
@@ -1293,6 +1293,81 @@ function useInputFieldDemo(props) {
1293
1293
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1294
1294
  }
1295
1295
 
1296
+ function useLeadDropdownField() {
1297
+ const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
1298
+ return {
1299
+ states: {
1300
+ leadFormState,
1301
+ },
1302
+ };
1303
+ }
1304
+
1305
+ const LeadDropdownField = class {
1306
+ constructor(hostRef) {
1307
+ index.registerInstance(this, hostRef);
1308
+ this.ignored = true;
1309
+ /**
1310
+ * @uiName Dropdown label
1311
+ */
1312
+ this.dropdownLabel = "Select an option";
1313
+ /**
1314
+ * The message to be displayed when a required field is not filled.
1315
+ *
1316
+ * @uiName Required field message
1317
+ * @uiWidget textArea
1318
+ */
1319
+ this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
1320
+ /**
1321
+ * @uiName Optional label
1322
+ */
1323
+ this.optionalLabel = "(optional)";
1324
+ /**
1325
+ * @uiName Optional
1326
+ * @default
1327
+ */
1328
+ this.dropdownOptional = false;
1329
+ /**
1330
+ * @uiName Multiple selection
1331
+ * @default
1332
+ */
1333
+ this.multiple = false;
1334
+ stencilHooks_module.h$1(this);
1335
+ }
1336
+ disconnectedCallback() { }
1337
+ render() {
1338
+ const missingProps = utils.getMissingProps([
1339
+ {
1340
+ attribute: "dropdown-name",
1341
+ value: this.dropdownName,
1342
+ },
1343
+ ]);
1344
+ if (!index_module.isDemo() && missingProps) {
1345
+ return (index.h(useLeadFormState.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:" }, index.h("slot", null)));
1346
+ }
1347
+ const content = {
1348
+ ...utils.getProps(this),
1349
+ selectOptions: index.h("slot", null),
1350
+ };
1351
+ const { states } = index_module.isDemo()
1352
+ ? useLeadDropdownFieldDemo(this)
1353
+ : useLeadDropdownField();
1354
+ return (index.h(ShadowViewAddon.LeadDropdownFieldView, { states: states, content: content }));
1355
+ }
1356
+ };
1357
+ function useLeadDropdownFieldDemo(props) {
1358
+ return cjs.cjs({
1359
+ states: {
1360
+ leadFormState: {},
1361
+ },
1362
+ content: {
1363
+ dropdownName: props.dropdownName,
1364
+ dropdownLabel: props.dropdownLabel,
1365
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
1366
+ dropdownOptional: props.dropdownOptional,
1367
+ },
1368
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
1369
+ }
1370
+
1296
1371
  const SUBMIT_LEAD = index_module.dist.gql `
1297
1372
  mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1298
1373
  submitForm(formSubmissionInput: $formSubmissionInput) {
@@ -1316,7 +1391,6 @@ function useLeadForm(props) {
1316
1391
  const programId = index_module.H();
1317
1392
  const user = index_module.J();
1318
1393
  const { data: userDetails } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
1319
- console.log({ userDetails });
1320
1394
  const [submitLead, { loading, errors, data }] = index_module.$e(SUBMIT_LEAD);
1321
1395
  const [success, setSuccess] = stencilHooks_module.useState(false);
1322
1396
  stencilHooks_module.useEffect(() => {
@@ -1329,7 +1403,7 @@ function useLeadForm(props) {
1329
1403
  };
1330
1404
  }, [formRef.current]);
1331
1405
  const submit = async (event) => {
1332
- var _a, _b;
1406
+ var _a;
1333
1407
  let formControls = event.target.getFormControls();
1334
1408
  let formData = {};
1335
1409
  let validationErrors = {};
@@ -1361,17 +1435,12 @@ function useLeadForm(props) {
1361
1435
  error: "",
1362
1436
  validationErrors: {},
1363
1437
  });
1364
- formData = { ...formData };
1365
1438
  const variables = {
1366
1439
  key: props.formKey,
1367
1440
  formData,
1368
1441
  };
1369
- const result = await submitLead({ formSubmissionInput: variables });
1370
1442
  try {
1371
- console.log({
1372
- success: result.data.submitForm.success,
1373
- isError: result instanceof Error,
1374
- });
1443
+ const result = await submitLead({ formSubmissionInput: variables });
1375
1444
  if (result instanceof Error) {
1376
1445
  throw result;
1377
1446
  }
@@ -1380,7 +1449,7 @@ function useLeadForm(props) {
1380
1449
  error: "",
1381
1450
  validationErrors: {},
1382
1451
  });
1383
- 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) {
1452
+ if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
1384
1453
  setSuccess(true);
1385
1454
  }
1386
1455
  }
@@ -1400,6 +1469,18 @@ function useLeadForm(props) {
1400
1469
  const asYouType = new AsYouType.AsYouType("US");
1401
1470
  e.target.value = asYouType.input(e.target.value);
1402
1471
  }, []);
1472
+ function resetForm() {
1473
+ var _a, _b;
1474
+ setLeadFormState({
1475
+ loading: false,
1476
+ error: "",
1477
+ validationErrors: {},
1478
+ });
1479
+ (_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
1480
+ c.value = "";
1481
+ });
1482
+ setSuccess(false);
1483
+ }
1403
1484
  let errorMessage = "";
1404
1485
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1405
1486
  errorMessage = props.networkErrorMessage;
@@ -1411,7 +1492,6 @@ function useLeadForm(props) {
1411
1492
  errorMessage =
1412
1493
  ((_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);
1413
1494
  }
1414
- console.log({ errors, errorMessage });
1415
1495
  return {
1416
1496
  states: {
1417
1497
  loading,
@@ -1423,6 +1503,7 @@ function useLeadForm(props) {
1423
1503
  callbacks: {
1424
1504
  submit,
1425
1505
  inputFunction,
1506
+ resetForm,
1426
1507
  },
1427
1508
  refs: {
1428
1509
  formRef,
@@ -1441,11 +1522,11 @@ const LeadForm = class {
1441
1522
  /**
1442
1523
  * @uiName First Name field label
1443
1524
  */
1444
- this.firstNameLabel = "First Name";
1525
+ this.firstNameLabel = "First name";
1445
1526
  /**
1446
1527
  * @uiName Last Name field label
1447
1528
  */
1448
- this.lastNameLabel = "Last Name";
1529
+ this.lastNameLabel = "Last name";
1449
1530
  /**
1450
1531
  * @uiName Submit button text
1451
1532
  */
@@ -1458,43 +1539,52 @@ const LeadForm = class {
1458
1539
  * @uiName Header text
1459
1540
  */
1460
1541
  this.pageLabel = "Refer your friend";
1542
+ /**
1543
+ * Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
1544
+ * @uiName Form key
1545
+ */
1461
1546
  this.formKey = "lead-form";
1462
1547
  /**
1463
- * Optional support link for error messages.
1548
+ * Optional support link text for error messages.
1549
+ * @uiName Support link text
1464
1550
  */
1465
- this.supportLink = "Support";
1551
+ this.supportLinkText = "Support";
1466
1552
  /**
1467
- * Header text shown on successful submission.
1553
+ * Header text shown on successful lead submission.
1554
+ * @uiName Submit success header
1468
1555
  */
1469
- this.submitSuccessHeader = "Referral submitted";
1556
+ this.submitSuccessHeader = "Lead submitted";
1470
1557
  /**
1471
- * Description text shown on successful submission.
1558
+ * Description text shown on successful lead submission.
1559
+ * @uiName Submit success description
1472
1560
  */
1473
1561
  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.";
1474
1562
  /**
1475
- * Header text shown when an error occurs.
1563
+ * Header text shown if an error occurs.
1564
+ * @uiName Submit error header
1476
1565
  */
1477
1566
  this.submitErrorHeader = "An error occurred while submitting";
1478
1567
  /**
1479
- * Description text shown when an error occurs.
1568
+ * Description text shown if an error occurs.
1569
+ * @uiName Submit error description
1480
1570
  */
1481
1571
  this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1482
1572
  /**
1483
- * The message to be displayed when a required field is not filled.
1573
+ * The message to be displayed if a required field is not filled.
1484
1574
  *
1485
1575
  * @uiName Required field message
1486
1576
  * @uiWidget textArea
1487
1577
  */
1488
1578
  this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1489
1579
  /**
1490
- * The message to be displayed when a the form submission fails unexpectedly.
1580
+ * The message to be displayed if a the form submission fails unexpectedly.
1491
1581
  *
1492
1582
  * @uiName Network error message
1493
1583
  * @uiWidget textArea
1494
1584
  */
1495
1585
  this.networkErrorMessage = "Network request failed.";
1496
1586
  /**
1497
- * The message to be displayed when the email used is invalid or blocked.
1587
+ * The message to be displayed if the email used is invalid.
1498
1588
  *
1499
1589
  * @uiName Invalid email message
1500
1590
  * @uiWidget textArea
@@ -1513,13 +1603,15 @@ const LeadForm = class {
1513
1603
  submitLabel: this.submitLabel,
1514
1604
  resubmitFormLabel: this.resubmitFormLabel,
1515
1605
  pageLabel: this.pageLabel,
1516
- supportLink: this.supportLink,
1606
+ supportLinkText: this.supportLinkText,
1517
1607
  submitSuccessHeader: this.submitSuccessHeader,
1518
1608
  submitSuccessDescription: this.submitSuccessDescription,
1519
1609
  submitErrorHeader: this.submitErrorHeader,
1520
1610
  submitErrorDescription: this.submitErrorDescription,
1521
1611
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1522
1612
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1613
+ firstNameLabel: this.firstNameLabel,
1614
+ lastNameLabel: this.lastNameLabel,
1523
1615
  };
1524
1616
  return (index.h(ShadowViewAddon.LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1525
1617
  }
@@ -1536,6 +1628,7 @@ function useRegisterDemo(props) {
1536
1628
  console.log("submit");
1537
1629
  },
1538
1630
  inputFunction: () => { },
1631
+ resetForm: () => { },
1539
1632
  },
1540
1633
  refs: {
1541
1634
  formRef: {},
@@ -5400,6 +5493,7 @@ exports.sqm_hero_image = HeroImage;
5400
5493
  exports.sqm_hook_story_container = SqmHookStoryContainer;
5401
5494
  exports.sqm_image = Image;
5402
5495
  exports.sqm_input_field = InputField;
5496
+ exports.sqm_lead_dropdown_field = LeadDropdownField;
5403
5497
  exports.sqm_lead_form = LeadForm;
5404
5498
  exports.sqm_leaderboard = Leaderboard;
5405
5499
  exports.sqm_link_button = LinkButton;
@@ -8,7 +8,7 @@ const mixins = require('./mixins-f7e0377a.js');
8
8
  const style = {
9
9
  ErrorStyle: mixins.ErrorStyles,
10
10
  FieldContainer: {
11
- "margin-bottom": "var(--sl-spacing-large)",
11
+ "margin-bottom": "var(--sl-spacing-medium)",
12
12
  },
13
13
  };
14
14
  const vanillaStyle = `
@@ -25,24 +25,24 @@ function LeadInputFieldView(props) {
25
25
  var _a, _b, _c, _d, _e, _f;
26
26
  const { states, content } = props;
27
27
  const getRequiredFieldErrorMessage = ({ fieldLabel, }) => global.intl.formatMessage({
28
- id: "requiredFieldErrorMessage",
28
+ id: `requiredFieldErrorMessage-${fieldLabel}`,
29
29
  defaultMessage: content.requiredFieldErrorMessage,
30
30
  }, {
31
31
  fieldLabel,
32
32
  });
33
- return (index.h("div", { part: "sqm-base" },
33
+ return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
34
34
  index.h("style", { type: "text/css" },
35
35
  vanillaStyle,
36
36
  styleString),
37
- index.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 }) => {
38
- if (!value) {
37
+ index.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 }) => {
38
+ if (!value && !content.fieldOptional) {
39
39
  return getRequiredFieldErrorMessage({
40
40
  fieldLabel: content.fieldLabel,
41
41
  });
42
42
  }
43
- } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.firstName) ? {
43
+ } }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.fieldName]) ? {
44
44
  class: sheet.classes.ErrorStyle,
45
- helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.firstName) ||
45
+ helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.fieldName]) ||
46
46
  content.requiredFieldErrorMessage,
47
47
  }
48
48
  : [])))));
@@ -10,8 +10,8 @@ const cjs = require('./cjs-1066ec21.js');
10
10
  const utils = require('./utils-6847bc06.js');
11
11
  require('./JSS-8503a151.js');
12
12
  require('./mixins-f7e0377a.js');
13
+ const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
13
14
  const useLeadFormState = require('./useLeadFormState-c83d2034.js');
14
- const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
15
15
 
16
16
  function useLeadInputField() {
17
17
  const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
@@ -26,6 +26,10 @@ const LeadInputField = class {
26
26
  constructor(hostRef) {
27
27
  index.registerInstance(this, hostRef);
28
28
  this.ignored = true;
29
+ /**
30
+ * @uiName Optional label
31
+ */
32
+ this.optionalLabel = "(optional)";
29
33
  /**
30
34
  * @uiName Input type
31
35
  * @uiType string
@@ -39,7 +43,7 @@ const LeadInputField = class {
39
43
  * @uiName Required field message
40
44
  * @uiWidget textArea
41
45
  */
42
- this.requiredFieldErrorMessage = "Please enter a {fieldName}";
46
+ this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
43
47
  /**
44
48
  * @uiName Optional
45
49
  * @default
@@ -20,7 +20,6 @@ const sqmAssetCardView = require('./sqm-asset-card-view-21ddf04f.js');
20
20
  const sqmCloseButtonView = require('./sqm-close-button-view-ea3fa23b.js');
21
21
  require('./index-8c6255f5.js');
22
22
  const emailRegistrationView = require('./email-registration-view-55b378dc.js');
23
- const sqmLeadDropdownFieldView = require('./sqm-lead-dropdown-field-view-03a3e03f.js');
24
23
  const sqmLeaderboardRankView = require('./sqm-leaderboard-rank-view-d39a55d8.js');
25
24
  const sqmLogoutCurrentUserView = require('./sqm-logout-current-user-view-11d57c12.js');
26
25
  const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-17111896.js');
@@ -36,10 +35,10 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe6
36
35
  const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
37
36
  require('./ErrorView-b2fcf954.js');
38
37
  const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
39
- const ShadowViewAddon = require('./ShadowViewAddon-d1dda2b0.js');
38
+ const ShadowViewAddon = require('./ShadowViewAddon-3c344355.js');
40
39
  const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
41
40
  const sqmInvoiceTableView = require('./sqm-invoice-table-view-0f7fa309.js');
42
- const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
41
+ const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
43
42
 
44
43
  /**
45
44
  * lodash (Custom Build) <https://lodash.com/>
@@ -15847,6 +15846,7 @@ const defaultProps$t = {
15847
15846
  callbacks: {
15848
15847
  submit: () => console.log("Submit!"),
15849
15848
  inputFunction: () => { },
15849
+ resetForm: () => { },
15850
15850
  },
15851
15851
  refs: {
15852
15852
  formRef: {},
@@ -15901,8 +15901,10 @@ const slottedProps$2 = {
15901
15901
  content: {
15902
15902
  ...defaultProps$t.content,
15903
15903
  formData: (index.h("div", null,
15904
- index.h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
15905
- index.h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
15904
+ index.h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
15905
+ index.h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
15906
+ index.h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
15907
+ index.h("sqm-lead-dropdown-field", null))),
15906
15908
  },
15907
15909
  };
15908
15910
  const Default$r = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, defaultProps$t));
@@ -15949,6 +15951,7 @@ const defaultProps$u = {
15949
15951
  fieldName: "firstName",
15950
15952
  fieldLabel: "First Name",
15951
15953
  fieldType: "text",
15954
+ optionalLabel: "(Optional)",
15952
15955
  requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
15953
15956
  fieldOptional: false,
15954
15957
  },
@@ -16005,7 +16008,9 @@ const defaultProps$v = {
16005
16008
  dropdownName: "country",
16006
16009
  dropdownLabel: "Country",
16007
16010
  requiredFieldErrorMessage: "Please select a country",
16011
+ optionalLabel: "(Optional)",
16008
16012
  dropdownOptional: false,
16013
+ multiple: false,
16009
16014
  selectOptions: [
16010
16015
  index.h("sl-menu-item", { value: "red" }, "Canada"),
16011
16016
  index.h("sl-menu-item", { value: "blue" }, "United States"),
@@ -16013,8 +16018,9 @@ const defaultProps$v = {
16013
16018
  ],
16014
16019
  },
16015
16020
  };
16016
- const Default$t = () => index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v));
16017
- const WithError$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16021
+ const Default$t = () => index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v));
16022
+ const Multiple = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { content: { ...defaultProps$v.content, multiple: true } })));
16023
+ const WithError$1 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16018
16024
  ...defaultProps$v.states,
16019
16025
  leadFormState: {
16020
16026
  ...defaultProps$v.states.leadFormState,
@@ -16023,21 +16029,21 @@ const WithError$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldVie
16023
16029
  },
16024
16030
  },
16025
16031
  } })));
16026
- const Disabled$3 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16032
+ const Disabled$3 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16027
16033
  ...defaultProps$v.states,
16028
16034
  leadFormState: {
16029
16035
  ...defaultProps$v.states.leadFormState,
16030
16036
  disabled: true,
16031
16037
  },
16032
16038
  } })));
16033
- const Loading$d = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16039
+ const Loading$d = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16034
16040
  ...defaultProps$v.states,
16035
16041
  leadFormState: {
16036
16042
  ...defaultProps$v.states.leadFormState,
16037
16043
  loading: true,
16038
16044
  },
16039
16045
  } })));
16040
- const WithInitialValue$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16046
+ const WithInitialValue$1 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
16041
16047
  ...defaultProps$v.states,
16042
16048
  leadFormState: {
16043
16049
  ...defaultProps$v.states.leadFormState,
@@ -16051,6 +16057,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
16051
16057
  __proto__: null,
16052
16058
  'default': LeadFormDropdownField_stories,
16053
16059
  Default: Default$t,
16060
+ Multiple: Multiple,
16054
16061
  WithError: WithError$1,
16055
16062
  Disabled: Disabled$3,
16056
16063
  Loading: Loading$d,
@@ -43,7 +43,6 @@
43
43
  "./components/sqm-invoice-table/columns/sqm-invoice-table-date-column.js",
44
44
  "./components/sqm-invoice-table/columns/sqm-invoice-table-download-column.js",
45
45
  "./components/sqm-lead-form/sqm-lead-dropdown-field.js",
46
- "./components/sqm-referral-iframe/sqm-referral-iframe.js",
47
46
  "./components/sqm-lead-form/sqm-lead-form.js",
48
47
  "./components/sqm-lead-form/sqm-lead-input-field.js",
49
48
  "./components/sqm-leaderboard/sqm-leaderboard.js",
@@ -79,6 +78,7 @@
79
78
  "./components/sqm-qr-code/sqm-qr-code.js",
80
79
  "./components/sqm-referral-card/sqm-referral-card.js",
81
80
  "./components/sqm-referral-code/sqm-referral-code.js",
81
+ "./components/sqm-referral-iframe/sqm-referral-iframe.js",
82
82
  "./components/sqm-referral-table/cells/sqm-referral-table-cell.js",
83
83
  "./components/sqm-referral-table/cells/sqm-referral-table-date-cell.js",
84
84
  "./components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js",
@@ -15,7 +15,7 @@ const style = {
15
15
  fontSize: "var(--sl-input-help-text-font-size-medium)",
16
16
  },
17
17
  FieldContainer: {
18
- "margin-bottom": "var(--sl-spacing-large)",
18
+ "margin-bottom": "var(--sl-spacing-medium)",
19
19
  },
20
20
  };
21
21
  const vanillaStyle = `
@@ -14,6 +14,7 @@ const defaultProps = {
14
14
  callbacks: {
15
15
  submit: () => console.log("Submit!"),
16
16
  inputFunction: () => { },
17
+ resetForm: () => { },
17
18
  },
18
19
  refs: {
19
20
  formRef: {},
@@ -68,8 +69,10 @@ const slottedProps = {
68
69
  content: {
69
70
  ...defaultProps.content,
70
71
  formData: (h("div", null,
71
- h("sl-input", { style: { marginBottom: "var(--sl-spacing-x-large)" }, exportparts: "label: input-label, base: input-base", label: "Slotted Input", required: true }),
72
- h("sl-input", { exportparts: "label: input-label, base: input-base", label: "Slotted Input 2", required: true }))),
72
+ h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
73
+ h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
74
+ h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
75
+ h("sqm-lead-dropdown-field", null))),
73
76
  },
74
77
  };
75
78
  export const Default = () => h(LeadFormView, Object.assign({}, defaultProps));
@@ -16,7 +16,9 @@ const defaultProps = {
16
16
  dropdownName: "country",
17
17
  dropdownLabel: "Country",
18
18
  requiredFieldErrorMessage: "Please select a country",
19
+ optionalLabel: "(Optional)",
19
20
  dropdownOptional: false,
21
+ multiple: false,
20
22
  selectOptions: [
21
23
  h("sl-menu-item", { value: "red" }, "Canada"),
22
24
  h("sl-menu-item", { value: "blue" }, "United States"),
@@ -25,6 +27,7 @@ const defaultProps = {
25
27
  },
26
28
  };
27
29
  export const Default = () => h(LeadDropdownFieldView, Object.assign({}, defaultProps));
30
+ export const Multiple = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { content: { ...defaultProps.content, multiple: true } })));
28
31
  export const WithError = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
29
32
  ...defaultProps.states,
30
33
  leadFormState: {
@@ -16,6 +16,7 @@ const defaultProps = {
16
16
  fieldName: "firstName",
17
17
  fieldLabel: "First Name",
18
18
  fieldType: "text",
19
+ optionalLabel: "(Optional)",
19
20
  requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
20
21
  fieldOptional: false,
21
22
  },
@@ -28,16 +28,19 @@ sl-select::part(label){
28
28
  font-size: var(--sl-input-label-font-size-small);
29
29
  font-weight: var(--sl-font-weight-semibold);
30
30
  }
31
+ sl-select::part(menu){
32
+ max-height: 300px;
33
+ }
31
34
  `;
32
35
  jss.setup(preset());
33
36
  const sheet = jss.createStyleSheet(style);
34
37
  const styleString = sheet.toString();
35
38
  export function LeadDropdownFieldView(props) {
36
- var _a, _b, _c, _d, _e, _f, _g;
39
+ var _a, _b, _c, _d, _e;
37
40
  const { states, content } = props;
38
41
  const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
39
42
  const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => intl.formatMessage({
40
- id: "requiredFieldErrorMessage",
43
+ id: `requiredFieldErrorMessage-${dropdownLabel}`,
41
44
  defaultMessage: content.requiredFieldErrorMessage,
42
45
  }, {
43
46
  dropdownLabel,
@@ -46,20 +49,17 @@ export function LeadDropdownFieldView(props) {
46
49
  h("style", { type: "text/css" },
47
50
  vanillaStyle,
48
51
  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) {
52
+ h("sl-select", Object.assign({ style: { maxHeight: "100px" }, exportparts: "label: input-label, base: input-base", label: `${content.dropdownLabel}${content.dropdownOptional ? ` ${content.optionalLabel}` : ""}`, name: `/${content.dropdownName}`, multiple: content.multiple }, (!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 }) => {
53
+ if (!value && !content.dropdownOptional) {
51
54
  return getRequiredFieldErrorMessage({
52
55
  dropdownLabel: content.dropdownLabel,
53
56
  });
54
57
  }
55
- } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e.firstName) ? {
58
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.dropdownName]) ? {
56
59
  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
  }
60
61
  : [])), 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,
62
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
63
+ dropdownLabel: content.dropdownLabel,
64
64
  })))));
65
65
  }