@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
@@ -15,12 +15,12 @@ import './luxon-8d51c92b.js';
15
15
  import './sqm-text-span-view-ca32495e.js';
16
16
  import { p as pathToRegexp } from './index-ffa26b43.js';
17
17
  import { R as REGISTRATION_FORM_STATE_CONTEXT, u as useRegistrationFormState } from './useRegistrationFormState-d6f33135.js';
18
- import { R as RequiredPropsError, u as useLeadFormState } from './useLeadFormState-9016d812.js';
18
+ import { R as RequiredPropsError, L as LEAD_FORM_STATE_CONTEXT, u as useLeadFormState } from './useLeadFormState-9016d812.js';
19
19
  import { P as PortalLoginView } from './sqm-portal-login-view-7e49609a.js';
20
20
  import { u as usePortalLogin } from './usePortalLogin-ef647a50.js';
21
21
  import { A as AsYouType } from './AsYouType-46f67d0d.js';
22
22
  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-81771102.js';
23
+ 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-64194d20.js';
24
24
  import './sqm-portal-container-view-1683ae32.js';
25
25
  import { u as usePayoutStatus } from './usePayoutStatus-fed17fc9.js';
26
26
 
@@ -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) {
@@ -1312,7 +1387,6 @@ function useLeadForm(props) {
1312
1387
  const programId = H();
1313
1388
  const user = J();
1314
1389
  const { data: userDetails } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
1315
- console.log({ userDetails });
1316
1390
  const [submitLead, { loading, errors, data }] = $e(SUBMIT_LEAD);
1317
1391
  const [success, setSuccess] = useState(false);
1318
1392
  useEffect(() => {
@@ -1325,7 +1399,7 @@ function useLeadForm(props) {
1325
1399
  };
1326
1400
  }, [formRef.current]);
1327
1401
  const submit = async (event) => {
1328
- var _a, _b, _c, _d;
1402
+ var _a;
1329
1403
  let formControls = event.target.getFormControls();
1330
1404
  let formData = {};
1331
1405
  let validationErrors = {};
@@ -1357,17 +1431,12 @@ function useLeadForm(props) {
1357
1431
  error: "",
1358
1432
  validationErrors: {},
1359
1433
  });
1360
- formData = { ...formData };
1361
1434
  const variables = {
1362
1435
  key: props.formKey,
1363
1436
  formData,
1364
1437
  };
1365
1438
  try {
1366
1439
  const result = await submitLead({ formSubmissionInput: variables });
1367
- console.log({
1368
- 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,
1369
- isError: result instanceof Error,
1370
- });
1371
1440
  if (result instanceof Error) {
1372
1441
  throw result;
1373
1442
  }
@@ -1376,12 +1445,11 @@ function useLeadForm(props) {
1376
1445
  error: "",
1377
1446
  validationErrors: {},
1378
1447
  });
1379
- 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) {
1448
+ if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
1380
1449
  setSuccess(true);
1381
1450
  }
1382
1451
  }
1383
1452
  catch (error) {
1384
- console.log({ error });
1385
1453
  setLeadFormState({
1386
1454
  loading: false,
1387
1455
  error: props.networkErrorMessage,
@@ -1397,6 +1465,18 @@ function useLeadForm(props) {
1397
1465
  const asYouType = new AsYouType("US");
1398
1466
  e.target.value = asYouType.input(e.target.value);
1399
1467
  }, []);
1468
+ function resetForm() {
1469
+ var _a, _b;
1470
+ setLeadFormState({
1471
+ loading: false,
1472
+ error: "",
1473
+ validationErrors: {},
1474
+ });
1475
+ (_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
1476
+ c.value = "";
1477
+ });
1478
+ setSuccess(false);
1479
+ }
1400
1480
  let errorMessage = "";
1401
1481
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1402
1482
  errorMessage = props.networkErrorMessage;
@@ -1408,7 +1488,6 @@ function useLeadForm(props) {
1408
1488
  errorMessage =
1409
1489
  ((_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);
1410
1490
  }
1411
- console.log({ errors, errorMessage });
1412
1491
  return {
1413
1492
  states: {
1414
1493
  loading,
@@ -1420,6 +1499,7 @@ function useLeadForm(props) {
1420
1499
  callbacks: {
1421
1500
  submit,
1422
1501
  inputFunction,
1502
+ resetForm,
1423
1503
  },
1424
1504
  refs: {
1425
1505
  formRef,
@@ -1438,11 +1518,11 @@ const LeadForm = class {
1438
1518
  /**
1439
1519
  * @uiName First Name field label
1440
1520
  */
1441
- this.firstNameLabel = "First Name";
1521
+ this.firstNameLabel = "First name";
1442
1522
  /**
1443
1523
  * @uiName Last Name field label
1444
1524
  */
1445
- this.lastNameLabel = "Last Name";
1525
+ this.lastNameLabel = "Last name";
1446
1526
  /**
1447
1527
  * @uiName Submit button text
1448
1528
  */
@@ -1455,43 +1535,52 @@ const LeadForm = class {
1455
1535
  * @uiName Header text
1456
1536
  */
1457
1537
  this.pageLabel = "Refer your friend";
1538
+ /**
1539
+ * Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
1540
+ * @uiName Form key
1541
+ */
1458
1542
  this.formKey = "lead-form";
1459
1543
  /**
1460
- * Optional support link for error messages.
1544
+ * Optional support link text for error messages.
1545
+ * @uiName Support link text
1461
1546
  */
1462
- this.supportLink = "Support";
1547
+ this.supportLinkText = "Support";
1463
1548
  /**
1464
- * Header text shown on successful submission.
1549
+ * Header text shown on successful lead submission.
1550
+ * @uiName Submit success header
1465
1551
  */
1466
- this.submitSuccessHeader = "Referral submitted";
1552
+ this.submitSuccessHeader = "Lead submitted";
1467
1553
  /**
1468
- * Description text shown on successful submission.
1554
+ * Description text shown on successful lead submission.
1555
+ * @uiName Submit success description
1469
1556
  */
1470
1557
  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.";
1471
1558
  /**
1472
- * Header text shown when an error occurs.
1559
+ * Header text shown if an error occurs.
1560
+ * @uiName Submit error header
1473
1561
  */
1474
1562
  this.submitErrorHeader = "An error occurred while submitting";
1475
1563
  /**
1476
- * Description text shown when an error occurs.
1564
+ * Description text shown if an error occurs.
1565
+ * @uiName Submit error description
1477
1566
  */
1478
1567
  this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1479
1568
  /**
1480
- * The message to be displayed when a required field is not filled.
1569
+ * The message to be displayed if a required field is not filled.
1481
1570
  *
1482
1571
  * @uiName Required field message
1483
1572
  * @uiWidget textArea
1484
1573
  */
1485
1574
  this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1486
1575
  /**
1487
- * The message to be displayed when a the form submission fails unexpectedly.
1576
+ * The message to be displayed if a the form submission fails unexpectedly.
1488
1577
  *
1489
1578
  * @uiName Network error message
1490
1579
  * @uiWidget textArea
1491
1580
  */
1492
1581
  this.networkErrorMessage = "Network request failed.";
1493
1582
  /**
1494
- * The message to be displayed when the email used is invalid or blocked.
1583
+ * The message to be displayed if the email used is invalid.
1495
1584
  *
1496
1585
  * @uiName Invalid email message
1497
1586
  * @uiWidget textArea
@@ -1510,13 +1599,15 @@ const LeadForm = class {
1510
1599
  submitLabel: this.submitLabel,
1511
1600
  resubmitFormLabel: this.resubmitFormLabel,
1512
1601
  pageLabel: this.pageLabel,
1513
- supportLink: this.supportLink,
1602
+ supportLinkText: this.supportLinkText,
1514
1603
  submitSuccessHeader: this.submitSuccessHeader,
1515
1604
  submitSuccessDescription: this.submitSuccessDescription,
1516
1605
  submitErrorHeader: this.submitErrorHeader,
1517
1606
  submitErrorDescription: this.submitErrorDescription,
1518
1607
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1519
1608
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1609
+ firstNameLabel: this.firstNameLabel,
1610
+ lastNameLabel: this.lastNameLabel,
1520
1611
  };
1521
1612
  return (h$1(LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1522
1613
  }
@@ -1533,6 +1624,7 @@ function useRegisterDemo(props) {
1533
1624
  console.log("submit");
1534
1625
  },
1535
1626
  inputFunction: () => { },
1627
+ resetForm: () => { },
1536
1628
  },
1537
1629
  refs: {
1538
1630
  formRef: {},
@@ -5384,4 +5476,4 @@ function useUserNameDemo(props) {
5384
5476
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
5385
5477
  }
5386
5478
 
5387
- 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 };
5479
+ 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 };
@@ -0,0 +1,151 @@
1
+ import { h, r as registerInstance } from './index-91e7729f.js';
2
+ import { i as d, k as useState, f as useEffect, n as h$1 } from './stencil-hooks.module-4bc38af4.js';
3
+ import { i as intl } from './global-be1f9992.js';
4
+ import { i as isDemo } from './index.module-89a79f66.js';
5
+ import { c as cjs } from './cjs-bdfb4486.js';
6
+ import { a as getMissingProps, g as getProps } from './utils-334c1e34.js';
7
+ import { j as jss, a as create } from './JSS-67b5cff8.js';
8
+ import { L as LEAD_FORM_STATE_CONTEXT, R as RequiredPropsError } from './useLeadFormState-9016d812.js';
9
+
10
+ const style = {
11
+ ErrorStyle: {
12
+ "&::part(control)": {
13
+ background: "var(--sl-color-danger-10)",
14
+ borderColor: "var(--sl-color-danger-500)",
15
+ outline: "var(--sl-color-danger-500)",
16
+ },
17
+ "&:host": {
18
+ "--focus-ring": "0 0 0 var(--sl-focus-ring-width) red !important",
19
+ },
20
+ },
21
+ ErrorMessageStyle: {
22
+ margin: 0,
23
+ marginTop: "5px",
24
+ color: "var(--sl-color-danger-500)",
25
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
26
+ fontFamily: "var(--sl-font-sans)",
27
+ fontWeight: "var(--sl-font-weight-normal)",
28
+ },
29
+ FieldContainer: {
30
+ "margin-bottom": "var(--sl-spacing-large)",
31
+ },
32
+ };
33
+ const vanillaStyle = `
34
+ :host {
35
+ margin: 0 auto;
36
+ width: 100%;
37
+ display: block;
38
+ }
39
+ sl-checkbox::part(label){
40
+ font-size: var(--sl-input-label-font-size-small);
41
+ font-weight: var(--sl-font-weight-normal);
42
+ line-height: 20px;
43
+ }
44
+ sl-checkbox::part(base){
45
+ align-items: start;
46
+ }
47
+ `;
48
+ jss.setup(create());
49
+ const sheet = jss.createStyleSheet(style);
50
+ const styleString = sheet.toString();
51
+ function LeadCheckboxFieldView(props) {
52
+ var _a, _b;
53
+ const { states, content, callbacks } = props;
54
+ return (h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
55
+ h("style", { type: "text/css" },
56
+ vanillaStyle,
57
+ styleString),
58
+ h("sl-checkbox", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.checkboxName}`, checked: states.checked, "onSl-change": (e) => {
59
+ e.target.value = e.target.checked;
60
+ callbacks.setChecked(e.target.value);
61
+ } }, (!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 }), intl.formatMessage({
62
+ id: content.checkboxName + "-message",
63
+ defaultMessage: content.checkboxLabel,
64
+ }, {
65
+ labelLink: (h("a", { href: content.checkboxLabelLink, target: "_blank" }, content.checkboxLabelLinkText || content.checkboxLabelLink)),
66
+ }))));
67
+ }
68
+
69
+ function useLeadCheckboxField(props) {
70
+ var _a;
71
+ const leadFormState = d(LEAD_FORM_STATE_CONTEXT);
72
+ const [checked, setChecked] = useState(false);
73
+ useEffect(() => {
74
+ var _a, _b;
75
+ if ((_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]) {
76
+ setChecked(!!((_b = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _b === void 0 ? void 0 : _b[props.checkboxName]));
77
+ }
78
+ }, [(_a = leadFormState === null || leadFormState === void 0 ? void 0 : leadFormState.initialData) === null || _a === void 0 ? void 0 : _a[props.checkboxName]]);
79
+ return {
80
+ states: {
81
+ leadFormState,
82
+ checked,
83
+ },
84
+ callbacks: {
85
+ setChecked,
86
+ },
87
+ };
88
+ }
89
+
90
+ const LeadCheckboxField = class {
91
+ constructor(hostRef) {
92
+ registerInstance(this, hostRef);
93
+ this.ignored = true;
94
+ /**
95
+ * @uiName Checkbox label
96
+ * @uiWidget textArea
97
+ */
98
+ this.checkboxLabel = "By signing up you agree to the {labelLink}";
99
+ /**
100
+ * Used with link text if the checkbox label contains {labelLink}
101
+ *
102
+ * @uiName Checkbox label link
103
+ */
104
+ this.checkboxLabelLink = "https://example.com";
105
+ /**
106
+ * @uiName Checkbox label link lext
107
+ */
108
+ this.checkboxLabelLinkText = "Terms and Conditions";
109
+ /**
110
+ * @uiName Unchecked error message
111
+ */
112
+ this.errorMessage = "Must be checked";
113
+ /**
114
+ * @uiName Optional
115
+ */
116
+ this.checkboxOptional = false;
117
+ h$1(this);
118
+ }
119
+ disconnectedCallback() { }
120
+ render() {
121
+ const missingProps = getMissingProps([
122
+ {
123
+ attribute: "checkbox-name",
124
+ value: this.checkboxName,
125
+ },
126
+ ]);
127
+ if (!isDemo() && missingProps) {
128
+ return (h(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:" }));
129
+ }
130
+ const content = {
131
+ ...getProps(this),
132
+ };
133
+ const { states, callbacks } = isDemo()
134
+ ? useLeadCheckboxFieldDemo(this)
135
+ : useLeadCheckboxField(this);
136
+ return (h(LeadCheckboxFieldView, { states: states, content: content, callbacks: callbacks }));
137
+ }
138
+ };
139
+ function useLeadCheckboxFieldDemo(props) {
140
+ return cjs({
141
+ states: {
142
+ registrationFormState: {},
143
+ checked: false,
144
+ },
145
+ callbacks: {
146
+ setChecked: () => { },
147
+ },
148
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
149
+ }
150
+
151
+ export { LeadCheckboxField as sqm_lead_checkbox_field };
@@ -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
  : [])))));
@@ -7,7 +7,7 @@ import { g as getProps, a as getMissingProps } from './utils-334c1e34.js';
7
7
  import './JSS-67b5cff8.js';
8
8
  import './mixins-83f90fa1.js';
9
9
  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';
10
+ import { L as LeadInputFieldView } from './sqm-lead-input-field-view-4ede5d7f.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
@@ -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-81771102.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-64194d20.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,