@saasquatch/mint-components 1.14.6-3 → 1.14.6-31
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.
- package/dist/cjs/{ShadowViewAddon-40f0bc74.js → ShadowViewAddon-cfd0e201.js} +115 -48
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/{sqm-big-stat_42.cjs.entry.js → sqm-big-stat_43.cjs.entry.js} +136 -22
- package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js} +7 -7
- package/dist/cjs/sqm-lead-input-field.cjs.entry.js +12 -2
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +17 -10
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/sqm-dropdown-field/sqm-dropdown-field-view.js +1 -1
- package/dist/collection/components/sqm-lead-form/LeadForm.stories.js +5 -2
- package/dist/collection/components/sqm-lead-form/LeadFormDropdownField.stories.js +3 -0
- package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +1 -0
- package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field-view.js +8 -10
- package/dist/collection/components/sqm-lead-form/sqm-lead-dropdown-field.js +62 -2
- package/dist/collection/components/sqm-lead-form/sqm-lead-form-view.js +56 -50
- package/dist/collection/components/sqm-lead-form/sqm-lead-form.js +64 -34
- package/dist/collection/components/sqm-lead-form/sqm-lead-input-field-view.js +7 -7
- package/dist/collection/components/sqm-lead-form/sqm-lead-input-field.js +34 -3
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +32 -6
- package/dist/esm/{ShadowViewAddon-8a0d9e83.js → ShadowViewAddon-00515b50.js} +116 -50
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/{sqm-big-stat_42.entry.js → sqm-big-stat_43.entry.js} +136 -23
- package/dist/esm/{sqm-lead-input-field-view-f1dd4b77.js → sqm-lead-input-field-view-4ede5d7f.js} +7 -7
- package/dist/esm/sqm-lead-input-field.entry.js +12 -2
- package/dist/esm/sqm-stencilbook.entry.js +12 -5
- package/dist/esm-es5/ShadowViewAddon-00515b50.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -0
- package/dist/esm-es5/sqm-lead-input-field-view-4ede5d7f.js +1 -0
- package/dist/esm-es5/sqm-lead-input-field.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-01dd541f.system.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/p-6544656d.system.js +1 -0
- package/dist/mint-components/p-6ba44ca9.js +1 -0
- package/dist/mint-components/{p-cd1c6113.entry.js → p-ad24132a.entry.js} +2 -2
- package/dist/mint-components/p-c2375fad.system.entry.js +1 -0
- package/dist/mint-components/{p-e358f0c1.entry.js → p-cc9ec01e.entry.js} +28 -20
- package/dist/mint-components/p-d3144467.system.entry.js +1 -0
- package/dist/mint-components/p-d3e72503.entry.js +1 -0
- package/dist/mint-components/{p-4139feb5.js → p-eb9ecf25.js} +24 -24
- package/dist/mint-components/p-fbbb85f0.system.entry.js +1 -0
- package/dist/types/components/sqm-lead-form/LeadFormDropdownField.stories.d.ts +1 -0
- package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field-view.d.ts +3 -1
- package/dist/types/components/sqm-lead-form/sqm-lead-dropdown-field.d.ts +10 -1
- package/dist/types/components/sqm-lead-form/sqm-lead-form-view.d.ts +2 -1
- package/dist/types/components/sqm-lead-form/sqm-lead-form.d.ts +18 -9
- package/dist/types/components/sqm-lead-form/sqm-lead-input-field-view.d.ts +1 -0
- package/dist/types/components/sqm-lead-form/sqm-lead-input-field.d.ts +4 -0
- package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +2 -1
- package/dist/types/components/sqm-referral-iframe/useReferralIframe.d.ts +1 -1
- package/dist/types/components.d.ts +63 -19
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/sqm-lead-dropdown-field-view-03a3e03f.js +0 -69
- package/dist/cjs/sqm-lead-dropdown-field.cjs.entry.js +0 -75
- package/dist/esm/sqm-lead-dropdown-field-view-4c85fe20.js +0 -67
- package/dist/esm/sqm-lead-dropdown-field.entry.js +0 -71
- package/dist/esm-es5/ShadowViewAddon-8a0d9e83.js +0 -1
- package/dist/esm-es5/sqm-big-stat_42.entry.js +0 -1
- package/dist/esm-es5/sqm-lead-dropdown-field-view-4c85fe20.js +0 -1
- package/dist/esm-es5/sqm-lead-dropdown-field.entry.js +0 -1
- package/dist/esm-es5/sqm-lead-input-field-view-f1dd4b77.js +0 -1
- package/dist/mint-components/p-13c67985.system.entry.js +0 -1
- package/dist/mint-components/p-15f1ff1d.system.js +0 -1
- package/dist/mint-components/p-26da31c6.js +0 -1
- package/dist/mint-components/p-4d5b02af.js +0 -1
- package/dist/mint-components/p-87384d9e.system.js +0 -1
- package/dist/mint-components/p-875861d7.system.entry.js +0 -1
- package/dist/mint-components/p-8af8ab01.system.entry.js +0 -1
- package/dist/mint-components/p-9e1570bf.system.entry.js +0 -1
- package/dist/mint-components/p-ad6420a2.system.js +0 -1
- package/dist/mint-components/p-b8c15858.entry.js +0 -1
- package/dist/mint-components/p-f59d6012.entry.js +0 -1
|
@@ -19,13 +19,13 @@ require('./luxon-2926d85f.js');
|
|
|
19
19
|
require('./sqm-text-span-view-0aa82125.js');
|
|
20
20
|
const index$1 = require('./index-8c6255f5.js');
|
|
21
21
|
const useRegistrationFormState = require('./useRegistrationFormState-7b820f0c.js');
|
|
22
|
-
const useLeadFormState = require('./useLeadFormState-c83d2034.js');
|
|
23
22
|
const sqmPortalLoginView = require('./sqm-portal-login-view-761a4d8e.js');
|
|
24
23
|
const usePortalLogin = require('./usePortalLogin-63d896d1.js');
|
|
25
24
|
const AsYouType = require('./AsYouType-6788393a.js');
|
|
26
25
|
const utilities = require('./utilities-78f5e169.js');
|
|
27
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
26
|
+
const ShadowViewAddon = require('./ShadowViewAddon-cfd0e201.js');
|
|
28
27
|
require('./sqm-portal-container-view-4f15143a.js');
|
|
28
|
+
const useLeadFormState = require('./useLeadFormState-c83d2034.js');
|
|
29
29
|
const usePayoutStatus = require('./usePayoutStatus-feeac99b.js');
|
|
30
30
|
|
|
31
31
|
const BigStat = class {
|
|
@@ -1293,6 +1293,81 @@ function useInputFieldDemo(props) {
|
|
|
1293
1293
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1294
1294
|
}
|
|
1295
1295
|
|
|
1296
|
+
function useLeadDropdownField() {
|
|
1297
|
+
const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
|
|
1298
|
+
return {
|
|
1299
|
+
states: {
|
|
1300
|
+
leadFormState,
|
|
1301
|
+
},
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
const LeadDropdownField = class {
|
|
1306
|
+
constructor(hostRef) {
|
|
1307
|
+
index.registerInstance(this, hostRef);
|
|
1308
|
+
this.ignored = true;
|
|
1309
|
+
/**
|
|
1310
|
+
* @uiName Dropdown label
|
|
1311
|
+
*/
|
|
1312
|
+
this.dropdownLabel = "Select an option";
|
|
1313
|
+
/**
|
|
1314
|
+
* The message to be displayed when a required field is not filled.
|
|
1315
|
+
*
|
|
1316
|
+
* @uiName Required field message
|
|
1317
|
+
* @uiWidget textArea
|
|
1318
|
+
*/
|
|
1319
|
+
this.requiredFieldErrorMessage = "Please select a {dropdownLabel}";
|
|
1320
|
+
/**
|
|
1321
|
+
* @uiName Optional label
|
|
1322
|
+
*/
|
|
1323
|
+
this.optionalLabel = "(optional)";
|
|
1324
|
+
/**
|
|
1325
|
+
* @uiName Optional
|
|
1326
|
+
* @default
|
|
1327
|
+
*/
|
|
1328
|
+
this.dropdownOptional = false;
|
|
1329
|
+
/**
|
|
1330
|
+
* @uiName Multiple selection
|
|
1331
|
+
* @default
|
|
1332
|
+
*/
|
|
1333
|
+
this.multiple = false;
|
|
1334
|
+
stencilHooks_module.h$1(this);
|
|
1335
|
+
}
|
|
1336
|
+
disconnectedCallback() { }
|
|
1337
|
+
render() {
|
|
1338
|
+
const missingProps = utils.getMissingProps([
|
|
1339
|
+
{
|
|
1340
|
+
attribute: "dropdown-name",
|
|
1341
|
+
value: this.dropdownName,
|
|
1342
|
+
},
|
|
1343
|
+
]);
|
|
1344
|
+
if (!index_module.isDemo() && missingProps) {
|
|
1345
|
+
return (index.h(useLeadFormState.RequiredPropsError, { missingProps: missingProps, heading: "An error occured while loading this form", subheading: "A technical problem prevented this drop down field from loading. Please contact us with the link to this page.", description: "Values for the following attributes are missing:" }, index.h("slot", null)));
|
|
1346
|
+
}
|
|
1347
|
+
const content = {
|
|
1348
|
+
...utils.getProps(this),
|
|
1349
|
+
selectOptions: index.h("slot", null),
|
|
1350
|
+
};
|
|
1351
|
+
const { states } = index_module.isDemo()
|
|
1352
|
+
? useLeadDropdownFieldDemo(this)
|
|
1353
|
+
: useLeadDropdownField();
|
|
1354
|
+
return (index.h(ShadowViewAddon.LeadDropdownFieldView, { states: states, content: content }));
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
function useLeadDropdownFieldDemo(props) {
|
|
1358
|
+
return cjs.cjs({
|
|
1359
|
+
states: {
|
|
1360
|
+
leadFormState: {},
|
|
1361
|
+
},
|
|
1362
|
+
content: {
|
|
1363
|
+
dropdownName: props.dropdownName,
|
|
1364
|
+
dropdownLabel: props.dropdownLabel,
|
|
1365
|
+
requiredFieldErrorMessage: props.requiredFieldErrorMessage,
|
|
1366
|
+
dropdownOptional: props.dropdownOptional,
|
|
1367
|
+
},
|
|
1368
|
+
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1296
1371
|
const SUBMIT_LEAD = index_module.dist.gql `
|
|
1297
1372
|
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
1298
1373
|
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
@@ -1300,10 +1375,23 @@ const SUBMIT_LEAD = index_module.dist.gql `
|
|
|
1300
1375
|
}
|
|
1301
1376
|
}
|
|
1302
1377
|
`;
|
|
1378
|
+
const GET_USER_DETAILS = index_module.dist.gql `
|
|
1379
|
+
query getUser($programId: ID) {
|
|
1380
|
+
viewer {
|
|
1381
|
+
... on User {
|
|
1382
|
+
referralCode(programId: $programId)
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
`;
|
|
1303
1387
|
function useLeadForm(props) {
|
|
1304
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1388
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1305
1389
|
const formRef = stencilHooks_module.useRef(null);
|
|
1306
1390
|
const { leadFormState, setLeadFormState } = useLeadFormState.useLeadFormState({});
|
|
1391
|
+
const programId = index_module.H();
|
|
1392
|
+
const user = index_module.J();
|
|
1393
|
+
const { data: userDetails } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
1394
|
+
console.log({ userDetails });
|
|
1307
1395
|
const [submitLead, { loading, errors, data }] = index_module.$e(SUBMIT_LEAD);
|
|
1308
1396
|
const [success, setSuccess] = stencilHooks_module.useState(false);
|
|
1309
1397
|
stencilHooks_module.useEffect(() => {
|
|
@@ -1316,7 +1404,7 @@ function useLeadForm(props) {
|
|
|
1316
1404
|
};
|
|
1317
1405
|
}, [formRef.current]);
|
|
1318
1406
|
const submit = async (event) => {
|
|
1319
|
-
var _a
|
|
1407
|
+
var _a;
|
|
1320
1408
|
let formControls = event.target.getFormControls();
|
|
1321
1409
|
let formData = {};
|
|
1322
1410
|
let validationErrors = {};
|
|
@@ -1363,8 +1451,7 @@ function useLeadForm(props) {
|
|
|
1363
1451
|
error: "",
|
|
1364
1452
|
validationErrors: {},
|
|
1365
1453
|
});
|
|
1366
|
-
|
|
1367
|
-
if ((_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.submitForm) === null || _b === void 0 ? void 0 : _b.success) {
|
|
1454
|
+
if ((_a = result === null || result === void 0 ? void 0 : result.submitForm) === null || _a === void 0 ? void 0 : _a.success) {
|
|
1368
1455
|
setSuccess(true);
|
|
1369
1456
|
}
|
|
1370
1457
|
}
|
|
@@ -1384,6 +1471,18 @@ function useLeadForm(props) {
|
|
|
1384
1471
|
const asYouType = new AsYouType.AsYouType("US");
|
|
1385
1472
|
e.target.value = asYouType.input(e.target.value);
|
|
1386
1473
|
}, []);
|
|
1474
|
+
function resetForm() {
|
|
1475
|
+
var _a, _b;
|
|
1476
|
+
setLeadFormState({
|
|
1477
|
+
loading: false,
|
|
1478
|
+
error: "",
|
|
1479
|
+
validationErrors: {},
|
|
1480
|
+
});
|
|
1481
|
+
(_b = (_a = formRef.current) === null || _a === void 0 ? void 0 : _a.getFormControls()) === null || _b === void 0 ? void 0 : _b.forEach((c) => {
|
|
1482
|
+
c.value = "";
|
|
1483
|
+
});
|
|
1484
|
+
setSuccess(false);
|
|
1485
|
+
}
|
|
1387
1486
|
let errorMessage = "";
|
|
1388
1487
|
if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
|
|
1389
1488
|
errorMessage = props.networkErrorMessage;
|
|
@@ -1395,17 +1494,19 @@ function useLeadForm(props) {
|
|
|
1395
1494
|
errorMessage =
|
|
1396
1495
|
((_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);
|
|
1397
1496
|
}
|
|
1497
|
+
console.log({ errors, errorMessage });
|
|
1398
1498
|
return {
|
|
1399
1499
|
states: {
|
|
1400
1500
|
loading,
|
|
1401
1501
|
error: errorMessage,
|
|
1402
1502
|
success,
|
|
1403
1503
|
leadFormState,
|
|
1404
|
-
referralCode: "
|
|
1504
|
+
referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
|
|
1405
1505
|
},
|
|
1406
1506
|
callbacks: {
|
|
1407
1507
|
submit,
|
|
1408
1508
|
inputFunction,
|
|
1509
|
+
resetForm,
|
|
1409
1510
|
},
|
|
1410
1511
|
refs: {
|
|
1411
1512
|
formRef,
|
|
@@ -1424,11 +1525,11 @@ const LeadForm = class {
|
|
|
1424
1525
|
/**
|
|
1425
1526
|
* @uiName First Name field label
|
|
1426
1527
|
*/
|
|
1427
|
-
this.firstNameLabel = "First
|
|
1528
|
+
this.firstNameLabel = "First name";
|
|
1428
1529
|
/**
|
|
1429
1530
|
* @uiName Last Name field label
|
|
1430
1531
|
*/
|
|
1431
|
-
this.lastNameLabel = "Last
|
|
1532
|
+
this.lastNameLabel = "Last name";
|
|
1432
1533
|
/**
|
|
1433
1534
|
* @uiName Submit button text
|
|
1434
1535
|
*/
|
|
@@ -1441,43 +1542,52 @@ const LeadForm = class {
|
|
|
1441
1542
|
* @uiName Header text
|
|
1442
1543
|
*/
|
|
1443
1544
|
this.pageLabel = "Refer your friend";
|
|
1545
|
+
/**
|
|
1546
|
+
* Key of the form to connect to. Create and manage forms in the /advocate dashboard under Data > Forms.
|
|
1547
|
+
* @uiName Form key
|
|
1548
|
+
*/
|
|
1444
1549
|
this.formKey = "lead-form";
|
|
1445
1550
|
/**
|
|
1446
|
-
* Optional support link for error messages.
|
|
1551
|
+
* Optional support link text for error messages.
|
|
1552
|
+
* @uiName Support link text
|
|
1447
1553
|
*/
|
|
1448
|
-
this.
|
|
1554
|
+
this.supportLinkText = "Support";
|
|
1449
1555
|
/**
|
|
1450
|
-
* Header text shown on successful submission.
|
|
1556
|
+
* Header text shown on successful lead submission.
|
|
1557
|
+
* @uiName Submit success header
|
|
1451
1558
|
*/
|
|
1452
|
-
this.submitSuccessHeader = "
|
|
1559
|
+
this.submitSuccessHeader = "Lead submitted";
|
|
1453
1560
|
/**
|
|
1454
|
-
* Description text shown on successful submission.
|
|
1561
|
+
* Description text shown on successful lead submission.
|
|
1562
|
+
* @uiName Submit success description
|
|
1455
1563
|
*/
|
|
1456
1564
|
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.";
|
|
1457
1565
|
/**
|
|
1458
|
-
*
|
|
1566
|
+
* Header text shown if an error occurs.
|
|
1567
|
+
* @uiName Submit error header
|
|
1459
1568
|
*/
|
|
1460
1569
|
this.submitErrorHeader = "An error occurred while submitting";
|
|
1461
1570
|
/**
|
|
1462
|
-
* Description text shown
|
|
1571
|
+
* Description text shown if an error occurs.
|
|
1572
|
+
* @uiName Submit error description
|
|
1463
1573
|
*/
|
|
1464
1574
|
this.submitErrorDescription = "Please try again later. If the problem continues, contact {supportLink}";
|
|
1465
1575
|
/**
|
|
1466
|
-
* The message to be displayed
|
|
1576
|
+
* The message to be displayed if a required field is not filled.
|
|
1467
1577
|
*
|
|
1468
1578
|
* @uiName Required field message
|
|
1469
1579
|
* @uiWidget textArea
|
|
1470
1580
|
*/
|
|
1471
1581
|
this.requiredFieldErrorMessage = "Please enter a valid {fieldLabel}";
|
|
1472
1582
|
/**
|
|
1473
|
-
* The message to be displayed
|
|
1583
|
+
* The message to be displayed if a the form submission fails unexpectedly.
|
|
1474
1584
|
*
|
|
1475
1585
|
* @uiName Network error message
|
|
1476
1586
|
* @uiWidget textArea
|
|
1477
1587
|
*/
|
|
1478
1588
|
this.networkErrorMessage = "Network request failed.";
|
|
1479
1589
|
/**
|
|
1480
|
-
* The message to be displayed
|
|
1590
|
+
* The message to be displayed if the email used is invalid.
|
|
1481
1591
|
*
|
|
1482
1592
|
* @uiName Invalid email message
|
|
1483
1593
|
* @uiWidget textArea
|
|
@@ -1496,13 +1606,15 @@ const LeadForm = class {
|
|
|
1496
1606
|
submitLabel: this.submitLabel,
|
|
1497
1607
|
resubmitFormLabel: this.resubmitFormLabel,
|
|
1498
1608
|
pageLabel: this.pageLabel,
|
|
1499
|
-
|
|
1609
|
+
supportLinkText: this.supportLinkText,
|
|
1500
1610
|
submitSuccessHeader: this.submitSuccessHeader,
|
|
1501
1611
|
submitSuccessDescription: this.submitSuccessDescription,
|
|
1502
1612
|
submitErrorHeader: this.submitErrorHeader,
|
|
1503
1613
|
submitErrorDescription: this.submitErrorDescription,
|
|
1504
1614
|
invalidEmailErrorMessage: this.invalidEmailErrorMessage,
|
|
1505
1615
|
requiredFieldErrorMessage: this.requiredFieldErrorMessage,
|
|
1616
|
+
firstNameLabel: this.firstNameLabel,
|
|
1617
|
+
lastNameLabel: this.lastNameLabel,
|
|
1506
1618
|
};
|
|
1507
1619
|
return (index.h(ShadowViewAddon.LeadFormView, { states: states, callbacks: callbacks, content: content, refs: refs }));
|
|
1508
1620
|
}
|
|
@@ -1519,6 +1631,7 @@ function useRegisterDemo(props) {
|
|
|
1519
1631
|
console.log("submit");
|
|
1520
1632
|
},
|
|
1521
1633
|
inputFunction: () => { },
|
|
1634
|
+
resetForm: () => { },
|
|
1522
1635
|
},
|
|
1523
1636
|
refs: {
|
|
1524
1637
|
formRef: {},
|
|
@@ -3572,7 +3685,7 @@ const ReferralCard = class {
|
|
|
3572
3685
|
}
|
|
3573
3686
|
};
|
|
3574
3687
|
|
|
3575
|
-
const GET_USER_DETAILS = index_module.dist.gql `
|
|
3688
|
+
const GET_USER_DETAILS$1 = index_module.dist.gql `
|
|
3576
3689
|
query getUser($programId: ID) {
|
|
3577
3690
|
viewer {
|
|
3578
3691
|
... on User {
|
|
@@ -3585,7 +3698,7 @@ function useReferralIframe(props) {
|
|
|
3585
3698
|
var _a;
|
|
3586
3699
|
const programId = index_module.H();
|
|
3587
3700
|
const user = index_module.J();
|
|
3588
|
-
const { data } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
3701
|
+
const { data } = index_module.wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
3589
3702
|
return {
|
|
3590
3703
|
states: {
|
|
3591
3704
|
content: props,
|
|
@@ -5383,6 +5496,7 @@ exports.sqm_hero_image = HeroImage;
|
|
|
5383
5496
|
exports.sqm_hook_story_container = SqmHookStoryContainer;
|
|
5384
5497
|
exports.sqm_image = Image;
|
|
5385
5498
|
exports.sqm_input_field = InputField;
|
|
5499
|
+
exports.sqm_lead_dropdown_field = LeadDropdownField;
|
|
5386
5500
|
exports.sqm_lead_form = LeadForm;
|
|
5387
5501
|
exports.sqm_leaderboard = Leaderboard;
|
|
5388
5502
|
exports.sqm_link_button = LinkButton;
|
package/dist/cjs/{sqm-lead-input-field-view-6344cd93.js → sqm-lead-input-field-view-89308aab.js}
RENAMED
|
@@ -8,7 +8,7 @@ const mixins = require('./mixins-f7e0377a.js');
|
|
|
8
8
|
const style = {
|
|
9
9
|
ErrorStyle: mixins.ErrorStyles,
|
|
10
10
|
FieldContainer: {
|
|
11
|
-
"margin-bottom": "var(--sl-spacing-
|
|
11
|
+
"margin-bottom": "var(--sl-spacing-medium)",
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
14
|
const vanillaStyle = `
|
|
@@ -25,24 +25,24 @@ function LeadInputFieldView(props) {
|
|
|
25
25
|
var _a, _b, _c, _d, _e, _f;
|
|
26
26
|
const { states, content } = props;
|
|
27
27
|
const getRequiredFieldErrorMessage = ({ fieldLabel, }) => global.intl.formatMessage({
|
|
28
|
-
id:
|
|
28
|
+
id: `requiredFieldErrorMessage-${fieldLabel}`,
|
|
29
29
|
defaultMessage: content.requiredFieldErrorMessage,
|
|
30
30
|
}, {
|
|
31
31
|
fieldLabel,
|
|
32
32
|
});
|
|
33
|
-
return (index.h("div", { part: "sqm-base" },
|
|
33
|
+
return (index.h("div", { class: sheet.classes.FieldContainer, part: "sqm-base" },
|
|
34
34
|
index.h("style", { type: "text/css" },
|
|
35
35
|
vanillaStyle,
|
|
36
36
|
styleString),
|
|
37
|
-
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: content.fieldLabel }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
|
|
38
|
-
if (!value) {
|
|
37
|
+
index.h("sl-input", Object.assign({ exportparts: "label: input-label, base: input-base", name: `/${content.fieldName}`, type: content.fieldType, label: `${content.fieldLabel}${content.fieldOptional ? ` ${content.optionalLabel}` : ""}` }, (!content.fieldOptional ? { required: true } : []), { disabled: ((_a = states.leadFormState) === null || _a === void 0 ? void 0 : _a.loading) || ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.disabled), validationError: ({ value }) => {
|
|
38
|
+
if (!value && !content.fieldOptional) {
|
|
39
39
|
return getRequiredFieldErrorMessage({
|
|
40
40
|
fieldLabel: content.fieldLabel,
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
} }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d.
|
|
43
|
+
} }, (((_d = (_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.validationErrors) === null || _d === void 0 ? void 0 : _d[content.fieldName]) ? {
|
|
44
44
|
class: sheet.classes.ErrorStyle,
|
|
45
|
-
helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f.
|
|
45
|
+
helpText: ((_f = (_e = states.leadFormState) === null || _e === void 0 ? void 0 : _e.validationErrors) === null || _f === void 0 ? void 0 : _f[content.fieldName]) ||
|
|
46
46
|
content.requiredFieldErrorMessage,
|
|
47
47
|
}
|
|
48
48
|
: [])))));
|
|
@@ -10,8 +10,8 @@ const cjs = require('./cjs-1066ec21.js');
|
|
|
10
10
|
const utils = require('./utils-6847bc06.js');
|
|
11
11
|
require('./JSS-8503a151.js');
|
|
12
12
|
require('./mixins-f7e0377a.js');
|
|
13
|
+
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
|
|
13
14
|
const useLeadFormState = require('./useLeadFormState-c83d2034.js');
|
|
14
|
-
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-6344cd93.js');
|
|
15
15
|
|
|
16
16
|
function useLeadInputField() {
|
|
17
17
|
const leadFormState = stencilHooks_module.d(useLeadFormState.LEAD_FORM_STATE_CONTEXT);
|
|
@@ -26,6 +26,10 @@ const LeadInputField = class {
|
|
|
26
26
|
constructor(hostRef) {
|
|
27
27
|
index.registerInstance(this, hostRef);
|
|
28
28
|
this.ignored = true;
|
|
29
|
+
/**
|
|
30
|
+
* @uiName Optional label
|
|
31
|
+
*/
|
|
32
|
+
this.optionalLabel = "(optional)";
|
|
29
33
|
/**
|
|
30
34
|
* @uiName Input type
|
|
31
35
|
* @uiType string
|
|
@@ -39,7 +43,7 @@ const LeadInputField = class {
|
|
|
39
43
|
* @uiName Required field message
|
|
40
44
|
* @uiWidget textArea
|
|
41
45
|
*/
|
|
42
|
-
this.requiredFieldErrorMessage = "Please enter a {
|
|
46
|
+
this.requiredFieldErrorMessage = "Please enter a {fieldLabel}";
|
|
43
47
|
/**
|
|
44
48
|
* @uiName Optional
|
|
45
49
|
* @default
|
|
@@ -72,6 +76,12 @@ function useLeadInputFieldDemo(props) {
|
|
|
72
76
|
states: {
|
|
73
77
|
leadForState: {},
|
|
74
78
|
},
|
|
79
|
+
content: {
|
|
80
|
+
fieldName: props.fieldName,
|
|
81
|
+
fieldLabel: props.fieldLabel,
|
|
82
|
+
fieldType: props.fieldType,
|
|
83
|
+
requiredFieldErrorMessage: props.requiredFieldErrorMessage,
|
|
84
|
+
},
|
|
75
85
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
76
86
|
}
|
|
77
87
|
|
|
@@ -20,7 +20,6 @@ const sqmAssetCardView = require('./sqm-asset-card-view-21ddf04f.js');
|
|
|
20
20
|
const sqmCloseButtonView = require('./sqm-close-button-view-ea3fa23b.js');
|
|
21
21
|
require('./index-8c6255f5.js');
|
|
22
22
|
const emailRegistrationView = require('./email-registration-view-55b378dc.js');
|
|
23
|
-
const sqmLeadDropdownFieldView = require('./sqm-lead-dropdown-field-view-03a3e03f.js');
|
|
24
23
|
const sqmLeaderboardRankView = require('./sqm-leaderboard-rank-view-d39a55d8.js');
|
|
25
24
|
const sqmLogoutCurrentUserView = require('./sqm-logout-current-user-view-11d57c12.js');
|
|
26
25
|
const sqmNavigationSidebarView = require('./sqm-navigation-sidebar-view-17111896.js');
|
|
@@ -36,10 +35,10 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-fe6
|
|
|
36
35
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7b678f34.js');
|
|
37
36
|
require('./ErrorView-b2fcf954.js');
|
|
38
37
|
const sqmQrCodeView = require('./sqm-qr-code-view-15dfc0b6.js');
|
|
39
|
-
const ShadowViewAddon = require('./ShadowViewAddon-
|
|
38
|
+
const ShadowViewAddon = require('./ShadowViewAddon-cfd0e201.js');
|
|
40
39
|
const sqmPortalContainerView = require('./sqm-portal-container-view-4f15143a.js');
|
|
41
40
|
const sqmInvoiceTableView = require('./sqm-invoice-table-view-0f7fa309.js');
|
|
42
|
-
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-
|
|
41
|
+
const sqmLeadInputFieldView = require('./sqm-lead-input-field-view-89308aab.js');
|
|
43
42
|
|
|
44
43
|
/**
|
|
45
44
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -15847,6 +15846,7 @@ const defaultProps$t = {
|
|
|
15847
15846
|
callbacks: {
|
|
15848
15847
|
submit: () => console.log("Submit!"),
|
|
15849
15848
|
inputFunction: () => { },
|
|
15849
|
+
resetForm: () => { },
|
|
15850
15850
|
},
|
|
15851
15851
|
refs: {
|
|
15852
15852
|
formRef: {},
|
|
@@ -15901,8 +15901,10 @@ const slottedProps$2 = {
|
|
|
15901
15901
|
content: {
|
|
15902
15902
|
...defaultProps$t.content,
|
|
15903
15903
|
formData: (index.h("div", null,
|
|
15904
|
-
index.h("
|
|
15905
|
-
index.h("
|
|
15904
|
+
index.h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
|
|
15905
|
+
index.h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
|
|
15906
|
+
index.h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
|
|
15907
|
+
index.h("sqm-lead-dropdown-field", null))),
|
|
15906
15908
|
},
|
|
15907
15909
|
};
|
|
15908
15910
|
const Default$r = () => index.h(ShadowViewAddon.LeadFormView, Object.assign({}, defaultProps$t));
|
|
@@ -15949,6 +15951,7 @@ const defaultProps$u = {
|
|
|
15949
15951
|
fieldName: "firstName",
|
|
15950
15952
|
fieldLabel: "First Name",
|
|
15951
15953
|
fieldType: "text",
|
|
15954
|
+
optionalLabel: "(Optional)",
|
|
15952
15955
|
requiredFieldErrorMessage: "Please {fieldAction} a {fieldLabel}",
|
|
15953
15956
|
fieldOptional: false,
|
|
15954
15957
|
},
|
|
@@ -16005,7 +16008,9 @@ const defaultProps$v = {
|
|
|
16005
16008
|
dropdownName: "country",
|
|
16006
16009
|
dropdownLabel: "Country",
|
|
16007
16010
|
requiredFieldErrorMessage: "Please select a country",
|
|
16011
|
+
optionalLabel: "(Optional)",
|
|
16008
16012
|
dropdownOptional: false,
|
|
16013
|
+
multiple: false,
|
|
16009
16014
|
selectOptions: [
|
|
16010
16015
|
index.h("sl-menu-item", { value: "red" }, "Canada"),
|
|
16011
16016
|
index.h("sl-menu-item", { value: "blue" }, "United States"),
|
|
@@ -16013,8 +16018,9 @@ const defaultProps$v = {
|
|
|
16013
16018
|
],
|
|
16014
16019
|
},
|
|
16015
16020
|
};
|
|
16016
|
-
const Default$t = () => index.h(
|
|
16017
|
-
const
|
|
16021
|
+
const Default$t = () => index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v));
|
|
16022
|
+
const Multiple = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { content: { ...defaultProps$v.content, multiple: true } })));
|
|
16023
|
+
const WithError$1 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
|
|
16018
16024
|
...defaultProps$v.states,
|
|
16019
16025
|
leadFormState: {
|
|
16020
16026
|
...defaultProps$v.states.leadFormState,
|
|
@@ -16023,21 +16029,21 @@ const WithError$1 = () => (index.h(sqmLeadDropdownFieldView.LeadDropdownFieldVie
|
|
|
16023
16029
|
},
|
|
16024
16030
|
},
|
|
16025
16031
|
} })));
|
|
16026
|
-
const Disabled$3 = () => (index.h(
|
|
16032
|
+
const Disabled$3 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
|
|
16027
16033
|
...defaultProps$v.states,
|
|
16028
16034
|
leadFormState: {
|
|
16029
16035
|
...defaultProps$v.states.leadFormState,
|
|
16030
16036
|
disabled: true,
|
|
16031
16037
|
},
|
|
16032
16038
|
} })));
|
|
16033
|
-
const Loading$d = () => (index.h(
|
|
16039
|
+
const Loading$d = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
|
|
16034
16040
|
...defaultProps$v.states,
|
|
16035
16041
|
leadFormState: {
|
|
16036
16042
|
...defaultProps$v.states.leadFormState,
|
|
16037
16043
|
loading: true,
|
|
16038
16044
|
},
|
|
16039
16045
|
} })));
|
|
16040
|
-
const WithInitialValue$1 = () => (index.h(
|
|
16046
|
+
const WithInitialValue$1 = () => (index.h(ShadowViewAddon.LeadDropdownFieldView, Object.assign({}, defaultProps$v, { states: {
|
|
16041
16047
|
...defaultProps$v.states,
|
|
16042
16048
|
leadFormState: {
|
|
16043
16049
|
...defaultProps$v.states.leadFormState,
|
|
@@ -16051,6 +16057,7 @@ const LeadFormDropdownField = /*#__PURE__*/Object.freeze({
|
|
|
16051
16057
|
__proto__: null,
|
|
16052
16058
|
'default': LeadFormDropdownField_stories,
|
|
16053
16059
|
Default: Default$t,
|
|
16060
|
+
Multiple: Multiple,
|
|
16054
16061
|
WithError: WithError$1,
|
|
16055
16062
|
Disabled: Disabled$3,
|
|
16056
16063
|
Loading: Loading$d,
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"./components/sqm-invoice-table/columns/sqm-invoice-table-date-column.js",
|
|
44
44
|
"./components/sqm-invoice-table/columns/sqm-invoice-table-download-column.js",
|
|
45
45
|
"./components/sqm-lead-form/sqm-lead-dropdown-field.js",
|
|
46
|
+
"./components/sqm-referral-iframe/sqm-referral-iframe.js",
|
|
46
47
|
"./components/sqm-lead-form/sqm-lead-form.js",
|
|
47
48
|
"./components/sqm-lead-form/sqm-lead-input-field.js",
|
|
48
49
|
"./components/sqm-leaderboard/sqm-leaderboard.js",
|
|
@@ -78,7 +79,6 @@
|
|
|
78
79
|
"./components/sqm-qr-code/sqm-qr-code.js",
|
|
79
80
|
"./components/sqm-referral-card/sqm-referral-card.js",
|
|
80
81
|
"./components/sqm-referral-code/sqm-referral-code.js",
|
|
81
|
-
"./components/sqm-referral-iframe/sqm-referral-iframe.js",
|
|
82
82
|
"./components/sqm-referral-table/cells/sqm-referral-table-cell.js",
|
|
83
83
|
"./components/sqm-referral-table/cells/sqm-referral-table-date-cell.js",
|
|
84
84
|
"./components/sqm-referral-table/cells/sqm-referral-table-rewards-cell.js",
|
|
@@ -14,6 +14,7 @@ const defaultProps = {
|
|
|
14
14
|
callbacks: {
|
|
15
15
|
submit: () => console.log("Submit!"),
|
|
16
16
|
inputFunction: () => { },
|
|
17
|
+
resetForm: () => { },
|
|
17
18
|
},
|
|
18
19
|
refs: {
|
|
19
20
|
formRef: {},
|
|
@@ -68,8 +69,10 @@ const slottedProps = {
|
|
|
68
69
|
content: {
|
|
69
70
|
...defaultProps.content,
|
|
70
71
|
formData: (h("div", null,
|
|
71
|
-
h("
|
|
72
|
-
h("
|
|
72
|
+
h("sqm-lead-input-field", { "field-name": "firstName", "field-label": "First Name", "field-type": "text", "required-field-error-message": "Please enter a first name" }),
|
|
73
|
+
h("sqm-lead-input-field", { "field-name": "lastName", "field-label": "Last Name", "field-type": "text", "required-field-error-message": "Please enter a last name" }),
|
|
74
|
+
h("sqm-lead-input-field", { "field-name": "email", "field-label": "Email", "field-type": "email", "required-field-error-message": "Please enter a valid email address" }),
|
|
75
|
+
h("sqm-lead-dropdown-field", null))),
|
|
73
76
|
},
|
|
74
77
|
};
|
|
75
78
|
export const Default = () => h(LeadFormView, Object.assign({}, defaultProps));
|
|
@@ -16,7 +16,9 @@ const defaultProps = {
|
|
|
16
16
|
dropdownName: "country",
|
|
17
17
|
dropdownLabel: "Country",
|
|
18
18
|
requiredFieldErrorMessage: "Please select a country",
|
|
19
|
+
optionalLabel: "(Optional)",
|
|
19
20
|
dropdownOptional: false,
|
|
21
|
+
multiple: false,
|
|
20
22
|
selectOptions: [
|
|
21
23
|
h("sl-menu-item", { value: "red" }, "Canada"),
|
|
22
24
|
h("sl-menu-item", { value: "blue" }, "United States"),
|
|
@@ -25,6 +27,7 @@ const defaultProps = {
|
|
|
25
27
|
},
|
|
26
28
|
};
|
|
27
29
|
export const Default = () => h(LeadDropdownFieldView, Object.assign({}, defaultProps));
|
|
30
|
+
export const Multiple = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { content: { ...defaultProps.content, multiple: true } })));
|
|
28
31
|
export const WithError = () => (h(LeadDropdownFieldView, Object.assign({}, defaultProps, { states: {
|
|
29
32
|
...defaultProps.states,
|
|
30
33
|
leadFormState: {
|
|
@@ -33,11 +33,12 @@ jss.setup(preset());
|
|
|
33
33
|
const sheet = jss.createStyleSheet(style);
|
|
34
34
|
const styleString = sheet.toString();
|
|
35
35
|
export function LeadDropdownFieldView(props) {
|
|
36
|
-
var _a, _b, _c, _d, _e
|
|
36
|
+
var _a, _b, _c, _d, _e;
|
|
37
37
|
const { states, content } = props;
|
|
38
38
|
const validationErrors = (_a = states === null || states === void 0 ? void 0 : states.leadFormState) === null || _a === void 0 ? void 0 : _a.validationErrors;
|
|
39
|
+
console.log({ validationErrors });
|
|
39
40
|
const getRequiredFieldErrorMessage = ({ dropdownLabel, }) => intl.formatMessage({
|
|
40
|
-
id:
|
|
41
|
+
id: `requiredFieldErrorMessage-${dropdownLabel}`,
|
|
41
42
|
defaultMessage: content.requiredFieldErrorMessage,
|
|
42
43
|
}, {
|
|
43
44
|
dropdownLabel,
|
|
@@ -46,20 +47,17 @@ export function LeadDropdownFieldView(props) {
|
|
|
46
47
|
h("style", { type: "text/css" },
|
|
47
48
|
vanillaStyle,
|
|
48
49
|
styleString),
|
|
49
|
-
h("sl-select", Object.assign({ exportparts: "label: input-label, base: input-base", label: content.dropdownLabel
|
|
50
|
-
if (!value) {
|
|
50
|
+
h("sl-select", Object.assign({ exportparts: "label: input-label, base: input-base", label: `${content.dropdownLabel}${content.dropdownOptional ? ` ${content.optionalLabel}` : ""}`, name: `/${content.dropdownName}`, multiple: content.multiple }, (!content.dropdownOptional ? { required: true } : []), { disabled: ((_b = states.leadFormState) === null || _b === void 0 ? void 0 : _b.loading) || ((_c = states.leadFormState) === null || _c === void 0 ? void 0 : _c.disabled), validationError: ({ value }) => {
|
|
51
|
+
if (!value && !content.dropdownOptional) {
|
|
51
52
|
return getRequiredFieldErrorMessage({
|
|
52
53
|
dropdownLabel: content.dropdownLabel,
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
|
-
} }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e.
|
|
56
|
+
} }, (((_e = (_d = states.leadFormState) === null || _d === void 0 ? void 0 : _d.validationErrors) === null || _e === void 0 ? void 0 : _e[content.dropdownName]) ? {
|
|
56
57
|
class: sheet.classes.ErrorStyle,
|
|
57
|
-
helpText: ((_g = (_f = states.leadFormState) === null || _f === void 0 ? void 0 : _f.validationErrors) === null || _g === void 0 ? void 0 : _g.firstName) ||
|
|
58
|
-
content.requiredFieldErrorMessage,
|
|
59
58
|
}
|
|
60
59
|
: [])), content.selectOptions),
|
|
61
|
-
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle },
|
|
62
|
-
|
|
63
|
-
defaultMessage: content.requiredFieldErrorMessage,
|
|
60
|
+
(validationErrors === null || validationErrors === void 0 ? void 0 : validationErrors[content.dropdownName]) && (h("p", { class: sheet.classes.ErrorMessageStyle }, getRequiredFieldErrorMessage({
|
|
61
|
+
dropdownLabel: content.dropdownLabel,
|
|
64
62
|
})))));
|
|
65
63
|
}
|