@saasquatch/mint-components 1.14.6-1 → 1.14.6-11

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 (83) hide show
  1. package/dist/cjs/{ShadowViewAddon-c0a5fdf8.js → ShadowViewAddon-d1dda2b0.js} +59 -26
  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 +102 -121
  5. package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +69 -0
  6. package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +81 -0
  7. package/dist/cjs/sqm-lead-input-field-view-6344cd93.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 +166 -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 +34 -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 +65 -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 +60 -26
  18. package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +147 -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 +24 -8
  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-81771102.js} +59 -26
  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 +99 -118
  29. package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +67 -0
  30. package/dist/esm/sqm-lead-dropdown-field.entry.js +77 -0
  31. package/dist/esm/sqm-lead-input-field-view-f1dd4b77.js +49 -0
  32. package/dist/esm/sqm-lead-input-field.entry.js +80 -0
  33. package/dist/esm/sqm-stencilbook.entry.js +166 -49
  34. package/dist/esm/useLeadFormState-9016d812.js +68 -0
  35. package/dist/esm-es5/{ShadowViewAddon-aa7177fe.js → ShadowViewAddon-81771102.js} +1 -1
  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-4c85fe20.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-f1dd4b77.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-15f1ff1d.system.js +1 -0
  47. package/dist/mint-components/p-1d704c40.system.js +1 -0
  48. package/dist/mint-components/p-26da31c6.js +1 -0
  49. package/dist/mint-components/p-37996351.system.js +1 -1
  50. package/dist/mint-components/p-4056c0ea.system.entry.js +1 -0
  51. package/dist/mint-components/{p-373a92a2.js → p-460974bf.js} +3 -3
  52. package/dist/mint-components/p-4d5b02af.js +1 -0
  53. package/dist/mint-components/p-59970cb1.system.entry.js +1 -0
  54. package/dist/mint-components/p-6b093d8c.entry.js +1 -0
  55. package/dist/mint-components/p-87384d9e.system.js +1 -0
  56. package/dist/mint-components/p-8d86d7e6.system.entry.js +1 -0
  57. package/dist/mint-components/{p-72e5e84f.system.js → p-ad128614.system.js} +1 -1
  58. package/dist/mint-components/{p-8dc110b0.entry.js → p-ba585a4b.entry.js} +2 -2
  59. package/dist/mint-components/p-c5a55554.entry.js +1 -0
  60. package/dist/mint-components/p-de5356d9.system.entry.js +1 -0
  61. package/dist/mint-components/p-f98a4354.js +1 -0
  62. package/dist/mint-components/p-fa303868.entry.js +273 -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 +7 -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 +5 -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/mint-components/p-02a6e0df.system.entry.js +0 -1
  82. package/dist/mint-components/p-cde11800.system.entry.js +0 -1
  83. package/dist/mint-components/p-ede3d2f9.entry.js +0 -265
@@ -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-d1dda2b0.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,27 +1293,32 @@ 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
- mutation submitForm($formSubmissionInput: FormSubmissionInput) {
1297
+ mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
1358
1298
  submitForm(formSubmissionInput: $formSubmissionInput) {
1359
1299
  success
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) {
@@ -1452,12 +1407,14 @@ function useLeadForm(props) {
1452
1407
  errorMessage =
1453
1408
  ((_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
1409
  }
1410
+ console.log({ errors, errorMessage });
1455
1411
  return {
1456
1412
  states: {
1457
1413
  loading,
1458
1414
  error: errorMessage,
1415
+ success,
1459
1416
  leadFormState,
1460
- referralCode: "ABC123",
1417
+ referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
1461
1418
  },
1462
1419
  callbacks: {
1463
1420
  submit,
@@ -1473,13 +1430,6 @@ const LeadForm = class {
1473
1430
  constructor(hostRef) {
1474
1431
  index.registerInstance(this, hostRef);
1475
1432
  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
1433
  /**
1484
1434
  * @uiName Email field label
1485
1435
  */
@@ -1496,18 +1446,42 @@ const LeadForm = class {
1496
1446
  * @uiName Submit button text
1497
1447
  */
1498
1448
  this.submitLabel = "Submit";
1449
+ /**
1450
+ * @uiName Submit another form button label
1451
+ */
1452
+ this.resubmitFormLabel = "Refer Another Friend";
1499
1453
  /**
1500
1454
  * @uiName Header text
1501
1455
  */
1502
- this.pageLabel = "Submit your information";
1456
+ this.pageLabel = "Refer your friend";
1503
1457
  this.formKey = "lead-form";
1458
+ /**
1459
+ * Optional support link for error messages.
1460
+ */
1461
+ this.supportLink = "Support";
1462
+ /**
1463
+ * Header text shown on successful submission.
1464
+ */
1465
+ this.submitSuccessHeader = "Referral submitted";
1466
+ /**
1467
+ * Description text shown on successful submission.
1468
+ */
1469
+ 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.";
1470
+ /**
1471
+ * Header text shown when an error occurs.
1472
+ */
1473
+ this.submitErrorHeader = "An error occurred while submitting";
1474
+ /**
1475
+ * Description text shown when an error occurs.
1476
+ */
1477
+ this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
1504
1478
  /**
1505
1479
  * The message to be displayed when a required field is not filled.
1506
1480
  *
1507
1481
  * @uiName Required field message
1508
1482
  * @uiWidget textArea
1509
1483
  */
1510
- this.requiredFieldErrorMessage = "Cannot be empty";
1484
+ this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
1511
1485
  /**
1512
1486
  * The message to be displayed when a the form submission fails unexpectedly.
1513
1487
  *
@@ -1533,7 +1507,13 @@ const LeadForm = class {
1533
1507
  formData: index.h("slot", { name: "formData" }),
1534
1508
  emailLabel: this.emailLabel,
1535
1509
  submitLabel: this.submitLabel,
1510
+ resubmitFormLabel: this.resubmitFormLabel,
1536
1511
  pageLabel: this.pageLabel,
1512
+ supportLink: this.supportLink,
1513
+ submitSuccessHeader: this.submitSuccessHeader,
1514
+ submitSuccessDescription: this.submitSuccessDescription,
1515
+ submitErrorHeader: this.submitErrorHeader,
1516
+ submitErrorDescription: this.submitErrorDescription,
1537
1517
  invalidEmailErrorMessage: this.invalidEmailErrorMessage,
1538
1518
  requiredFieldErrorMessage: this.requiredFieldErrorMessage,
1539
1519
  };
@@ -1545,6 +1525,7 @@ function useRegisterDemo(props) {
1545
1525
  states: {
1546
1526
  error: "",
1547
1527
  loading: false,
1528
+ success: false,
1548
1529
  },
1549
1530
  callbacks: {
1550
1531
  submit: async (_event) => {
@@ -1855,7 +1836,7 @@ function useLeaderboardDemo(props) {
1855
1836
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
1856
1837
  }
1857
1838
 
1858
- const style$1 = {
1839
+ const style = {
1859
1840
  Container: { display: "contents" },
1860
1841
  Link: {
1861
1842
  textDecoration: "none",
@@ -1867,16 +1848,16 @@ const vanillaStyle = `
1867
1848
  display: inline;
1868
1849
  }
1869
1850
  `;
1870
- const sheet$1 = JSS.createStyleSheet(style$1);
1871
- const styleString$1 = sheet$1.toString();
1851
+ const sheet = JSS.createStyleSheet(style);
1852
+ const styleString = sheet.toString();
1872
1853
  function LinkButtonView(props) {
1873
1854
  const { onClick, buttonText } = props;
1874
- return (index.h("span", { class: sheet$1.classes.Container, part: "sqm-base" },
1855
+ return (index.h("span", { class: sheet.classes.Container, part: "sqm-base" },
1875
1856
  index.h("style", { type: "text/css" },
1876
- styleString$1,
1857
+ styleString,
1877
1858
  vanillaStyle),
1878
1859
  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))));
1860
+ index.h("a", { class: sheet.classes.Link, part: "sqm-link" }, buttonText))));
1880
1861
  }
1881
1862
 
1882
1863
  const LinkButton = class {
@@ -2057,7 +2038,7 @@ function useNavigationMenuDemo(props) {
2057
2038
  }
2058
2039
  NavigationMenu.style = sqmNavigationMenuCss;
2059
2040
 
2060
- const style$2 = {
2041
+ const style$1 = {
2061
2042
  Wrapper: {
2062
2043
  maxWidth: "200px",
2063
2044
  marginLeft: "auto",
@@ -2068,16 +2049,16 @@ const style$2 = {
2068
2049
  margin: "0",
2069
2050
  },
2070
2051
  };
2071
- const sheet$2 = JSS.createStyleSheet(style$2);
2072
- const styleString$2 = sheet$2.toString();
2052
+ const sheet$1 = JSS.createStyleSheet(style$1);
2053
+ const styleString$1 = sheet$1.toString();
2073
2054
  function PayoutButtonScrollView(props) {
2074
2055
  const { text, states } = props;
2075
2056
  if (!states.payoutSettingsComplete)
2076
2057
  return index.h("div", null);
2077
- return (index.h("div", { class: sheet$2.classes.Wrapper },
2078
- index.h("style", { type: "text/css" }, styleString$2),
2058
+ return (index.h("div", { class: sheet$1.classes.Wrapper },
2059
+ index.h("style", { type: "text/css" }, styleString$1),
2079
2060
  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)));
2061
+ index.h("p", { class: sheet$1.classes.PayoutButtonDescription }, text.payoutButtonDescription)));
2081
2062
  }
2082
2063
 
2083
2064
  const GET_PAYOUT_DETAILS = index_module.dist.gql `
@@ -2150,7 +2131,7 @@ function useDemoPayoutButtonScroll(props) {
2150
2131
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
2151
2132
  }
2152
2133
 
2153
- const style$3 = {
2134
+ const style$2 = {
2154
2135
  SkeletonOne: {
2155
2136
  width: "50%",
2156
2137
  height: "16px",
@@ -2201,8 +2182,8 @@ const style$3 = {
2201
2182
  "&::part(footer)": {},
2202
2183
  },
2203
2184
  };
2204
- const sheet$3 = JSS.createStyleSheet(style$3);
2205
- const styleString$3 = sheet$3.toString();
2185
+ const sheet$2 = JSS.createStyleSheet(style$2);
2186
+ const styleString$2 = sheet$2.toString();
2206
2187
  function PayoutStatusAlertView(props) {
2207
2188
  const { text, states, data, callbacks } = props;
2208
2189
  function getAlert(status) {
@@ -2213,7 +2194,7 @@ function PayoutStatusAlertView(props) {
2213
2194
  buttonText: null,
2214
2195
  alertType: "critical",
2215
2196
  icon: "exclamation-triangle",
2216
- class: sheet$3.classes.ErrorAlertContainer,
2197
+ class: sheet$2.classes.ErrorAlertContainer,
2217
2198
  };
2218
2199
  switch (status) {
2219
2200
  case "INFORMATION_REQUIRED":
@@ -2223,7 +2204,7 @@ function PayoutStatusAlertView(props) {
2223
2204
  buttonText: text.informationRequiredButtonText,
2224
2205
  alertType: "info",
2225
2206
  icon: "info-circle",
2226
- class: sheet$3.classes.InfoAlertContainer,
2207
+ class: sheet$2.classes.InfoAlertContainer,
2227
2208
  };
2228
2209
  case "VERIFICATION:REQUIRED":
2229
2210
  return {
@@ -2237,7 +2218,7 @@ function PayoutStatusAlertView(props) {
2237
2218
  buttonText: text.verificationRequiredButtonText,
2238
2219
  alertType: "warning",
2239
2220
  icon: "exclamation-triangle",
2240
- class: sheet$3.classes.WarningAlertContainer,
2221
+ class: sheet$2.classes.WarningAlertContainer,
2241
2222
  };
2242
2223
  case "VERIFICATION:INTERNAL":
2243
2224
  return {
@@ -2250,7 +2231,7 @@ function PayoutStatusAlertView(props) {
2250
2231
  }),
2251
2232
  alertType: "warning",
2252
2233
  icon: "exclamation-triangle",
2253
- class: sheet$3.classes.WarningAlertContainer,
2234
+ class: sheet$2.classes.WarningAlertContainer,
2254
2235
  };
2255
2236
  case "VERIFICATION:REVIEW":
2256
2237
  return {
@@ -2263,7 +2244,7 @@ function PayoutStatusAlertView(props) {
2263
2244
  }),
2264
2245
  alertType: "warning",
2265
2246
  icon: "exclamation-triangle",
2266
- class: sheet$3.classes.WarningAlertContainer,
2247
+ class: sheet$2.classes.WarningAlertContainer,
2267
2248
  };
2268
2249
  case "VERIFICATION:FAILED":
2269
2250
  return {
@@ -2276,7 +2257,7 @@ function PayoutStatusAlertView(props) {
2276
2257
  }),
2277
2258
  alertType: "critical",
2278
2259
  icon: "exclamation-octagon",
2279
- class: sheet$3.classes.ErrorAlertContainer,
2260
+ class: sheet$2.classes.ErrorAlertContainer,
2280
2261
  };
2281
2262
  case "HOLD":
2282
2263
  return {
@@ -2290,7 +2271,7 @@ function PayoutStatusAlertView(props) {
2290
2271
  buttonText: null,
2291
2272
  alertType: "warning",
2292
2273
  icon: "exclamation-triangle",
2293
- class: sheet$3.classes.WarningAlertContainer,
2274
+ class: sheet$2.classes.WarningAlertContainer,
2294
2275
  };
2295
2276
  default:
2296
2277
  return;
@@ -2309,18 +2290,18 @@ function PayoutStatusAlertView(props) {
2309
2290
  }
2310
2291
  }
2311
2292
  if (states.loading) {
2312
- return index.h("sl-skeleton", { class: sheet$3.classes.SkeletonOne });
2293
+ return index.h("sl-skeleton", { class: sheet$2.classes.SkeletonOne });
2313
2294
  }
2314
2295
  const alertDetails = getAlert(states.status);
2315
2296
  if (states.status === "DONE" || !alertDetails) {
2316
2297
  return index.h("div", null);
2317
2298
  }
2318
2299
  return (index.h("div", { part: "sqm-base" },
2319
- index.h("style", { type: "text/css" }, styleString$3),
2300
+ index.h("style", { type: "text/css" }, styleString$2),
2320
2301
  index.h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: alertDetails.alertType, class: alertDetails.class, open: true },
2321
2302
  index.h("sl-icon", { slot: "icon", name: alertDetails.icon }),
2322
2303
  index.h("strong", null, alertDetails.header),
2323
- index.h("p", { class: sheet$3.classes.AlertDescriptionText }, alertDetails.description),
2304
+ index.h("p", { class: sheet$2.classes.AlertDescriptionText }, alertDetails.description),
2324
2305
  getButton(states.status))));
2325
2306
  }
2326
2307
 
@@ -3474,7 +3455,7 @@ const ProgramMenu = class {
3474
3455
  }
3475
3456
  };
3476
3457
 
3477
- const style$4 = {
3458
+ const style$3 = {
3478
3459
  Container: {
3479
3460
  borderRadius: "var(--sl-border-radius-large)",
3480
3461
  color: "var(--sl-color-neutral-900)",
@@ -3502,15 +3483,15 @@ const style$4 = {
3502
3483
  },
3503
3484
  },
3504
3485
  };
3505
- const sheet$4 = JSS.createStyleSheet(style$4);
3506
- const styleString$4 = sheet$4.toString();
3486
+ const sheet$3 = JSS.createStyleSheet(style$3);
3487
+ const styleString$3 = sheet$3.toString();
3507
3488
  const vanillaStyle$1 = `
3508
3489
  :host{
3509
3490
  display: block;
3510
3491
  }
3511
3492
  `;
3512
3493
  function ReferralCardView(props) {
3513
- return (index.h("div", { part: "sqm-base", class: sheet$4.classes.Container, style: {
3494
+ return (index.h("div", { part: "sqm-base", class: sheet$3.classes.Container, style: {
3514
3495
  border: `${props.hideBorder ? "none" : "1px solid var(--sl-color-neutral-300)"}`,
3515
3496
  "padding-top": `var(--sl-spacing-${props.paddingTop})`,
3516
3497
  "padding-right": `var(--sl-spacing-${props.paddingRight})`,
@@ -3521,15 +3502,15 @@ function ReferralCardView(props) {
3521
3502
  margin: `${props.limitWidth ? "auto" : "none"}`,
3522
3503
  } },
3523
3504
  index.h("style", { type: "text/css" },
3524
- styleString$4,
3505
+ styleString$3,
3525
3506
  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: {
3507
+ props.hasHeader && (index.h("div", { class: sheet$3.classes.EndContainer }, props.slots.header)),
3508
+ index.h("div", { part: "sqm-column-container", class: sheet$3.classes.ColumnContainer, style: {
3528
3509
  alignItems: props.verticalAlignment,
3529
3510
  } },
3530
3511
  props.slots.left,
3531
3512
  props.slots.right),
3532
- props.hasFooter && (index.h("div", { class: sheet$4.classes.EndContainer }, props.slots.footer))));
3513
+ props.hasFooter && (index.h("div", { class: sheet$3.classes.EndContainer }, props.slots.footer))));
3533
3514
  }
3534
3515
 
3535
3516
  const ReferralCard = class {
@@ -3604,7 +3585,7 @@ const ReferralCard = class {
3604
3585
  }
3605
3586
  };
3606
3587
 
3607
- const GET_USER_DETAILS = index_module.dist.gql `
3588
+ const GET_USER_DETAILS$1 = index_module.dist.gql `
3608
3589
  query getUser($programId: ID) {
3609
3590
  viewer {
3610
3591
  ... on User {
@@ -3617,7 +3598,7 @@ function useReferralIframe(props) {
3617
3598
  var _a;
3618
3599
  const programId = index_module.H();
3619
3600
  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);
3601
+ const { data } = index_module.wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
3621
3602
  return {
3622
3603
  states: {
3623
3604
  content: props,
@@ -3653,7 +3634,7 @@ const SqmReferralIframe = class {
3653
3634
  },
3654
3635
  ]);
3655
3636
  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:" }));
3637
+ 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
3638
  }
3658
3639
  const { states, data } = index_module.isDemo()
3659
3640
  ? useReferralIframeDemo(utils.getProps(this))
@@ -5252,7 +5233,7 @@ const Gift = () => (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24
5252
5233
  const Circle = () => (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
5253
5234
  index.h("circle", { cx: "12", cy: "12", r: "9", fill: "currentColor", stroke: "currentColor", "stroke-width": "2" })));
5254
5235
 
5255
- const style$5 = {
5236
+ const style$4 = {
5256
5237
  TimelineReward: {
5257
5238
  color: "var(--sl-color-neutral-900)",
5258
5239
  lineHeight: "var(--sl-line-height-dense)",
@@ -5295,8 +5276,8 @@ const style$5 = {
5295
5276
  },
5296
5277
  },
5297
5278
  };
5298
- const sheet$5 = JSS.createStyleSheet(style$5);
5299
- const styleString$5 = sheet$5.toString();
5279
+ const sheet$4 = JSS.createStyleSheet(style$4);
5280
+ const styleString$4 = sheet$4.toString();
5300
5281
  const vanillaStyle$2 = `
5301
5282
  :host{
5302
5283
  display: block;
@@ -5309,9 +5290,9 @@ const vanillaStyle$2 = `
5309
5290
  function TimelineEntryView(props) {
5310
5291
  var _a;
5311
5292
  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" },
5293
+ return (index.h("div", { class: sheet$4.classes.TimelineReward, part: "sqm-base" },
5313
5294
  index.h("style", { type: "text/css" },
5314
- styleString$5,
5295
+ styleString$4,
5315
5296
  vanillaStyle$2),
5316
5297
  index.h("div", { class: "container", part: "sqm-entry-container" },
5317
5298
  index.h("div", { class: "line" }, "/"),
@@ -0,0 +1,69 @@
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, _f, _g;
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
+ const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => global.intl.formatMessage({
42
+ id: "requiredFieldErrorMessage",
43
+ defaultMessage: content.requiredFieldErrorMessage,
44
+ }, {
45
+ dropdownLabel,
46
+ });
47
+ return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
48
+ index.h("style", { type: "text/css" },
49
+ vanillaStyle,
50
+ styleString),
51
+ 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 }) => {
52
+ if (!value) {
53
+ return getRequiredFieldErrorMessage({
54
+ dropdownLabel: content.dropdownLabel,
55
+ });
56
+ }
57
+ } }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e.firstName) ? {
58
+ class: sheet.classes.ErrorStyle,
59
+ helpText: ((_g = (_f = states.leadFormState) === null || _f === void 0 ? void 0 : _f.validationErrors) === null || _g === void 0 ? void 0 : _g.firstName) ||
60
+ content.requiredFieldErrorMessage,
61
+ }
62
+ : [])), content.selectOptions),
63
+ (validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (index.h("p", { class: sheet.classes.ErrorMessageStyle }, global.intl.formatMessage({
64
+ id: `errorMessage-${content.dropdownName}`,
65
+ defaultMessage: content.requiredFieldErrorMessage,
66
+ })))));
67
+ }
68
+
69
+ exports.LeadDropdownFieldView = LeadDropdownFieldView;
@@ -0,0 +1,81 @@
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
+ 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
+ require('./JSS-8503a151.js');
12
+ const useLeadFormState = require('./useLeadFormState-c83d2034.js');
13
+ const sqmLeadDropdownFieldView = require('./sqm-lead-dropdown-field-view-03a3e03f.js');
14
+
15
+ function useLeadDropdownField() {
16
+ const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
17
+ return {
18
+ states: {
19
+ leadFormState,
20
+ },
21
+ };
22
+ }
23
+
24
+ const LeadDropdownField = class {
25
+ constructor(hostRef) {
26
+ index.registerInstance(this, hostRef);
27
+ this.ignored = true;
28
+ /**
29
+ * @uiName Dropdown label
30
+ */
31
+ this.dropdownLabel = "Select an option";
32
+ /**
33
+ * The message to be displayed when a required field is not filled.
34
+ *
35
+ * @uiName Required field message
36
+ * @uiWidget textArea
37
+ */
38
+ this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
39
+ /**
40
+ * @uiName Optional
41
+ * @default
42
+ */
43
+ this.dropdownOptional = false;
44
+ stencilHooks_module.h$1(this);
45
+ }
46
+ disconnectedCallback() { }
47
+ render() {
48
+ const missingProps = utils.getMissingProps([
49
+ {
50
+ attribute: "dropdown-name",
51
+ value: this.dropdownName,
52
+ },
53
+ ]);
54
+ if (!index_module.isDemo() && missingProps) {
55
+ 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)));
56
+ }
57
+ const content = {
58
+ ...utils.getProps(this),
59
+ selectOptions: index.h("slot", null),
60
+ };
61
+ const { states } = index_module.isDemo()
62
+ ? useLeadDropdownFieldDemo(this)
63
+ : useLeadDropdownField();
64
+ return (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldView, { states: states, content: content }));
65
+ }
66
+ };
67
+ function useLeadDropdownFieldDemo(props) {
68
+ return cjs.cjs({
69
+ states: {
70
+ leadFormState: {},
71
+ },
72
+ content: {
73
+ dropdownName: props.dropdownName,
74
+ dropdownLabel: props.dropdownLabel,
75
+ requiredFieldErrorMessage: props.requiredFieldErrorMessage,
76
+ dropdownOptional: props.dropdownOptional,
77
+ },
78
+ }, props.demoData || {}, { arrayMerge: (_, a) => a });
79
+ }
80
+
81
+ exports.sqm_lead_dropdown_field = LeadDropdownField;