@saasquatch/mint-components 1.14.6-9 → 1.14.7-0

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 (96) 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} +117 -24
  5. package/dist/cjs/sqm-lead-checkbox-field.cjs.entry.js +155 -0
  6. package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
  7. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +6 -2
  8. package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
  9. package/dist/collection/collection-manifest.json +2 -1
  10. package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
  11. package/dist/collection/components/sqm-lead-form/LeadCheckboxField.stories.js +103 -0
  12. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
  13. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
  14. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field-view.js +62 -0
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-checkbox-field.js +238 -0
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +10 -10
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +57 -5
  19. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +55 -51
  20. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +65 -35
  21. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
  22. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +28 -5
  23. package/dist/collection/components/sqm-lead-form/useCheckboxField.js +23 -0
  24. package/dist/collection/components/sqm-lead-form/useLeadForm.js +15 -10
  25. package/dist/esm/{ShadowViewAddon-81771102.js → ShadowViewAddon-64194d20.js} +117 -51
  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 → sqm-big-stat_43.entry.js} +118 -26
  29. package/dist/esm/sqm-lead-checkbox-field.entry.js +151 -0
  30. package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
  31. package/dist/esm/sqm-lead-input-field.entry.js +6 -2
  32. package/dist/esm/sqm-stencilbook.entry.js +12 -5
  33. package/dist/esm-es5/ShadowViewAddon-64194d20.js +1 -0
  34. package/dist/esm-es5/loader.js +1 -1
  35. package/dist/esm-es5/mint-components.js +1 -1
  36. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
  37. package/dist/esm-es5/sqm-lead-checkbox-field.entry.js +1 -0
  38. package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
  39. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
  40. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  41. package/dist/mint-components/mint-components.esm.js +1 -1
  42. package/dist/mint-components/p-01dd541f.system.js +1 -0
  43. package/dist/mint-components/p-0d94d81a.system.js +1 -0
  44. package/dist/mint-components/p-10a8ecae.system.entry.js +1 -0
  45. package/dist/mint-components/p-12bba567.entry.js +1 -0
  46. package/dist/mint-components/p-214c7807.entry.js +1 -0
  47. package/dist/mint-components/{p-460974bf.js → p-30a11ec0.js} +24 -24
  48. package/dist/mint-components/p-37996351.system.js +1 -1
  49. package/dist/mint-components/p-589962db.system.entry.js +1 -0
  50. package/dist/mint-components/p-6ba44ca9.js +1 -0
  51. package/dist/mint-components/{p-b2ff8561.entry.js → p-851eaf57.entry.js} +21 -21
  52. package/dist/mint-components/p-8c0b7881.system.entry.js +1 -0
  53. package/dist/mint-components/p-eaf1a8a6.system.entry.js +1 -0
  54. package/dist/mint-components/{p-ba585a4b.entry.js → p-f60d1ae9.entry.js} +2 -2
  55. package/dist/types/components/sqm-lead-form/LeadCheckboxField.stories.d.ts +55 -0
  56. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
  57. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field-view.d.ts +19 -0
  58. package/dist/types/components/sqm-lead-form/sqm-lead-checkbox-field.d.ts +46 -0
  59. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
  60. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +11 -4
  61. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
  62. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +19 -10
  63. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
  64. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -2
  65. package/dist/types/components/sqm-lead-form/useCheckboxField.d.ts +11 -0
  66. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +1 -0
  67. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  68. package/dist/types/components.d.ts +143 -19
  69. package/docs/docs.docx +0 -0
  70. package/docs/raisins.json +1 -1
  71. package/grapesjs/grapesjs.js +1 -1
  72. package/package.json +1 -1
  73. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
  74. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -81
  75. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
  76. package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -77
  77. package/dist/esm-es5/ShadowViewAddon-81771102.js +0 -1
  78. package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
  79. package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
  80. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
  81. package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
  82. package/dist/mint-components/p-15f1ff1d.system.js +0 -1
  83. package/dist/mint-components/p-26da31c6.js +0 -1
  84. package/dist/mint-components/p-4056c0ea.system.entry.js +0 -1
  85. package/dist/mint-components/p-4d5b02af.js +0 -1
  86. package/dist/mint-components/p-59970cb1.system.entry.js +0 -1
  87. package/dist/mint-components/p-6b093d8c.entry.js +0 -1
  88. package/dist/mint-components/p-7094012d.system.entry.js +0 -1
  89. package/dist/mint-components/p-87384d9e.system.js +0 -1
  90. package/dist/mint-components/p-ad128614.system.js +0 -1
  91. package/dist/mint-components/p-c5a55554.entry.js +0 -1
  92. package/dist/mint-components/p-de5356d9.system.entry.js +0 -1
  93. package/dist/types/global/android.d.ts +0 -7
  94. package/dist/types/global/demo.d.ts +0 -2
  95. package/dist/types/stories/features.d.ts +0 -4
  96. package/dist/types/stories/templates.d.ts +0 -4
@@ -24,7 +24,7 @@ const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
24
24
  const usePortalLogin = require('./usePortalLogin-63d896d1.js');
25
25
  const AsYouType = require('./AsYouType-6788393a.js');
26
26
  const utilities = require('./utilities-78f5e169.js');
27
- const ShadowViewAddon = require('./ShadowViewAddon-d1dda2b0.js');
27
+ const ShadowViewAddon = require('./ShadowViewAddon-3c344355.js');
28
28
  require('./sqm-portal-container-view-4f15143a.js');
29
29
  const usePayoutStatus = require('./usePayoutStatus-feeac99b.js');
30
30
 
@@ -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, _c, _d;
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
1442
  try {
1370
1443
  const result = await submitLead({ formSubmissionInput: variables });
1371
- console.log({
1372
- success: (_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,
1373
- isError: result instanceof Error,
1374
- });
1375
1444
  if (result instanceof Error) {
1376
1445
  throw result;
1377
1446
  }
@@ -1380,12 +1449,11 @@ function useLeadForm(props) {
1380
1449
  error: "",
1381
1450
  validationErrors: {},
1382
1451
  });
1383
- if ((_d = (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.submitForm) === null || _d === void 0 ? void 0 : _d.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
  }
1387
1456
  catch (error) {
1388
- console.log({ error });
1389
1457
  setLeadFormState({
1390
1458
  loading: false,
1391
1459
  error: props.networkErrorMessage,
@@ -1401,6 +1469,18 @@ function useLeadForm(props) {
1401
1469
  const asYouType = new AsYouType.AsYouType("US");
1402
1470
  e.target.value = asYouType.input(e.target.value);
1403
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
+ }
1404
1484
  let errorMessage = "";
1405
1485
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1406
1486
  errorMessage = props.networkErrorMessage;
@@ -1412,7 +1492,6 @@ function useLeadForm(props) {
1412
1492
  errorMessage =
1413
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);
1414
1494
  }
1415
- console.log({ errors, errorMessage });
1416
1495
  return {
1417
1496
  states: {
1418
1497
  loading,
@@ -1424,6 +1503,7 @@ function useLeadForm(props) {
1424
1503
  callbacks: {
1425
1504
  submit,
1426
1505
  inputFunction,
1506
+ resetForm,
1427
1507
  },
1428
1508
  refs: {
1429
1509
  formRef,
@@ -1442,11 +1522,11 @@ const LeadForm = class {
1442
1522
  /**
1443
1523
  * @uiName First Name field label
1444
1524
  */
1445
- this.firstNameLabel = "First Name";
1525
+ this.firstNameLabel = "First name";
1446
1526
  /**
1447
1527
  * @uiName Last Name field label
1448
1528
  */
1449
- this.lastNameLabel = "Last Name";
1529
+ this.lastNameLabel = "Last name";
1450
1530
  /**
1451
1531
  * @uiName Submit button text
1452
1532
  */
@@ -1459,43 +1539,52 @@ const LeadForm = class {
1459
1539
  * @uiName Header text
1460
1540
  */
1461
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
+ */
1462
1546
  this.formKey = "lead-form";
1463
1547
  /**
1464
- * Optional support link for error messages.
1548
+ * Optional support link text for error messages.
1549
+ * @uiName Support link text
1465
1550
  */
1466
- this.supportLink = "Support";
1551
+ this.supportLinkText = "Support";
1467
1552
  /**
1468
- * Header text shown on successful submission.
1553
+ * Header text shown on successful lead submission.
1554
+ * @uiName Submit success header
1469
1555
  */
1470
- this.submitSuccessHeader = "Referral submitted";
1556
+ this.submitSuccessHeader = "Lead submitted";
1471
1557
  /**
1472
- * Description text shown on successful submission.
1558
+ * Description text shown on successful lead submission.
1559
+ * @uiName Submit success description
1473
1560
  */
1474
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.";
1475
1562
  /**
1476
- * Header text shown when an error occurs.
1563
+ * Header text shown if an error occurs.
1564
+ * @uiName Submit error header
1477
1565
  */
1478
1566
  this.submitErrorHeader = "An error occurred while submitting";
1479
1567
  /**
1480
- * Description text shown when an error occurs.
1568
+ * Description text shown if an error occurs.
1569
+ * @uiName Submit error description
1481
1570
  */
1482
1571
  this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1483
1572
  /**
1484
- * 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.
1485
1574
  *
1486
1575
  * @uiName Required field message
1487
1576
  * @uiWidget textArea
1488
1577
  */
1489
1578
  this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1490
1579
  /**
1491
- * 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.
1492
1581
  *
1493
1582
  * @uiName Network error message
1494
1583
  * @uiWidget textArea
1495
1584
  */
1496
1585
  this.networkErrorMessage = "Network request failed.";
1497
1586
  /**
1498
- * 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.
1499
1588
  *
1500
1589
  * @uiName Invalid email message
1501
1590
  * @uiWidget textArea
@@ -1514,13 +1603,15 @@ const LeadForm = class {
1514
1603
  submitLabel: this.submitLabel,
1515
1604
  resubmitFormLabel: this.resubmitFormLabel,
1516
1605
  pageLabel: this.pageLabel,
1517
- supportLink: this.supportLink,
1606
+ supportLinkText: this.supportLinkText,
1518
1607
  submitSuccessHeader: this.submitSuccessHeader,
1519
1608
  submitSuccessDescription: this.submitSuccessDescription,
1520
1609
  submitErrorHeader: this.submitErrorHeader,
1521
1610
  submitErrorDescription: this.submitErrorDescription,
1522
1611
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1523
1612
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1613
+ firstNameLabel: this.firstNameLabel,
1614
+ lastNameLabel: this.lastNameLabel,
1524
1615
  };
1525
1616
  return (index.h(ShadowViewAddon.LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1526
1617
  }
@@ -1537,6 +1628,7 @@ function useRegisterDemo(props) {
1537
1628
  console.log("submit");
1538
1629
  },
1539
1630
  inputFunction: () => { },
1631
+ resetForm: () => { },
1540
1632
  },
1541
1633
  refs: {
1542
1634
  formRef: {},
@@ -5401,6 +5493,7 @@ exports.sqm_hero_image = HeroImage;
5401
5493
  exports.sqm_hook_story_container = SqmHookStoryContainer;
5402
5494
  exports.sqm_image = Image;
5403
5495
  exports.sqm_input_field = InputField;
5496
+ exports.sqm_lead_dropdown_field = LeadDropdownField;
5404
5497
  exports.sqm_lead_form = LeadForm;
5405
5498
  exports.sqm_leaderboard = Leaderboard;
5406
5499
  exports.sqm_link_button = LinkButton;
@@ -0,0 +1,155 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-a29c60ef.js');
6
+ const stencilHooks_module = require('./stencil-hooks.module-3a336b0f.js');
7
+ const global = require('./global-e31dc4f5.js');
8
+ const index_module = require('./index.module-ee84433d.js');
9
+ const cjs = require('./cjs-1066ec21.js');
10
+ const utils = require('./utils-6847bc06.js');
11
+ const JSS = require('./JSS-8503a151.js');
12
+ const useLeadFormState = require('./useLeadFormState-c83d2034.js');
13
+
14
+ const style = {
15
+ ErrorStyle: {
16
+ "&::part(control)": {
17
+ background: "var(--sl-color-danger-10)",
18
+ borderColor: "var(--sl-color-danger-500)",
19
+ outline: "var(--sl-color-danger-500)",
20
+ },
21
+ "&:host": {
22
+ "--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
23
+ },
24
+ },
25
+ ErrorMessageStyle: {
26
+ margin: 0,
27
+ marginTop: "5px",
28
+ color: "var(--sl-color-danger-500)",
29
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
30
+ fontFamily: "var(--sl-font-sans)",
31
+ fontWeight: "var(--sl-font-weight-normal)",
32
+ },
33
+ FieldContainer: {
34
+ "margin-bottom": "var(--sl-spacing-large)",
35
+ },
36
+ };
37
+ const vanillaStyle = `
38
+ :host {
39
+ margin: 0 auto;
40
+ width: 100%;
41
+ display: block;
42
+ }
43
+ sl-checkbox::part(label){
44
+ font-size: var(--sl-input-label-font-size-small);
45
+ font-weight: var(--sl-font-weight-normal);
46
+ line-height: 20px;
47
+ }
48
+ sl-checkbox::part(base){
49
+ align-items: start;
50
+ }
51
+ `;
52
+ JSS.jss.setup(JSS.create());
53
+ const sheet = JSS.jss.createStyleSheet(style);
54
+ const styleString = sheet.toString();
55
+ function LeadCheckboxFieldView(props) {
56
+ var _a, _b;
57
+ const { states, content, callbacks } = props;
58
+ return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
59
+ index.h("style", { type: "text/css" },
60
+ vanillaStyle,
61
+ styleString),
62
+ index.h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
63
+ e.target.value = e.target.checked;
64
+ callbacks.setChecked(e.target.value);
65
+ } }, (!content.checkboxOptional ? { required: false } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), required: false }), global.intl.formatMessage({
66
+ id: content.checkboxName + "-message",
67
+ defaultMessage: content.checkboxLabel,
68
+ }, {
69
+ labelLink: (index.h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
70
+ }))));
71
+ }
72
+
73
+ function useLeadCheckboxField(props) {
74
+ var _a;
75
+ const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
76
+ const [checked, setChecked] = stencilHooks_module.useState(false);
77
+ stencilHooks_module.useEffect(() => {
78
+ var _a, _b;
79
+ if ((_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]) {
80
+ setChecked(!!((_b = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _b === void 0 ? void 0 : _b[props.checkboxName]));
81
+ }
82
+ }, [(_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]]);
83
+ return {
84
+ states: {
85
+ leadFormState,
86
+ checked,
87
+ },
88
+ callbacks: {
89
+ setChecked,
90
+ },
91
+ };
92
+ }
93
+
94
+ const LeadCheckboxField = class {
95
+ constructor(hostRef) {
96
+ index.registerInstance(this, hostRef);
97
+ this.ignored = true;
98
+ /**
99
+ * @uiName Checkbox label
100
+ * @uiWidget textArea
101
+ */
102
+ this.checkboxLabel = "By signing up you agree to the {labelLink}";
103
+ /**
104
+ * Used with link text if the checkbox label contains {labelLink}
105
+ *
106
+ * @uiName Checkbox label link
107
+ */
108
+ this.checkboxLabelLink = "https://example.com";
109
+ /**
110
+ * @uiName Checkbox label link lext
111
+ */
112
+ this.checkboxLabelLinkText = "Terms and Conditions";
113
+ /**
114
+ * @uiName Unchecked error message
115
+ */
116
+ this.errorMessage = "Must be checked";
117
+ /**
118
+ * @uiName Optional
119
+ */
120
+ this.checkboxOptional = false;
121
+ stencilHooks_module.h$1(this);
122
+ }
123
+ disconnectedCallback() { }
124
+ render() {
125
+ const missingProps = utils.getMissingProps([
126
+ {
127
+ attribute: "checkbox-name",
128
+ value: this.checkboxName,
129
+ },
130
+ ]);
131
+ if (!index_module.isDemo() && missingProps) {
132
+ return (index.h(useLeadFormState.RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this checkbox field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
133
+ }
134
+ const content = {
135
+ ...utils.getProps(this),
136
+ };
137
+ const { states, callbacks } = index_module.isDemo()
138
+ ? useLeadCheckboxFieldDemo(this)
139
+ : useLeadCheckboxField(this);
140
+ return (index.h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
141
+ }
142
+ };
143
+ function useLeadCheckboxFieldDemo(props) {
144
+ return cjs.cjs({
145
+ states: {
146
+ registrationFormState: {},
147
+ checked: false,
148
+ },
149
+ callbacks: {
150
+ setChecked: () => { },
151
+ },
152
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
153
+ }
154
+
155
+ exports.sqm_lead_checkbox_field = LeadCheckboxField;
@@ -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
  : [])))));
@@ -11,7 +11,7 @@ const utils = require('./utils-6847bc06.js');
11
11
  require('./JSS-8503a151.js');
12
12
  require('./mixins-f7e0377a.js');
13
13
  const useLeadFormState = require('./useLeadFormState-c83d2034.js');
14
- const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
14
+ const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.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,
@@ -42,8 +42,8 @@
42
42
  "./components/sqm-invoice-table/columns/sqm-invoice-table-data-column.js",
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
+ "./components/sqm-lead-form/sqm-lead-checkbox-field.js",
45
46
  "./components/sqm-lead-form/sqm-lead-dropdown-field.js",
46
- "./components/sqm-referral-iframe/sqm-referral-iframe.js",
47
47
  "./components/sqm-lead-form/sqm-lead-form.js",
48
48
  "./components/sqm-lead-form/sqm-lead-input-field.js",
49
49
  "./components/sqm-leaderboard/sqm-leaderboard.js",
@@ -79,6 +79,7 @@
79
79
  "./components/sqm-qr-code/sqm-qr-code.js",
80
80
  "./components/sqm-referral-card/sqm-referral-card.js",
81
81
  "./components/sqm-referral-code/sqm-referral-code.js",
82
+ "./components/sqm-referral-iframe/sqm-referral-iframe.js",
82
83
  "./components/sqm-referral-table/cells/sqm-referral-table-cell.js",
83
84
  "./components/sqm-referral-table/cells/sqm-referral-table-date-cell.js",
84
85
  "./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 = `