@saasquatch/mint-components 2.5.4 → 2.5.5-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/sqm-big-stat_47.cjs.entry.js +30 -11
- package/dist/collection/components/sqm-widget-verification/getVerificationStep.js +10 -0
- package/dist/collection/components/sqm-widget-verification/useWidgetVerification.js +20 -11
- package/dist/esm/sqm-big-stat_47.entry.js +30 -11
- package/dist/esm-es5/sqm-big-stat_47.entry.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-84ff55b9.system.entry.js → p-3acfe5be.system.entry.js} +1 -1
- package/dist/mint-components/p-bfb00685.system.js +1 -1
- package/dist/mint-components/{p-5b174702.entry.js → p-d9d3661c.entry.js} +23 -14
- package/dist/types/components/sqm-widget-verification/getVerificationStep.d.ts +14 -0
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
|
@@ -8363,6 +8363,17 @@ function useUserNameDemo(props) {
|
|
|
8363
8363
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
8364
8364
|
}
|
|
8365
8365
|
|
|
8366
|
+
// Partner creation is only forced once a cash reward is owed; otherwise tax-and-cash step 1 lets them opt in
|
|
8367
|
+
function getVerificationStep(viewer) {
|
|
8368
|
+
var _a, _b, _c;
|
|
8369
|
+
if ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.impactConnection) === null || _a === void 0 ? void 0 : _a.connected)
|
|
8370
|
+
return "content";
|
|
8371
|
+
const emailVerified = (viewer === null || viewer === void 0 ? void 0 : viewer.emailVerified) || ((_b = viewer === null || viewer === void 0 ? void 0 : viewer.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
|
|
8372
|
+
if (!emailVerified)
|
|
8373
|
+
return "verify";
|
|
8374
|
+
return ((_c = viewer === null || viewer === void 0 ? void 0 : viewer.cashRewards) === null || _c === void 0 ? void 0 : _c.totalCount) > 0 ? "partner" : "content";
|
|
8375
|
+
}
|
|
8376
|
+
|
|
8366
8377
|
const USER_LOOKUP = index_module.dist.gql `
|
|
8367
8378
|
query checkUserVerification {
|
|
8368
8379
|
viewer {
|
|
@@ -8378,6 +8389,15 @@ const USER_LOOKUP = index_module.dist.gql `
|
|
|
8378
8389
|
impactConnection {
|
|
8379
8390
|
connected
|
|
8380
8391
|
}
|
|
8392
|
+
cashRewards: rewards(
|
|
8393
|
+
limit: 1
|
|
8394
|
+
filter: {
|
|
8395
|
+
rewardedCash_eq: true
|
|
8396
|
+
statuses_nin: [{ status: CANCELLED }, { status: EXPIRED }]
|
|
8397
|
+
}
|
|
8398
|
+
) {
|
|
8399
|
+
totalCount
|
|
8400
|
+
}
|
|
8381
8401
|
}
|
|
8382
8402
|
}
|
|
8383
8403
|
}
|
|
@@ -8402,24 +8422,19 @@ function useWidgetVerification() {
|
|
|
8402
8422
|
initialValue: false,
|
|
8403
8423
|
});
|
|
8404
8424
|
const [fetch] = index_module.Xe(USER_LOOKUP);
|
|
8425
|
+
const [viewer, setViewer] = domContextHooks_module.useState(undefined);
|
|
8405
8426
|
domContextHooks_module.useEffect(() => {
|
|
8406
8427
|
const checkUser = async () => {
|
|
8407
|
-
var _a, _b, _c, _d, _e;
|
|
8408
8428
|
try {
|
|
8409
8429
|
const res = await fetch({});
|
|
8410
8430
|
if (!res || res instanceof Error)
|
|
8411
8431
|
throw new Error();
|
|
8412
|
-
|
|
8413
|
-
const
|
|
8414
|
-
|
|
8415
|
-
if (isConnected) {
|
|
8416
|
-
// Partner already created, show widget content
|
|
8432
|
+
setViewer(res.viewer);
|
|
8433
|
+
const step = getVerificationStep(res.viewer);
|
|
8434
|
+
if (step === "content")
|
|
8417
8435
|
setContext(true);
|
|
8418
|
-
|
|
8419
|
-
else if (emailVerified) {
|
|
8420
|
-
// Email verified but no partner yet, show partner modal
|
|
8436
|
+
else if (step === "partner")
|
|
8421
8437
|
setShowPartnerModal(true);
|
|
8422
|
-
}
|
|
8423
8438
|
}
|
|
8424
8439
|
catch (e) {
|
|
8425
8440
|
console.error("Could not fetch user information:", e);
|
|
@@ -8431,7 +8446,11 @@ function useWidgetVerification() {
|
|
|
8431
8446
|
checkUser();
|
|
8432
8447
|
}, []);
|
|
8433
8448
|
const onVerification = () => {
|
|
8434
|
-
|
|
8449
|
+
const step = getVerificationStep({ ...viewer, emailVerified: true });
|
|
8450
|
+
if (step === "partner")
|
|
8451
|
+
setShowPartnerModal(true);
|
|
8452
|
+
else
|
|
8453
|
+
setContext(true);
|
|
8435
8454
|
};
|
|
8436
8455
|
const onPartnerModalComplete = () => {
|
|
8437
8456
|
setShowPartnerModal(false);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Partner creation is only forced once a cash reward is owed; otherwise tax-and-cash step 1 lets them opt in
|
|
2
|
+
export function getVerificationStep(viewer) {
|
|
3
|
+
var _a, _b, _c;
|
|
4
|
+
if ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.impactConnection) === null || _a === void 0 ? void 0 : _a.connected)
|
|
5
|
+
return "content";
|
|
6
|
+
const emailVerified = (viewer === null || viewer === void 0 ? void 0 : viewer.emailVerified) || ((_b = viewer === null || viewer === void 0 ? void 0 : viewer.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
|
|
7
|
+
if (!emailVerified)
|
|
8
|
+
return "verify";
|
|
9
|
+
return ((_c = viewer === null || viewer === void 0 ? void 0 : viewer.cashRewards) === null || _c === void 0 ? void 0 : _c.totalCount) > 0 ? "partner" : "content";
|
|
10
|
+
}
|
|
@@ -2,6 +2,7 @@ import { useLazyQuery, useParentState, useSetParent, } from "@saasquatch/compone
|
|
|
2
2
|
import { useState } from "@saasquatch/stencil-hooks";
|
|
3
3
|
import { useEffect } from "@saasquatch/universal-hooks";
|
|
4
4
|
import { gql } from "graphql-request";
|
|
5
|
+
import { getVerificationStep } from "./getVerificationStep";
|
|
5
6
|
import { PARTNER_CREATED_NAMESPACE, SHOW_CODE_NAMESPACE, SHOW_PARTNER_MODAL_NAMESPACE, VERIFICATION_EMAIL_NAMESPACE, VERIFICATION_PARENT_NAMESPACE, } from "./keys";
|
|
6
7
|
const USER_LOOKUP = gql `
|
|
7
8
|
query checkUserVerification {
|
|
@@ -18,6 +19,15 @@ const USER_LOOKUP = gql `
|
|
|
18
19
|
impactConnection {
|
|
19
20
|
connected
|
|
20
21
|
}
|
|
22
|
+
cashRewards: rewards(
|
|
23
|
+
limit: 1
|
|
24
|
+
filter: {
|
|
25
|
+
rewardedCash_eq: true
|
|
26
|
+
statuses_nin: [{ status: CANCELLED }, { status: EXPIRED }]
|
|
27
|
+
}
|
|
28
|
+
) {
|
|
29
|
+
totalCount
|
|
30
|
+
}
|
|
21
31
|
}
|
|
22
32
|
}
|
|
23
33
|
}
|
|
@@ -42,24 +52,19 @@ export function useWidgetVerification() {
|
|
|
42
52
|
initialValue: false,
|
|
43
53
|
});
|
|
44
54
|
const [fetch] = useLazyQuery(USER_LOOKUP);
|
|
55
|
+
const [viewer, setViewer] = useState(undefined);
|
|
45
56
|
useEffect(() => {
|
|
46
57
|
const checkUser = async () => {
|
|
47
|
-
var _a, _b, _c, _d, _e;
|
|
48
58
|
try {
|
|
49
59
|
const res = await fetch({});
|
|
50
60
|
if (!res || res instanceof Error)
|
|
51
61
|
throw new Error();
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
if (isConnected) {
|
|
56
|
-
// Partner already created, show widget content
|
|
62
|
+
setViewer(res.viewer);
|
|
63
|
+
const step = getVerificationStep(res.viewer);
|
|
64
|
+
if (step === "content")
|
|
57
65
|
setContext(true);
|
|
58
|
-
|
|
59
|
-
else if (emailVerified) {
|
|
60
|
-
// Email verified but no partner yet, show partner modal
|
|
66
|
+
else if (step === "partner")
|
|
61
67
|
setShowPartnerModal(true);
|
|
62
|
-
}
|
|
63
68
|
}
|
|
64
69
|
catch (e) {
|
|
65
70
|
console.error("Could not fetch user information:", e);
|
|
@@ -71,7 +76,11 @@ export function useWidgetVerification() {
|
|
|
71
76
|
checkUser();
|
|
72
77
|
}, []);
|
|
73
78
|
const onVerification = () => {
|
|
74
|
-
|
|
79
|
+
const step = getVerificationStep({ ...viewer, emailVerified: true });
|
|
80
|
+
if (step === "partner")
|
|
81
|
+
setShowPartnerModal(true);
|
|
82
|
+
else
|
|
83
|
+
setContext(true);
|
|
75
84
|
};
|
|
76
85
|
const onPartnerModalComplete = () => {
|
|
77
86
|
setShowPartnerModal(false);
|
|
@@ -8359,6 +8359,17 @@ function useUserNameDemo(props) {
|
|
|
8359
8359
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
|
8360
8360
|
}
|
|
8361
8361
|
|
|
8362
|
+
// Partner creation is only forced once a cash reward is owed; otherwise tax-and-cash step 1 lets them opt in
|
|
8363
|
+
function getVerificationStep(viewer) {
|
|
8364
|
+
var _a, _b, _c;
|
|
8365
|
+
if ((_a = viewer === null || viewer === void 0 ? void 0 : viewer.impactConnection) === null || _a === void 0 ? void 0 : _a.connected)
|
|
8366
|
+
return "content";
|
|
8367
|
+
const emailVerified = (viewer === null || viewer === void 0 ? void 0 : viewer.emailVerified) || ((_b = viewer === null || viewer === void 0 ? void 0 : viewer.managedIdentity) === null || _b === void 0 ? void 0 : _b.emailVerified);
|
|
8368
|
+
if (!emailVerified)
|
|
8369
|
+
return "verify";
|
|
8370
|
+
return ((_c = viewer === null || viewer === void 0 ? void 0 : viewer.cashRewards) === null || _c === void 0 ? void 0 : _c.totalCount) > 0 ? "partner" : "content";
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8362
8373
|
const USER_LOOKUP = dist.gql `
|
|
8363
8374
|
query checkUserVerification {
|
|
8364
8375
|
viewer {
|
|
@@ -8374,6 +8385,15 @@ const USER_LOOKUP = dist.gql `
|
|
|
8374
8385
|
impactConnection {
|
|
8375
8386
|
connected
|
|
8376
8387
|
}
|
|
8388
|
+
cashRewards: rewards(
|
|
8389
|
+
limit: 1
|
|
8390
|
+
filter: {
|
|
8391
|
+
rewardedCash_eq: true
|
|
8392
|
+
statuses_nin: [{ status: CANCELLED }, { status: EXPIRED }]
|
|
8393
|
+
}
|
|
8394
|
+
) {
|
|
8395
|
+
totalCount
|
|
8396
|
+
}
|
|
8377
8397
|
}
|
|
8378
8398
|
}
|
|
8379
8399
|
}
|
|
@@ -8398,24 +8418,19 @@ function useWidgetVerification() {
|
|
|
8398
8418
|
initialValue: false,
|
|
8399
8419
|
});
|
|
8400
8420
|
const [fetch] = Xe(USER_LOOKUP);
|
|
8421
|
+
const [viewer, setViewer] = useState(undefined);
|
|
8401
8422
|
useEffect(() => {
|
|
8402
8423
|
const checkUser = async () => {
|
|
8403
|
-
var _a, _b, _c, _d, _e;
|
|
8404
8424
|
try {
|
|
8405
8425
|
const res = await fetch({});
|
|
8406
8426
|
if (!res || res instanceof Error)
|
|
8407
8427
|
throw new Error();
|
|
8408
|
-
|
|
8409
|
-
const
|
|
8410
|
-
|
|
8411
|
-
if (isConnected) {
|
|
8412
|
-
// Partner already created, show widget content
|
|
8428
|
+
setViewer(res.viewer);
|
|
8429
|
+
const step = getVerificationStep(res.viewer);
|
|
8430
|
+
if (step === "content")
|
|
8413
8431
|
setContext(true);
|
|
8414
|
-
|
|
8415
|
-
else if (emailVerified) {
|
|
8416
|
-
// Email verified but no partner yet, show partner modal
|
|
8432
|
+
else if (step === "partner")
|
|
8417
8433
|
setShowPartnerModal(true);
|
|
8418
|
-
}
|
|
8419
8434
|
}
|
|
8420
8435
|
catch (e) {
|
|
8421
8436
|
console.error("Could not fetch user information:", e);
|
|
@@ -8427,7 +8442,11 @@ function useWidgetVerification() {
|
|
|
8427
8442
|
checkUser();
|
|
8428
8443
|
}, []);
|
|
8429
8444
|
const onVerification = () => {
|
|
8430
|
-
|
|
8445
|
+
const step = getVerificationStep({ ...viewer, emailVerified: true });
|
|
8446
|
+
if (step === "partner")
|
|
8447
|
+
setShowPartnerModal(true);
|
|
8448
|
+
else
|
|
8449
|
+
setContext(true);
|
|
8431
8450
|
};
|
|
8432
8451
|
const onPartnerModalComplete = () => {
|
|
8433
8452
|
setShowPartnerModal(false);
|