@saasquatch/mint-components 1.14.6-6 → 1.14.6-7
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/sqm-big-stat_42.cjs.entry.js +40 -29
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +0 -1
- package/dist/collection/components/sqm-lead-form/LeadInputField.stories.js +0 -1
- package/dist/collection/components/sqm-lead-form/useLeadForm.js +19 -9
- package/dist/esm/sqm-big-stat_42.entry.js +40 -29
- package/dist/esm/sqm-stencilbook.entry.js +0 -1
- package/dist/esm-es5/sqm-big-stat_42.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-9e9953a8.entry.js → p-2ccebe27.entry.js} +29 -21
- package/dist/mint-components/p-36ef6219.system.entry.js +1 -0
- package/dist/mint-components/p-37996351.system.js +1 -1
- package/dist/mint-components/{p-a7f1974f.system.entry.js → p-8af8ab01.system.entry.js} +1 -1
- package/dist/mint-components/{p-21e6721e.entry.js → p-cd1c6113.entry.js} +1 -1
- package/dist/types/components/sqm-lead-form/useLeadForm.d.ts +1 -1
- package/dist/types/global/android.d.ts +7 -0
- package/dist/types/global/demo.d.ts +2 -0
- package/dist/types/stories/features.d.ts +4 -0
- package/dist/types/stories/templates.d.ts +4 -0
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/mint-components/p-f17bad5d.system.entry.js +0 -1
|
@@ -1293,6 +1293,13 @@ function useInputFieldDemo(props) {
|
|
|
1293
1293
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1294
1294
|
}
|
|
1295
1295
|
|
|
1296
|
+
const SUBMIT_LEAD = index_module.dist.gql `
|
|
1297
|
+
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
1298
|
+
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
1299
|
+
success
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
`;
|
|
1296
1303
|
const GET_USER_DETAILS = index_module.dist.gql `
|
|
1297
1304
|
query getUser($programId: ID) {
|
|
1298
1305
|
viewer {
|
|
@@ -1302,34 +1309,14 @@ const GET_USER_DETAILS = index_module.dist.gql `
|
|
|
1302
1309
|
}
|
|
1303
1310
|
}
|
|
1304
1311
|
`;
|
|
1305
|
-
function useReferralIframe(props) {
|
|
1306
|
-
var _a;
|
|
1307
|
-
const programId = index_module.H();
|
|
1308
|
-
const user = index_module.J();
|
|
1309
|
-
const { data } = index_module.wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
1310
|
-
return {
|
|
1311
|
-
states: {
|
|
1312
|
-
content: props,
|
|
1313
|
-
},
|
|
1314
|
-
data: {
|
|
1315
|
-
shareCode: (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.referralCode,
|
|
1316
|
-
},
|
|
1317
|
-
};
|
|
1318
|
-
}
|
|
1319
|
-
|
|
1320
|
-
const SUBMIT_LEAD = index_module.dist.gql `
|
|
1321
|
-
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
1322
|
-
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
1323
|
-
success
|
|
1324
|
-
}
|
|
1325
|
-
}
|
|
1326
|
-
`;
|
|
1327
1312
|
function useLeadForm(props) {
|
|
1328
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
1313
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1329
1314
|
const formRef = stencilHooks_module.useRef(null);
|
|
1330
1315
|
const { leadFormState, setLeadFormState } = useLeadFormState.useLeadFormState({});
|
|
1331
|
-
const
|
|
1332
|
-
|
|
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 });
|
|
1333
1320
|
const [submitLead, { loading, errors, data }] = index_module.$e(SUBMIT_LEAD);
|
|
1334
1321
|
const [success, setSuccess] = stencilHooks_module.useState(false);
|
|
1335
1322
|
stencilHooks_module.useEffect(() => {
|
|
@@ -1414,15 +1401,15 @@ function useLeadForm(props) {
|
|
|
1414
1401
|
e.target.value = asYouType.input(e.target.value);
|
|
1415
1402
|
}, []);
|
|
1416
1403
|
let errorMessage = "";
|
|
1417
|
-
if ((
|
|
1404
|
+
if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
|
|
1418
1405
|
errorMessage = props.networkErrorMessage;
|
|
1419
1406
|
}
|
|
1420
|
-
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((
|
|
1407
|
+
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors.length)) {
|
|
1421
1408
|
errorMessage = props.networkErrorMessage;
|
|
1422
1409
|
}
|
|
1423
1410
|
else {
|
|
1424
1411
|
errorMessage =
|
|
1425
|
-
((
|
|
1412
|
+
((_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);
|
|
1426
1413
|
}
|
|
1427
1414
|
return {
|
|
1428
1415
|
states: {
|
|
@@ -1430,7 +1417,7 @@ function useLeadForm(props) {
|
|
|
1430
1417
|
error: errorMessage,
|
|
1431
1418
|
success,
|
|
1432
1419
|
leadFormState,
|
|
1433
|
-
referralCode,
|
|
1420
|
+
referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
|
|
1434
1421
|
},
|
|
1435
1422
|
callbacks: {
|
|
1436
1423
|
submit,
|
|
@@ -3601,6 +3588,30 @@ const ReferralCard = class {
|
|
|
3601
3588
|
}
|
|
3602
3589
|
};
|
|
3603
3590
|
|
|
3591
|
+
const GET_USER_DETAILS$1 = index_module.dist.gql `
|
|
3592
|
+
query getUser($programId: ID) {
|
|
3593
|
+
viewer {
|
|
3594
|
+
... on User {
|
|
3595
|
+
referralCode(programId: $programId)
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
}
|
|
3599
|
+
`;
|
|
3600
|
+
function useReferralIframe(props) {
|
|
3601
|
+
var _a;
|
|
3602
|
+
const programId = index_module.H();
|
|
3603
|
+
const user = index_module.J();
|
|
3604
|
+
const { data } = index_module.wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
3605
|
+
return {
|
|
3606
|
+
states: {
|
|
3607
|
+
content: props,
|
|
3608
|
+
},
|
|
3609
|
+
data: {
|
|
3610
|
+
shareCode: (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.referralCode,
|
|
3611
|
+
},
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3604
3615
|
const SqmReferralIframe = class {
|
|
3605
3616
|
constructor(hostRef) {
|
|
3606
3617
|
index.registerInstance(this, hostRef);
|
|
@@ -15946,7 +15946,6 @@ const defaultProps$u = {
|
|
|
15946
15946
|
},
|
|
15947
15947
|
},
|
|
15948
15948
|
content: {
|
|
15949
|
-
required: false,
|
|
15950
15949
|
fieldName: "firstName",
|
|
15951
15950
|
fieldLabel: "First Name",
|
|
15952
15951
|
fieldType: "text",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useMutation } from "@saasquatch/component-boilerplate";
|
|
1
|
+
import { useMutation, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { useCallback, useEffect, useRef, useState, } from "@saasquatch/universal-hooks";
|
|
3
3
|
import { gql } from "graphql-request";
|
|
4
4
|
import jsonpointer from "jsonpointer";
|
|
5
5
|
import { AsYouType } from "libphonenumber-js";
|
|
6
6
|
import { useLeadFormState } from "./useLeadFormState";
|
|
7
|
-
import { useReferralIframe } from "../sqm-referral-iframe/useReferralIframe";
|
|
8
7
|
const SUBMIT_LEAD = gql `
|
|
9
8
|
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
10
9
|
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
@@ -12,12 +11,23 @@ const SUBMIT_LEAD = gql `
|
|
|
12
11
|
}
|
|
13
12
|
}
|
|
14
13
|
`;
|
|
14
|
+
const GET_USER_DETAILS = gql `
|
|
15
|
+
query getUser($programId: ID) {
|
|
16
|
+
viewer {
|
|
17
|
+
... on User {
|
|
18
|
+
referralCode(programId: $programId)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
15
23
|
export function useLeadForm(props) {
|
|
16
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
17
25
|
const formRef = useRef(null);
|
|
18
26
|
const { leadFormState, setLeadFormState } = useLeadFormState({});
|
|
19
|
-
const
|
|
20
|
-
|
|
27
|
+
const programId = useProgramId();
|
|
28
|
+
const user = useUserIdentity();
|
|
29
|
+
const { data: userDetails } = useQuery(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
30
|
+
console.log({ userDetails });
|
|
21
31
|
const [submitLead, { loading, errors, data }] = useMutation(SUBMIT_LEAD);
|
|
22
32
|
const [success, setSuccess] = useState(false);
|
|
23
33
|
useEffect(() => {
|
|
@@ -102,15 +112,15 @@ export function useLeadForm(props) {
|
|
|
102
112
|
e.target.value = asYouType.input(e.target.value);
|
|
103
113
|
}, []);
|
|
104
114
|
let errorMessage = "";
|
|
105
|
-
if ((
|
|
115
|
+
if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
|
|
106
116
|
errorMessage = props.networkErrorMessage;
|
|
107
117
|
}
|
|
108
|
-
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((
|
|
118
|
+
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors.length)) {
|
|
109
119
|
errorMessage = props.networkErrorMessage;
|
|
110
120
|
}
|
|
111
121
|
else {
|
|
112
122
|
errorMessage =
|
|
113
|
-
((
|
|
123
|
+
((_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);
|
|
114
124
|
}
|
|
115
125
|
return {
|
|
116
126
|
states: {
|
|
@@ -118,7 +128,7 @@ export function useLeadForm(props) {
|
|
|
118
128
|
error: errorMessage,
|
|
119
129
|
success,
|
|
120
130
|
leadFormState,
|
|
121
|
-
referralCode,
|
|
131
|
+
referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
|
|
122
132
|
},
|
|
123
133
|
callbacks: {
|
|
124
134
|
submit,
|
|
@@ -1289,6 +1289,13 @@ function useInputFieldDemo(props) {
|
|
|
1289
1289
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
|
+
const SUBMIT_LEAD = dist.gql `
|
|
1293
|
+
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
1294
|
+
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
1295
|
+
success
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
`;
|
|
1292
1299
|
const GET_USER_DETAILS = dist.gql `
|
|
1293
1300
|
query getUser($programId: ID) {
|
|
1294
1301
|
viewer {
|
|
@@ -1298,34 +1305,14 @@ const GET_USER_DETAILS = dist.gql `
|
|
|
1298
1305
|
}
|
|
1299
1306
|
}
|
|
1300
1307
|
`;
|
|
1301
|
-
function useReferralIframe(props) {
|
|
1302
|
-
var _a;
|
|
1303
|
-
const programId = H();
|
|
1304
|
-
const user = J();
|
|
1305
|
-
const { data } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
1306
|
-
return {
|
|
1307
|
-
states: {
|
|
1308
|
-
content: props,
|
|
1309
|
-
},
|
|
1310
|
-
data: {
|
|
1311
|
-
shareCode: (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.referralCode,
|
|
1312
|
-
},
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1315
|
-
|
|
1316
|
-
const SUBMIT_LEAD = dist.gql `
|
|
1317
|
-
mutation submitForm($formSubmissionInput: FormSubmissionInput!) {
|
|
1318
|
-
submitForm(formSubmissionInput: $formSubmissionInput) {
|
|
1319
|
-
success
|
|
1320
|
-
}
|
|
1321
|
-
}
|
|
1322
|
-
`;
|
|
1323
1308
|
function useLeadForm(props) {
|
|
1324
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
1309
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1325
1310
|
const formRef = useRef(null);
|
|
1326
1311
|
const { leadFormState, setLeadFormState } = useLeadFormState({});
|
|
1327
|
-
const
|
|
1328
|
-
|
|
1312
|
+
const programId = H();
|
|
1313
|
+
const user = J();
|
|
1314
|
+
const { data: userDetails } = wn(GET_USER_DETAILS, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
1315
|
+
console.log({ userDetails });
|
|
1329
1316
|
const [submitLead, { loading, errors, data }] = $e(SUBMIT_LEAD);
|
|
1330
1317
|
const [success, setSuccess] = useState(false);
|
|
1331
1318
|
useEffect(() => {
|
|
@@ -1410,15 +1397,15 @@ function useLeadForm(props) {
|
|
|
1410
1397
|
e.target.value = asYouType.input(e.target.value);
|
|
1411
1398
|
}, []);
|
|
1412
1399
|
let errorMessage = "";
|
|
1413
|
-
if ((
|
|
1400
|
+
if ((_a = errors === null || errors === void 0 ? void 0 : errors.response) === null || _a === void 0 ? void 0 : _a["error"]) {
|
|
1414
1401
|
errorMessage = props.networkErrorMessage;
|
|
1415
1402
|
}
|
|
1416
|
-
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((
|
|
1403
|
+
else if ((errors === null || errors === void 0 ? void 0 : errors.message) && !((_b = errors === null || errors === void 0 ? void 0 : errors.response) === null || _b === void 0 ? void 0 : _b.errors.length)) {
|
|
1417
1404
|
errorMessage = props.networkErrorMessage;
|
|
1418
1405
|
}
|
|
1419
1406
|
else {
|
|
1420
1407
|
errorMessage =
|
|
1421
|
-
((
|
|
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);
|
|
1422
1409
|
}
|
|
1423
1410
|
return {
|
|
1424
1411
|
states: {
|
|
@@ -1426,7 +1413,7 @@ function useLeadForm(props) {
|
|
|
1426
1413
|
error: errorMessage,
|
|
1427
1414
|
success,
|
|
1428
1415
|
leadFormState,
|
|
1429
|
-
referralCode,
|
|
1416
|
+
referralCode: ((_k = userDetails === null || userDetails === void 0 ? void 0 : userDetails.viewer) === null || _k === void 0 ? void 0 : _k.referralCode) || "",
|
|
1430
1417
|
},
|
|
1431
1418
|
callbacks: {
|
|
1432
1419
|
submit,
|
|
@@ -3597,6 +3584,30 @@ const ReferralCard = class {
|
|
|
3597
3584
|
}
|
|
3598
3585
|
};
|
|
3599
3586
|
|
|
3587
|
+
const GET_USER_DETAILS$1 = dist.gql `
|
|
3588
|
+
query getUser($programId: ID) {
|
|
3589
|
+
viewer {
|
|
3590
|
+
... on User {
|
|
3591
|
+
referralCode(programId: $programId)
|
|
3592
|
+
}
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
`;
|
|
3596
|
+
function useReferralIframe(props) {
|
|
3597
|
+
var _a;
|
|
3598
|
+
const programId = H();
|
|
3599
|
+
const user = J();
|
|
3600
|
+
const { data } = wn(GET_USER_DETAILS$1, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt) || !programId);
|
|
3601
|
+
return {
|
|
3602
|
+
states: {
|
|
3603
|
+
content: props,
|
|
3604
|
+
},
|
|
3605
|
+
data: {
|
|
3606
|
+
shareCode: (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.referralCode,
|
|
3607
|
+
},
|
|
3608
|
+
};
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3600
3611
|
const SqmReferralIframe = class {
|
|
3601
3612
|
constructor(hostRef) {
|
|
3602
3613
|
registerInstance(this, hostRef);
|
|
@@ -15942,7 +15942,6 @@ const defaultProps$u = {
|
|
|
15942
15942
|
},
|
|
15943
15943
|
},
|
|
15944
15944
|
content: {
|
|
15945
|
-
required: false,
|
|
15946
15945
|
fieldName: "firstName",
|
|
15947
15946
|
fieldLabel: "First Name",
|
|
15948
15947
|
fieldType: "text",
|