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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/cjs/{ShadowViewAddon-c0a5fdf8.js → ShadowViewAddon-344e1c0d.js} +75 -47
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mint-components.cjs.js +1 -1
  4. package/dist/cjs/sqm-big-stat_42.cjs.entry.js +117 -120
  5. package/dist/cjs/sqm-lead-dropdown-field-view-0211d640.js +67 -0
  6. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +81 -0
  7. package/dist/cjs/sqm-lead-input-field-view-5a0b1aed.js +51 -0
  8. package/dist/cjs/sqm-lead-input-field.cjs.entry.js +84 -0
  9. package/dist/cjs/sqm-stencilbook.cjs.entry.js +167 -49
  10. package/dist/cjs/useLeadFormState-c83d2034.js +72 -0
  11. package/dist/collection/collection-manifest.json +3 -1
  12. package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +35 -46
  13. package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +59 -0
  14. package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +48 -0
  15. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +63 -0
  16. package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +199 -0
  17. package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +77 -48
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +150 -36
  19. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +47 -0
  20. package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +228 -0
  21. package/dist/collection/components/sqm-lead-form/useLeadDropdownField.js +10 -0
  22. package/dist/collection/components/sqm-lead-form/useLeadForm.js +36 -7
  23. package/dist/collection/components/sqm-lead-form/useLeadInputField.js +10 -0
  24. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -0
  25. package/dist/esm/{ShadowViewAddon-aa7177fe.js → ShadowViewAddon-a14f9e24.js} +76 -48
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/mint-components.js +1 -1
  28. package/dist/esm/sqm-big-stat_42.entry.js +114 -117
  29. package/dist/esm/sqm-lead-dropdown-field-view-62e74a36.js +65 -0
  30. package/dist/esm/sqm-lead-dropdown-field.entry.js +77 -0
  31. package/dist/esm/sqm-lead-input-field-view-9b23f22c.js +49 -0
  32. package/dist/esm/sqm-lead-input-field.entry.js +80 -0
  33. package/dist/esm/sqm-stencilbook.entry.js +167 -49
  34. package/dist/esm/useLeadFormState-9016d812.js +68 -0
  35. package/dist/esm-es5/ShadowViewAddon-a14f9e24.js +1 -0
  36. package/dist/esm-es5/loader.js +1 -1
  37. package/dist/esm-es5/mint-components.js +1 -1
  38. package/dist/esm-es5/sqm-big-stat_42.entry.js +1 -1
  39. package/dist/esm-es5/sqm-lead-dropdown-field-view-62e74a36.js +1 -0
  40. package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +1 -0
  41. package/dist/esm-es5/sqm-lead-input-field-view-9b23f22c.js +1 -0
  42. package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -0
  43. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  44. package/dist/esm-es5/useLeadFormState-9016d812.js +1 -0
  45. package/dist/mint-components/mint-components.esm.js +1 -1
  46. package/dist/mint-components/p-00590b7a.system.js +1 -0
  47. package/dist/mint-components/p-03681bf2.entry.js +273 -0
  48. package/dist/mint-components/p-05516d33.system.js +1 -0
  49. package/dist/mint-components/p-1d704c40.system.js +1 -0
  50. package/dist/mint-components/p-2192104c.entry.js +1 -0
  51. package/dist/mint-components/p-34c5b141.system.entry.js +1 -0
  52. package/dist/mint-components/p-37996351.system.js +1 -1
  53. package/dist/mint-components/p-3e327cc8.system.entry.js +1 -0
  54. package/dist/mint-components/{p-373a92a2.js → p-5afa5a28.js} +24 -24
  55. package/dist/mint-components/p-84a9e392.system.entry.js +1 -0
  56. package/dist/mint-components/p-8698266c.system.js +1 -0
  57. package/dist/mint-components/p-9398453d.system.entry.js +1 -0
  58. package/dist/mint-components/p-b54f8e03.entry.js +1 -0
  59. package/dist/mint-components/p-cd10001b.js +1 -0
  60. package/dist/mint-components/{p-8dc110b0.entry.js → p-ed69285c.entry.js} +2 -2
  61. package/dist/mint-components/p-f6717dd7.js +1 -0
  62. package/dist/mint-components/p-f98a4354.js +1 -0
  63. package/dist/types/components/sqm-lead-form/LeadForm.stories.d.ts +1 -0
  64. package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +9 -0
  65. package/dist/types/components/sqm-lead-form/LeadInputField.stories.d.ts +8 -0
  66. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +15 -0
  67. package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +42 -0
  68. package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +8 -0
  69. package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +24 -7
  70. package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +14 -0
  71. package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +49 -0
  72. package/dist/types/components/sqm-lead-form/useLeadDropdownField.d.ts +6 -0
  73. package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +6 -1
  74. package/dist/types/components/sqm-lead-form/useLeadInputField.d.ts +6 -0
  75. package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
  76. package/dist/types/components.d.ts +194 -12
  77. package/docs/docs.docx +0 -0
  78. package/docs/raisins.json +1 -1
  79. package/grapesjs/grapesjs.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/esm-es5/ShadowViewAddon-aa7177fe.js +0 -1
  82. package/dist/mint-components/p-02a6e0df.system.entry.js +0 -1
  83. package/dist/mint-components/p-0c6ab3ec.system.entry.js +0 -1
  84. package/dist/mint-components/p-6349fb7c.entry.js +0 -265
  85. package/dist/mint-components/p-72e5e84f.system.js +0 -1
@@ -19,11 +19,12 @@ 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');
22
23
  const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
23
24
  const usePortalLogin = require('./usePortalLogin-63d896d1.js');
24
25
  const AsYouType = require('./AsYouType-6788393a.js');
25
26
  const utilities = require('./utilities-78f5e169.js');
26
- const ShadowViewAddon = require('./ShadowViewAddon-c0a5fdf8.js');
27
+ const ShadowViewAddon = require('./ShadowViewAddon-344e1c0d.js');
27
28
  require('./sqm-portal-container-view-4f15143a.js');
28
29
  const usePayoutStatus = require('./usePayoutStatus-feeac99b.js');
29
30
 
@@ -141,58 +142,6 @@ const CardFeed = class {
141
142
  }
142
143
  };
143
144
 
144
- const style = {
145
- IconStyle: {
146
- display: "block",
147
- position: "absolute",
148
- top: "23px",
149
- },
150
- DivStyle: {
151
- marginLeft: "28px",
152
- },
153
- Details: {
154
- marginLeft: "28px",
155
- },
156
- Heading: {
157
- display: "inline-block",
158
- },
159
- Children: {
160
- display: "none",
161
- },
162
- };
163
- const sheet = JSS.createStyleSheet(style);
164
- const styleString = sheet.toString();
165
- function RequiredPropsError({ missingProps, heading = "There was a problem loading this section", subheading = "There was a technical problem that prevented this section from loading. Please contact us with the link to this page.", description = "Error occured while loading <{tagName}>. Values for the following attributes are missing:", }, children) {
166
- if (!missingProps)
167
- return false;
168
- const host = index_module._();
169
- const [detailsOpen, setDetailsOpen] = stencilHooks_module.useState(false);
170
- return (index.h("sl-alert", { type: "danger", open: true },
171
- index.h("style", { type: "text/css" }, styleString),
172
- index.h("div", { slot: "icon", class: sheet.classes.IconStyle },
173
- index.h("sl-icon", { name: "exclamation-octagon" })),
174
- index.h("div", { class: sheet.classes.DivStyle },
175
- index.h("h2", { class: sheet.classes.Heading }, global.intl.formatMessage({
176
- id: `error-heading`,
177
- defaultMessage: heading,
178
- })),
179
- index.h("p", null, global.intl.formatMessage({
180
- id: `error-subheading`,
181
- defaultMessage: subheading,
182
- }))),
183
- index.h("details", { class: sheet.classes.Details },
184
- index.h("summary", { onClick: () => setDetailsOpen(!detailsOpen) },
185
- detailsOpen ? "Less" : "More",
186
- " details"),
187
- index.h("p", null, global.intl.formatMessage({
188
- id: `error-description`,
189
- defaultMessage: description,
190
- }, { tagName: host.tagName.toLowerCase() })),
191
- index.h("ul", null, missingProps.map((prop) => (index.h("li", null,
192
- index.h("strong", null, prop.attribute)))))),
193
- index.h("div", { class: sheet.classes.Children }, children)));
194
- }
195
-
196
145
  function useCheckboxField(props) {
197
146
  var _a;
198
147
  const registrationFormState = stencilHooks_module.d(useRegistrationFormState.REGISTRATION_FORM_STATE_CONTEXT);
@@ -252,7 +201,7 @@ const CheckboxField = class {
252
201
  },
253
202
  ]);
254
203
  if (!index_module.isDemo() && missingProps) {
255
- return (index.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:" }));
204
+ 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:" }));
256
205
  }
257
206
  const content = {
258
207
  ...utils.getProps(this),
@@ -718,7 +667,7 @@ const DropdownField = class {
718
667
  },
719
668
  ]);
720
669
  if (!index_module.isDemo() && missingProps) {
721
- return (index.h(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)));
670
+ 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)));
722
671
  }
723
672
  const content = {
724
673
  ...utils.getProps(this),
@@ -1330,7 +1279,7 @@ const InputField = class {
1330
1279
  },
1331
1280
  ]);
1332
1281
  if (!index_module.isDemo() && missingProps) {
1333
- return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
1282
+ return (index.h(useLeadFormState.RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this input field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
1334
1283
  }
1335
1284
  const { states } = index_module.isDemo() ? useInputFieldDemo(this) : useInputField();
1336
1285
  return index.h(ShadowViewAddon.InputFieldView, { states: states, content: content });
@@ -1344,15 +1293,6 @@ function useInputFieldDemo(props) {
1344
1293
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1345
1294
  }
1346
1295
 
1347
- const LEAD_FORM_STATE_CONTEXT = "sq:lead-form-state";
1348
- const LEAD_FORM_STATE_CONTEXT_INTERNAL = "sq:lead-form-state-internal";
1349
- function useLeadFormState(formState) {
1350
- const host = index_module._();
1351
- const [leadFormState, setLeadFormState] = stencilHooks_module.y(host, LEAD_FORM_STATE_CONTEXT, formState);
1352
- stencilHooks_module.y(host, LEAD_FORM_STATE_CONTEXT_INTERNAL, [leadFormState, setLeadFormState]);
1353
- return { leadFormState, setLeadFormState };
1354
- }
1355
-
1356
1296
  const SUBMIT_LEAD = index_module.dist.gql `
1357
1297
  mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1358
1298
  submitForm(formSubmissionInput: $formSubmissionInput) {
@@ -1360,11 +1300,25 @@ const SUBMIT_LEAD = index_module.dist.gql `
1360
1300
  }
1361
1301
  }
1362
1302
  `;
1303
+ const GET_USER_DETAILS = index_module.dist.gql `
1304
+ query getUser($programId: ID) {
1305
+ viewer {
1306
+ ... on User {
1307
+ referralCode(programId: $programId)
1308
+ }
1309
+ }
1310
+ }
1311
+ `;
1363
1312
  function useLeadForm(props) {
1364
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1313
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
1365
1314
  const formRef = stencilHooks_module.useRef(null);
1366
- const { leadFormState, setLeadFormState } = useLeadFormState({});
1315
+ const { leadFormState, setLeadFormState } = useLeadFormState.useLeadFormState({});
1316
+ const programId = index_module.H();
1317
+ const user = index_module.J();
1318
+ const { data: userDetails } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
1319
+ console.log({ userDetails });
1367
1320
  const [submitLead, { loading, errors, data }] = index_module.$e(SUBMIT_LEAD);
1321
+ const [success, setSuccess] = stencilHooks_module.useState(false);
1368
1322
  stencilHooks_module.useEffect(() => {
1369
1323
  if (!formRef.current)
1370
1324
  return;
@@ -1375,6 +1329,7 @@ function useLeadForm(props) {
1375
1329
  };
1376
1330
  }, [formRef.current]);
1377
1331
  const submit = async (event) => {
1332
+ var _a;
1378
1333
  let formControls = event.target.getFormControls();
1379
1334
  let formData = {};
1380
1335
  let validationErrors = {};
@@ -1421,8 +1376,8 @@ function useLeadForm(props) {
1421
1376
  error: "",
1422
1377
  validationErrors: {},
1423
1378
  });
1424
- if (result.success) {
1425
- index_module.jn.push(props.nextPage);
1379
+ if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
1380
+ setSuccess(true);
1426
1381
  }
1427
1382
  }
1428
1383
  catch (error) {
@@ -1441,6 +1396,18 @@ function useLeadForm(props) {
1441
1396
  const asYouType = new AsYouType.AsYouType("US");
1442
1397
  e.target.value = asYouType.input(e.target.value);
1443
1398
  }, []);
1399
+ function resetForm() {
1400
+ var _a, _b;
1401
+ setLeadFormState({
1402
+ loading: false,
1403
+ error: "",
1404
+ validationErrors: {},
1405
+ });
1406
+ (_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
1407
+ c.value = "";
1408
+ });
1409
+ setSuccess(false);
1410
+ }
1444
1411
  let errorMessage = "";
1445
1412
  if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
1446
1413
  errorMessage = props.networkErrorMessage;
@@ -1452,16 +1419,19 @@ function useLeadForm(props) {
1452
1419
  errorMessage =
1453
1420
  ((_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);
1454
1421
  }
1422
+ console.log({ errors, errorMessage });
1455
1423
  return {
1456
1424
  states: {
1457
1425
  loading,
1458
1426
  error: errorMessage,
1427
+ success,
1459
1428
  leadFormState,
1460
- referralCode: "ABC123",
1429
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1461
1430
  },
1462
1431
  callbacks: {
1463
1432
  submit,
1464
1433
  inputFunction,
1434
+ resetForm,
1465
1435
  },
1466
1436
  refs: {
1467
1437
  formRef,
@@ -1473,13 +1443,6 @@ const LeadForm = class {
1473
1443
  constructor(hostRef) {
1474
1444
  index.registerInstance(this, hostRef);
1475
1445
  this.ignored = true;
1476
- /**
1477
- * Redirect participants to this page from their verification email
1478
- *
1479
- * @uiName Submission redirect
1480
- * @uiWidget pageSelect
1481
- */
1482
- this.nextPage = "/";
1483
1446
  /**
1484
1447
  * @uiName Email field label
1485
1448
  */
@@ -1496,18 +1459,42 @@ const LeadForm = class {
1496
1459
  * @uiName Submit button text
1497
1460
  */
1498
1461
  this.submitLabel = "Submit";
1462
+ /**
1463
+ * @uiName Submit another form button label
1464
+ */
1465
+ this.resubmitFormLabel = "Refer Another Friend";
1499
1466
  /**
1500
1467
  * @uiName Header text
1501
1468
  */
1502
- this.pageLabel = "Submit your information";
1469
+ this.pageLabel = "Refer your friend";
1503
1470
  this.formKey = "lead-form";
1471
+ /**
1472
+ * Optional support link for error messages.
1473
+ */
1474
+ this.supportLink = "Support";
1475
+ /**
1476
+ * Header text shown on successful submission.
1477
+ */
1478
+ this.submitSuccessHeader = "Referral submitted";
1479
+ /**
1480
+ * Description text shown on successful submission.
1481
+ */
1482
+ 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.";
1483
+ /**
1484
+ * Header text shown when an error occurs.
1485
+ */
1486
+ this.submitErrorHeader = "An error occurred while submitting";
1487
+ /**
1488
+ * Description text shown when an error occurs.
1489
+ */
1490
+ this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1504
1491
  /**
1505
1492
  * The message to be displayed when a required field is not filled.
1506
1493
  *
1507
1494
  * @uiName Required field message
1508
1495
  * @uiWidget textArea
1509
1496
  */
1510
- this.requiredFieldErrorMessage = "Cannot be empty";
1497
+ this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1511
1498
  /**
1512
1499
  * The message to be displayed when a the form submission fails unexpectedly.
1513
1500
  *
@@ -1533,9 +1520,17 @@ const LeadForm = class {
1533
1520
  formData: index.h("slot", { name: "formData" }),
1534
1521
  emailLabel: this.emailLabel,
1535
1522
  submitLabel: this.submitLabel,
1523
+ resubmitFormLabel: this.resubmitFormLabel,
1536
1524
  pageLabel: this.pageLabel,
1525
+ supportLink: this.supportLink,
1526
+ submitSuccessHeader: this.submitSuccessHeader,
1527
+ submitSuccessDescription: this.submitSuccessDescription,
1528
+ submitErrorHeader: this.submitErrorHeader,
1529
+ submitErrorDescription: this.submitErrorDescription,
1537
1530
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1538
1531
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1532
+ firstNameLabel: this.firstNameLabel,
1533
+ lastNameLabel: this.lastNameLabel,
1539
1534
  };
1540
1535
  return (index.h(ShadowViewAddon.LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
1541
1536
  }
@@ -1545,12 +1540,14 @@ function useRegisterDemo(props) {
1545
1540
  states: {
1546
1541
  error: "",
1547
1542
  loading: false,
1543
+ success: false,
1548
1544
  },
1549
1545
  callbacks: {
1550
1546
  submit: async (_event) => {
1551
1547
  console.log("submit");
1552
1548
  },
1553
1549
  inputFunction: () => { },
1550
+ resetForm: () => { },
1554
1551
  },
1555
1552
  refs: {
1556
1553
  formRef: {},
@@ -1855,7 +1852,7 @@ function useLeaderboardDemo(props) {
1855
1852
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1856
1853
  }
1857
1854
 
1858
- const style$1 = {
1855
+ const style = {
1859
1856
  Container: { display: "contents" },
1860
1857
  Link: {
1861
1858
  textDecoration: "none",
@@ -1867,16 +1864,16 @@ const vanillaStyle = `
1867
1864
  display: inline;
1868
1865
  }
1869
1866
  `;
1870
- const sheet$1 = JSS.createStyleSheet(style$1);
1871
- const styleString$1 = sheet$1.toString();
1867
+ const sheet = JSS.createStyleSheet(style);
1868
+ const styleString = sheet.toString();
1872
1869
  function LinkButtonView(props) {
1873
1870
  const { onClick, buttonText } = props;
1874
- return (index.h("span", { class: sheet$1.classes.Container, part: "sqm-base" },
1871
+ return (index.h("span", { class: sheet.classes.Container, part: "sqm-base" },
1875
1872
  index.h("style", { type: "text/css" },
1876
- styleString$1,
1873
+ styleString,
1877
1874
  vanillaStyle),
1878
1875
  index.h("sl-button", { onClick: onClick, type: "primary", exportparts: "base: primarybutton-base" },
1879
- index.h("a", { class: sheet$1.classes.Link, part: "sqm-link" }, buttonText))));
1876
+ index.h("a", { class: sheet.classes.Link, part: "sqm-link" }, buttonText))));
1880
1877
  }
1881
1878
 
1882
1879
  const LinkButton = class {
@@ -2057,7 +2054,7 @@ function useNavigationMenuDemo(props) {
2057
2054
  }
2058
2055
  NavigationMenu.style = sqmNavigationMenuCss;
2059
2056
 
2060
- const style$2 = {
2057
+ const style$1 = {
2061
2058
  Wrapper: {
2062
2059
  maxWidth: "200px",
2063
2060
  marginLeft: "auto",
@@ -2068,16 +2065,16 @@ const style$2 = {
2068
2065
  margin: "0",
2069
2066
  },
2070
2067
  };
2071
- const sheet$2 = JSS.createStyleSheet(style$2);
2072
- const styleString$2 = sheet$2.toString();
2068
+ const sheet$1 = JSS.createStyleSheet(style$1);
2069
+ const styleString$1 = sheet$1.toString();
2073
2070
  function PayoutButtonScrollView(props) {
2074
2071
  const { text, states } = props;
2075
2072
  if (!states.payoutSettingsComplete)
2076
2073
  return index.h("div", null);
2077
- return (index.h("div", { class: sheet$2.classes.Wrapper },
2078
- index.h("style", { type: "text/css" }, styleString$2),
2074
+ return (index.h("div", { class: sheet$1.classes.Wrapper },
2075
+ index.h("style", { type: "text/css" }, styleString$1),
2079
2076
  index.h("sqm-scroll", { "scroll-tag-name": "sqm-tabs", "button-text": text.payoutButtonText, "scroll-animation": "smooth" }),
2080
- index.h("p", { class: sheet$2.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2077
+ index.h("p", { class: sheet$1.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2081
2078
  }
2082
2079
 
2083
2080
  const GET_PAYOUT_DETAILS = index_module.dist.gql `
@@ -2150,7 +2147,7 @@ function useDemoPayoutButtonScroll(props) {
2150
2147
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
2151
2148
  }
2152
2149
 
2153
- const style$3 = {
2150
+ const style$2 = {
2154
2151
  SkeletonOne: {
2155
2152
  width: "50%",
2156
2153
  height: "16px",
@@ -2201,8 +2198,8 @@ const style$3 = {
2201
2198
  "&::part(footer)": {},
2202
2199
  },
2203
2200
  };
2204
- const sheet$3 = JSS.createStyleSheet(style$3);
2205
- const styleString$3 = sheet$3.toString();
2201
+ const sheet$2 = JSS.createStyleSheet(style$2);
2202
+ const styleString$2 = sheet$2.toString();
2206
2203
  function PayoutStatusAlertView(props) {
2207
2204
  const { text, states, data, callbacks } = props;
2208
2205
  function getAlert(status) {
@@ -2213,7 +2210,7 @@ function PayoutStatusAlertView(props) {
2213
2210
  buttonText: null,
2214
2211
  alertType: "critical",
2215
2212
  icon: "exclamation-triangle",
2216
- class: sheet$3.classes.ErrorAlertContainer,
2213
+ class: sheet$2.classes.ErrorAlertContainer,
2217
2214
  };
2218
2215
  switch (status) {
2219
2216
  case "INFORMATION_REQUIRED":
@@ -2223,7 +2220,7 @@ function PayoutStatusAlertView(props) {
2223
2220
  buttonText: text.informationRequiredButtonText,
2224
2221
  alertType: "info",
2225
2222
  icon: "info-circle",
2226
- class: sheet$3.classes.InfoAlertContainer,
2223
+ class: sheet$2.classes.InfoAlertContainer,
2227
2224
  };
2228
2225
  case "VERIFICATION:REQUIRED":
2229
2226
  return {
@@ -2237,7 +2234,7 @@ function PayoutStatusAlertView(props) {
2237
2234
  buttonText: text.verificationRequiredButtonText,
2238
2235
  alertType: "warning",
2239
2236
  icon: "exclamation-triangle",
2240
- class: sheet$3.classes.WarningAlertContainer,
2237
+ class: sheet$2.classes.WarningAlertContainer,
2241
2238
  };
2242
2239
  case "VERIFICATION:INTERNAL":
2243
2240
  return {
@@ -2250,7 +2247,7 @@ function PayoutStatusAlertView(props) {
2250
2247
  }),
2251
2248
  alertType: "warning",
2252
2249
  icon: "exclamation-triangle",
2253
- class: sheet$3.classes.WarningAlertContainer,
2250
+ class: sheet$2.classes.WarningAlertContainer,
2254
2251
  };
2255
2252
  case "VERIFICATION:REVIEW":
2256
2253
  return {
@@ -2263,7 +2260,7 @@ function PayoutStatusAlertView(props) {
2263
2260
  }),
2264
2261
  alertType: "warning",
2265
2262
  icon: "exclamation-triangle",
2266
- class: sheet$3.classes.WarningAlertContainer,
2263
+ class: sheet$2.classes.WarningAlertContainer,
2267
2264
  };
2268
2265
  case "VERIFICATION:FAILED":
2269
2266
  return {
@@ -2276,7 +2273,7 @@ function PayoutStatusAlertView(props) {
2276
2273
  }),
2277
2274
  alertType: "critical",
2278
2275
  icon: "exclamation-octagon",
2279
- class: sheet$3.classes.ErrorAlertContainer,
2276
+ class: sheet$2.classes.ErrorAlertContainer,
2280
2277
  };
2281
2278
  case "HOLD":
2282
2279
  return {
@@ -2290,7 +2287,7 @@ function PayoutStatusAlertView(props) {
2290
2287
  buttonText: null,
2291
2288
  alertType: "warning",
2292
2289
  icon: "exclamation-triangle",
2293
- class: sheet$3.classes.WarningAlertContainer,
2290
+ class: sheet$2.classes.WarningAlertContainer,
2294
2291
  };
2295
2292
  default:
2296
2293
  return;
@@ -2309,18 +2306,18 @@ function PayoutStatusAlertView(props) {
2309
2306
  }
2310
2307
  }
2311
2308
  if (states.loading) {
2312
- return index.h("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
2309
+ return index.h("sl-skeleton", { class: sheet$2.classes.SkeletonOne });
2313
2310
  }
2314
2311
  const alertDetails = getAlert(states.status);
2315
2312
  if (states.status === "DONE" || !alertDetails) {
2316
2313
  return index.h("div", null);
2317
2314
  }
2318
2315
  return (index.h("div", { part: "sqm-base" },
2319
- index.h("style", { type: "text/css" }, styleString$3),
2316
+ index.h("style", { type: "text/css" }, styleString$2),
2320
2317
  index.h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: alertDetails.alertType, class: alertDetails.class, open: true },
2321
2318
  index.h("sl-icon", { slot: "icon", name: alertDetails.icon }),
2322
2319
  index.h("strong", null, alertDetails.header),
2323
- index.h("p", { class: sheet$3.classes.AlertDescriptionText }, alertDetails.description),
2320
+ index.h("p", { class: sheet$2.classes.AlertDescriptionText }, alertDetails.description),
2324
2321
  getButton(states.status))));
2325
2322
  }
2326
2323
 
@@ -3474,7 +3471,7 @@ const ProgramMenu = class {
3474
3471
  }
3475
3472
  };
3476
3473
 
3477
- const style$4 = {
3474
+ const style$3 = {
3478
3475
  Container: {
3479
3476
  borderRadius: "var(--sl-border-radius-large)",
3480
3477
  color: "var(--sl-color-neutral-900)",
@@ -3502,15 +3499,15 @@ const style$4 = {
3502
3499
  },
3503
3500
  },
3504
3501
  };
3505
- const sheet$4 = JSS.createStyleSheet(style$4);
3506
- const styleString$4 = sheet$4.toString();
3502
+ const sheet$3 = JSS.createStyleSheet(style$3);
3503
+ const styleString$3 = sheet$3.toString();
3507
3504
  const vanillaStyle$1 = `
3508
3505
  :host{
3509
3506
  display: block;
3510
3507
  }
3511
3508
  `;
3512
3509
  function ReferralCardView(props) {
3513
- return (index.h("div", { part: "sqm-base", class: sheet$4.classes.Container, style: {
3510
+ return (index.h("div", { part: "sqm-base", class: sheet$3.classes.Container, style: {
3514
3511
  border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
3515
3512
  "padding-top": `var(--sl-spacing-${props.paddingTop})`,
3516
3513
  "padding-right": `var(--sl-spacing-${props.paddingRight})`,
@@ -3521,15 +3518,15 @@ function ReferralCardView(props) {
3521
3518
  margin: `${props.limitWidth ? "auto" : "none"}`,
3522
3519
  } },
3523
3520
  index.h("style", { type: "text/css" },
3524
- styleString$4,
3521
+ styleString$3,
3525
3522
  vanillaStyle$1),
3526
- props.hasHeader && (index.h("div", { class: sheet$4.classes.EndContainer }, props.slots.header)),
3527
- index.h("div", { part: "sqm-column-container", class: sheet$4.classes.ColumnContainer, style: {
3523
+ props.hasHeader && (index.h("div", { class: sheet$3.classes.EndContainer }, props.slots.header)),
3524
+ index.h("div", { part: "sqm-column-container", class: sheet$3.classes.ColumnContainer, style: {
3528
3525
  alignItems: props.verticalAlignment,
3529
3526
  } },
3530
3527
  props.slots.left,
3531
3528
  props.slots.right),
3532
- props.hasFooter && (index.h("div", { class: sheet$4.classes.EndContainer }, props.slots.footer))));
3529
+ props.hasFooter && (index.h("div", { class: sheet$3.classes.EndContainer }, props.slots.footer))));
3533
3530
  }
3534
3531
 
3535
3532
  const ReferralCard = class {
@@ -3604,7 +3601,7 @@ const ReferralCard = class {
3604
3601
  }
3605
3602
  };
3606
3603
 
3607
- const GET_USER_DETAILS = index_module.dist.gql `
3604
+ const GET_USER_DETAILS$1 = index_module.dist.gql `
3608
3605
  query getUser($programId: ID) {
3609
3606
  viewer {
3610
3607
  ... on User {
@@ -3617,7 +3614,7 @@ function useReferralIframe(props) {
3617
3614
  var _a;
3618
3615
  const programId = index_module.H();
3619
3616
  const user = index_module.J();
3620
- const { data } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3617
+ const { data } = index_module.wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3621
3618
  return {
3622
3619
  states: {
3623
3620
  content: props,
@@ -3653,7 +3650,7 @@ const SqmReferralIframe = class {
3653
3650
  },
3654
3651
  ]);
3655
3652
  if (missingProps) {
3656
- return (index.h(RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
3653
+ return (index.h(useLeadFormState.RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this page", subheading: "A technical problem prevented this iframe from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }));
3657
3654
  }
3658
3655
  const { states, data } = index_module.isDemo()
3659
3656
  ? useReferralIframeDemo(utils.getProps(this))
@@ -5252,7 +5249,7 @@ const Gift = () => (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24
5252
5249
  const Circle = () => (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5253
5250
  index.h("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
5254
5251
 
5255
- const style$5 = {
5252
+ const style$4 = {
5256
5253
  TimelineReward: {
5257
5254
  color: "var(--sl-color-neutral-900)",
5258
5255
  lineHeight: "var(--sl-line-height-dense)",
@@ -5295,8 +5292,8 @@ const style$5 = {
5295
5292
  },
5296
5293
  },
5297
5294
  };
5298
- const sheet$5 = JSS.createStyleSheet(style$5);
5299
- const styleString$5 = sheet$5.toString();
5295
+ const sheet$4 = JSS.createStyleSheet(style$4);
5296
+ const styleString$4 = sheet$4.toString();
5300
5297
  const vanillaStyle$2 = `
5301
5298
  :host{
5302
5299
  display: block;
@@ -5309,9 +5306,9 @@ const vanillaStyle$2 = `
5309
5306
  function TimelineEntryView(props) {
5310
5307
  var _a;
5311
5308
  const timeline_icon = (_a = props.icon) !== null && _a !== void 0 ? _a : props.iconState;
5312
- return (index.h("div", { class: sheet$5.classes.TimelineReward, part: "sqm-base" },
5309
+ return (index.h("div", { class: sheet$4.classes.TimelineReward, part: "sqm-base" },
5313
5310
  index.h("style", { type: "text/css" },
5314
- styleString$5,
5311
+ styleString$4,
5315
5312
  vanillaStyle$2),
5316
5313
  index.h("div", { class: "container", part: "sqm-entry-container" },
5317
5314
  index.h("div", { class: "line" }, "/"),
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-a29c60ef.js');
4
+ const global = require('./global-e31dc4f5.js');
5
+ const JSS = require('./JSS-8503a151.js');
6
+
7
+ const style = {
8
+ ErrorStyle: {
9
+ "--sl-input-border-color": "var(--sl-color-danger-500)",
10
+ "--sl-input-background-color": "var(--sl-color-danger-10)",
11
+ "--sl-input-border-color-focus": "var(--sl-color-danger-500)",
12
+ "--sl-input-border-color-hover": "var(--sl-color-danger-500)",
13
+ },
14
+ ErrorMessageStyle: {
15
+ margin: 0,
16
+ color: "var(--sl-color-danger-500)",
17
+ fontSize: "var(--sl-input-help-text-font-size-medium)",
18
+ },
19
+ FieldContainer: {
20
+ "margin-bottom": "var(--sl-spacing-large)",
21
+ },
22
+ };
23
+ const vanillaStyle = `
24
+ :host {
25
+ margin: 0 auto;
26
+ width: 100%;
27
+ display: block;
28
+ }
29
+ sl-select::part(label){
30
+ font-size: var(--sl-input-label-font-size-small);
31
+ font-weight: var(--sl-font-weight-semibold);
32
+ }
33
+ `;
34
+ JSS.jss.setup(JSS.create());
35
+ const sheet = JSS.jss.createStyleSheet(style);
36
+ const styleString = sheet.toString();
37
+ function LeadDropdownFieldView(props) {
38
+ var _a, _b, _c, _d, _e;
39
+ const { states, content } = props;
40
+ const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
41
+ console.log({ validationErrors });
42
+ const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => global.intl.formatMessage({
43
+ id: `requiredFieldErrorMessage-${dropdownLabel}`,
44
+ defaultMessage: content.requiredFieldErrorMessage,
45
+ }, {
46
+ dropdownLabel,
47
+ });
48
+ return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
49
+ index.h("style", { type: "text/css" },
50
+ vanillaStyle,
51
+ styleString),
52
+ index.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 }) => {
53
+ if (!value) {
54
+ return getRequiredFieldErrorMessage({
55
+ dropdownLabel: content.dropdownLabel,
56
+ });
57
+ }
58
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.dropdownName]) ? {
59
+ class: sheet.classes.ErrorStyle,
60
+ }
61
+ : [])), content.selectOptions),
62
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (index.h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
63
+ dropdownLabel: content.dropdownLabel,
64
+ })))));
65
+ }
66
+
67
+ exports.LeadDropdownFieldView = LeadDropdownFieldView;