@saasquatch/mint-components 1.12.0-9 → 1.12.1-1
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-040cffad.js → ShadowViewAddon-88821c64.js} +3 -6
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +79 -202
- package/dist/cjs/sqm-big-stat_39.cjs.entry.js +160 -281
- package/dist/cjs/{sqm-invoice-table-view-c58966f8.js → sqm-invoice-table-view-a9133a11.js} +0 -98
- package/dist/cjs/sqm-portal-registration-form-view-621348a6.js +85 -0
- package/dist/cjs/sqm-portal-registration-form.cjs.entry.js +12 -81
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +323 -334
- package/dist/collection/collection-manifest.json +1 -6
- package/dist/collection/components/sqm-big-stat/useBigStat.js +3 -6
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +5 -5
- package/dist/collection/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.js +11 -0
- package/dist/collection/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.js +160 -0
- package/dist/collection/components/sqm-portal-registration-form/PortalRegistrationForm.stories.js +5 -1
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form-view.js +1 -1
- package/dist/collection/components/sqm-portal-registration-form/sqm-portal-registration-form.js +3 -2
- package/dist/collection/components/sqm-portal-registration-form/usePortalRegistrationForm.js +6 -0
- package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +4 -8
- package/dist/collection/components/tax-and-cash/BankingForm.stories.js +0 -2
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +0 -96
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +1 -5
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +38 -101
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +2 -15
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/data.js +0 -7
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +8 -8
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +0 -22
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +9 -99
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +1 -8
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/sqm-user-info-form-view.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-user-info-form/useUserInfoForm.js +11 -14
- package/dist/esm/{ShadowViewAddon-69b61037.js → ShadowViewAddon-65c8679e.js} +3 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_16.entry.js +79 -202
- package/dist/esm/sqm-big-stat_39.entry.js +159 -280
- package/dist/esm/{sqm-invoice-table-view-d1cfdaf4.js → sqm-invoice-table-view-71915a5e.js} +0 -98
- package/dist/esm/sqm-portal-registration-form-view-1d3066e1.js +83 -0
- package/dist/esm/sqm-portal-registration-form.entry.js +18 -87
- package/dist/esm/sqm-stencilbook.entry.js +323 -334
- package/dist/esm/stencil-hooks.module-ac12ca1c.js +1 -1
- package/dist/esm-es5/ShadowViewAddon-65c8679e.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-banking-info-form_16.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-71915a5e.js +1 -0
- package/dist/esm-es5/sqm-portal-registration-form-view-1d3066e1.js +1 -0
- package/dist/esm-es5/sqm-portal-registration-form.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/stencil-hooks.module-ac12ca1c.js +1 -1
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/p-1279f7a3.system.entry.js +1 -0
- package/dist/mint-components/p-15a64357.entry.js +13 -0
- package/dist/mint-components/p-17f56865.entry.js +9 -0
- package/dist/mint-components/p-2a414b2e.system.js +2 -2
- package/dist/mint-components/p-3cb18382.system.js +1 -0
- package/dist/mint-components/p-40b1de58.js +1 -0
- package/dist/mint-components/p-4112e198.system.js +1 -0
- package/dist/mint-components/p-5cd917db.js +1 -0
- package/dist/mint-components/p-6792c8d8.system.entry.js +1 -0
- package/dist/mint-components/p-a02afa72.system.js +1 -0
- package/dist/mint-components/p-acd77a6e.entry.js +223 -0
- package/dist/mint-components/p-b3e97f8a.system.entry.js +1 -0
- package/dist/mint-components/{p-9eae245f.js → p-b651706a.js} +3 -6
- package/dist/mint-components/p-b8233366.entry.js +174 -0
- package/dist/mint-components/p-ca809fdd.system.js +1 -1
- package/dist/mint-components/p-cb38b9b0.system.entry.js +1 -0
- package/dist/mint-components/p-fd2c5407.js +2 -2
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field-view.d.ts +1 -1
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +4 -4
- package/dist/types/components/sqm-marketing-emails-checkbox/MarketingEmailsCheckbox.stories.d.ts +8 -0
- package/dist/types/components/sqm-marketing-emails-checkbox/sqm-marketing-emails-checkbox.d.ts +34 -0
- package/dist/types/components/sqm-portal-registration-form/PortalRegistrationForm.stories.d.ts +1 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form-view.d.ts +1 -0
- package/dist/types/components/sqm-portal-registration-form/sqm-portal-registration-form.d.ts +1 -1
- package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +0 -2
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +0 -2
- package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/data.d.ts +0 -6
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +2 -2
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +0 -12
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +2 -19
- package/dist/types/components.d.ts +108 -625
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/extractProps-fd93ba62.js +0 -21
- package/dist/cjs/keys-cff24974.js +0 -11
- package/dist/cjs/sqm-code-verification.cjs.entry.js +0 -342
- package/dist/cjs/sqm-email-verification.cjs.entry.js +0 -283
- package/dist/cjs/sqm-scroll.cjs.entry.js +0 -109
- package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +0 -103
- package/dist/cjs/sqm-widget-verification.cjs.entry.js +0 -210
- package/dist/cjs/usePayoutStatus-b9fb7399.js +0 -70
- package/dist/cjs/useVerificationEmail-6aacdb71.js +0 -169
- package/dist/collection/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.js +0 -8
- package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.js +0 -23
- package/dist/collection/components/sqm-payout-button-scroll/sqm-payout-button-scroll.js +0 -118
- package/dist/collection/components/sqm-payout-button-scroll/usePayoutButton.js +0 -44
- package/dist/collection/components/sqm-widget-verification/keys.js +0 -4
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.js +0 -36
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.js +0 -128
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.js +0 -301
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.js +0 -153
- package/dist/collection/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.js +0 -42
- package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.js +0 -91
- package/dist/collection/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.js +0 -226
- package/dist/collection/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.js +0 -126
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +0 -339
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification.js +0 -557
- package/dist/collection/components/sqm-widget-verification/useVerificationEmail.js +0 -165
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +0 -22
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +0 -131
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +0 -354
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +0 -65
- package/dist/esm/extractProps-ae1afbb3.js +0 -19
- package/dist/esm/keys-db1897ae.js +0 -6
- package/dist/esm/sqm-code-verification.entry.js +0 -338
- package/dist/esm/sqm-email-verification.entry.js +0 -279
- package/dist/esm/sqm-scroll.entry.js +0 -105
- package/dist/esm/sqm-widget-verification-internal.entry.js +0 -99
- package/dist/esm/sqm-widget-verification.entry.js +0 -206
- package/dist/esm/usePayoutStatus-1a635054.js +0 -67
- package/dist/esm/useVerificationEmail-c32696ba.js +0 -167
- package/dist/esm-es5/ShadowViewAddon-69b61037.js +0 -1
- package/dist/esm-es5/extractProps-ae1afbb3.js +0 -1
- package/dist/esm-es5/keys-db1897ae.js +0 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +0 -1
- package/dist/esm-es5/sqm-email-verification.entry.js +0 -1
- package/dist/esm-es5/sqm-invoice-table-view-d1cfdaf4.js +0 -1
- package/dist/esm-es5/sqm-scroll.entry.js +0 -1
- package/dist/esm-es5/sqm-widget-verification-internal.entry.js +0 -1
- package/dist/esm-es5/sqm-widget-verification.entry.js +0 -1
- package/dist/esm-es5/usePayoutStatus-1a635054.js +0 -1
- package/dist/esm-es5/useVerificationEmail-c32696ba.js +0 -1
- package/dist/mint-components/p-1712a9fd.entry.js +0 -11
- package/dist/mint-components/p-1e616d45.system.js +0 -1
- package/dist/mint-components/p-24092973.entry.js +0 -9
- package/dist/mint-components/p-26468242.js +0 -1
- package/dist/mint-components/p-331d060e.entry.js +0 -223
- package/dist/mint-components/p-3925bcd6.entry.js +0 -13
- package/dist/mint-components/p-39840341.js +0 -1
- package/dist/mint-components/p-4364001c.entry.js +0 -12
- package/dist/mint-components/p-4bd7a472.js +0 -1
- package/dist/mint-components/p-517224ef.js +0 -19
- package/dist/mint-components/p-5a23b560.system.entry.js +0 -1
- package/dist/mint-components/p-64491210.system.entry.js +0 -1
- package/dist/mint-components/p-8300d8c8.system.js +0 -1
- package/dist/mint-components/p-8bddb468.system.entry.js +0 -1
- package/dist/mint-components/p-9596e97c.system.entry.js +0 -1
- package/dist/mint-components/p-974070c4.system.entry.js +0 -1
- package/dist/mint-components/p-a85f57bb.entry.js +0 -1
- package/dist/mint-components/p-a8645c1b.system.js +0 -1
- package/dist/mint-components/p-b2a99637.system.js +0 -1
- package/dist/mint-components/p-b62faaa5.system.entry.js +0 -1
- package/dist/mint-components/p-c05e7b9f.entry.js +0 -195
- package/dist/mint-components/p-c510fb88.entry.js +0 -1
- package/dist/mint-components/p-c7057066.system.entry.js +0 -1
- package/dist/mint-components/p-d7806f31.js +0 -48
- package/dist/mint-components/p-e01ac27c.system.js +0 -1
- package/dist/mint-components/p-e45a8501.system.entry.js +0 -1
- package/dist/mint-components/p-e990dc21.system.js +0 -1
- package/dist/mint-components/p-ead27698.system.entry.js +0 -1
- package/dist/mint-components/p-f340214f.entry.js +0 -25
- package/dist/types/components/sqm-payout-button-scroll/PayoutButtonScroll.stories.d.ts +0 -5
- package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll-view.d.ts +0 -10
- package/dist/types/components/sqm-payout-button-scroll/sqm-payout-button-scroll.d.ts +0 -26
- package/dist/types/components/sqm-payout-button-scroll/usePayoutButton.d.ts +0 -7
- package/dist/types/components/sqm-widget-verification/keys.d.ts +0 -4
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/WidgetCodeVerification.stories.d.ts +0 -9
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.d.ts +0 -26
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification.d.ts +0 -54
- package/dist/types/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.d.ts +0 -25
- package/dist/types/components/sqm-widget-verification/sqm-email-verification/WidgetEmailVerification.stories.d.ts +0 -10
- package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification-view.d.ts +0 -21
- package/dist/types/components/sqm-widget-verification/sqm-email-verification/sqm-email-verification.d.ts +0 -40
- package/dist/types/components/sqm-widget-verification/sqm-email-verification/useEmailVerification.d.ts +0 -10
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification-internal.d.ts +0 -20
- package/dist/types/components/sqm-widget-verification/sqm-widget-verification.d.ts +0 -87
- package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +0 -14
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +0 -10
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +0 -30
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +0 -62
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +0 -21
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$1 } from './index-17b4da69.js';
|
|
2
|
-
import { n as h } from './stencil-hooks.module-ac12ca1c.js';
|
|
3
|
-
import { c as createStyleSheet } from './JSS-67b5cff8.js';
|
|
4
|
-
|
|
5
|
-
const REVEAL_EVENT = "sq:reveal";
|
|
6
|
-
function useScroll(props) {
|
|
7
|
-
const { scrollTagName, scrollId } = props;
|
|
8
|
-
async function scroll() {
|
|
9
|
-
const element = document === null || document === void 0 ? void 0 : document.querySelector(scrollTagName || `#${scrollId}`);
|
|
10
|
-
element.dispatchEvent(new CustomEvent(REVEAL_EVENT, {
|
|
11
|
-
detail: scrollTagName || `#${scrollId}`,
|
|
12
|
-
bubbles: true,
|
|
13
|
-
composed: true,
|
|
14
|
-
}));
|
|
15
|
-
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
16
|
-
element.scrollIntoView({ behavior: props.scrollAnimation });
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
callbacks: { scroll },
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const Scroll = class {
|
|
24
|
-
constructor(hostRef) {
|
|
25
|
-
registerInstance(this, hostRef);
|
|
26
|
-
this.ignored = true;
|
|
27
|
-
/**
|
|
28
|
-
* @uiName Button type
|
|
29
|
-
* @uiType string
|
|
30
|
-
* @uiEnum ["default", "primary", "success", "neutral", "warning", "danger", "text"]
|
|
31
|
-
* @uiEnumNames ["Default", "Primary", "Success", "Neutral", "Warning", "Danger", "Text"]
|
|
32
|
-
|
|
33
|
-
*/
|
|
34
|
-
this.buttonType = "default";
|
|
35
|
-
/**
|
|
36
|
-
* @uiName Scroll animation style
|
|
37
|
-
* @uiType string
|
|
38
|
-
* @uiEnum ["smooth", "auto"]
|
|
39
|
-
* @uiEnumNames ["Smooth", "Auto"]
|
|
40
|
-
*/
|
|
41
|
-
this.scrollAnimation = "smooth";
|
|
42
|
-
h(this);
|
|
43
|
-
}
|
|
44
|
-
disconnectedCallback() { }
|
|
45
|
-
render() {
|
|
46
|
-
var _a;
|
|
47
|
-
const { callbacks } = useScroll(this);
|
|
48
|
-
const outlineColor = (_a = this.buttonType) !== null && _a !== void 0 ? _a : "primary";
|
|
49
|
-
const style = {
|
|
50
|
-
Button: {
|
|
51
|
-
"& .outline": {
|
|
52
|
-
"&::part(base)": {
|
|
53
|
-
color: "var(--sl-color-" + outlineColor + "-500)",
|
|
54
|
-
borderColor: "var(--sl-color-" + outlineColor + "-500)",
|
|
55
|
-
backgroundColor: "transparent",
|
|
56
|
-
"&:hover": {
|
|
57
|
-
color: "var(--sl-color-primary-text)",
|
|
58
|
-
backgroundColor: "var(--sl-color-" + outlineColor + "-500)",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
"& .neutral": {
|
|
63
|
-
"&::part(base)": {
|
|
64
|
-
color: "var(--sl-color-primary-text)",
|
|
65
|
-
background: "var(--sl-color-neutral-500)",
|
|
66
|
-
"&:hover": {
|
|
67
|
-
opacity: "0.8",
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
"& .mobile": {
|
|
72
|
-
"@media (max-width: 499px)": {
|
|
73
|
-
width: "100%",
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
const sheet = createStyleSheet(style);
|
|
79
|
-
const styleString = sheet.toString();
|
|
80
|
-
const vanillaStyle = `
|
|
81
|
-
:host{
|
|
82
|
-
display: contents;
|
|
83
|
-
}
|
|
84
|
-
${this.mobile &&
|
|
85
|
-
`
|
|
86
|
-
@media only screen and (max-width: 499px) {
|
|
87
|
-
:host {
|
|
88
|
-
display: block;
|
|
89
|
-
width: 100%;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`}
|
|
93
|
-
`;
|
|
94
|
-
let classStack = "";
|
|
95
|
-
if (this.outline && this.buttonType != "default")
|
|
96
|
-
classStack += "outline ";
|
|
97
|
-
if (this.buttonType === "neutral")
|
|
98
|
-
classStack += "neutral ";
|
|
99
|
-
if (this.mobile)
|
|
100
|
-
classStack += "mobile ";
|
|
101
|
-
return (h$1("div", { class: sheet.classes.Button }, h$1("style", { type: "text/css" }, vanillaStyle, styleString), h$1("sl-button", { type: this.buttonType, onClick: callbacks.scroll, size: this.size, pill: this.pill, circle: this.circle, class: classStack }, (this.iconSlot || this.iconName) && (h$1("sl-icon", { slot: this.iconSlot || "prefix", name: this.iconName })), this.buttonText, h$1("slot", null))));
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export { Scroll as sqm_scroll };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$1 } from './index-17b4da69.js';
|
|
2
|
-
import { n as h, k as useState, f as useEffect } from './stencil-hooks.module-ac12ca1c.js';
|
|
3
|
-
import { d as dist, i as isDemo, F as Fn, S as Sn, K, o as an } from './index.module-6c840c4e.js';
|
|
4
|
-
import { g as getProps } from './utils-334c1e34.js';
|
|
5
|
-
import { S as SHOW_CODE_NAMESPACE, a as VERIFICATION_EMAIL_NAMESPACE, V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
|
|
6
|
-
import { e as extractProps } from './extractProps-ae1afbb3.js';
|
|
7
|
-
|
|
8
|
-
const USER_LOOKUP = dist.gql `
|
|
9
|
-
query checkUserVerification {
|
|
10
|
-
viewer {
|
|
11
|
-
... on User {
|
|
12
|
-
id
|
|
13
|
-
accountId
|
|
14
|
-
email
|
|
15
|
-
emailVerified
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`;
|
|
20
|
-
function useWidgetVerificationInternal() {
|
|
21
|
-
const userIdentity = K();
|
|
22
|
-
const [showCode, setShowCode] = Fn({
|
|
23
|
-
namespace: SHOW_CODE_NAMESPACE,
|
|
24
|
-
initialValue: false,
|
|
25
|
-
});
|
|
26
|
-
const [email, setEmail] = Fn({
|
|
27
|
-
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
28
|
-
initialValue: userIdentity === null || userIdentity === void 0 ? void 0 : userIdentity.email,
|
|
29
|
-
});
|
|
30
|
-
const setContext = Sn(VERIFICATION_PARENT_NAMESPACE);
|
|
31
|
-
const [loading, setLoading] = useState(true);
|
|
32
|
-
const [fetch] = an(USER_LOOKUP);
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
const checkUser = async () => {
|
|
35
|
-
var _a;
|
|
36
|
-
try {
|
|
37
|
-
const res = await fetch({});
|
|
38
|
-
if (!res || res instanceof Error)
|
|
39
|
-
throw new Error();
|
|
40
|
-
if ((_a = res === null || res === void 0 ? void 0 : res.viewer) === null || _a === void 0 ? void 0 : _a.emailVerified)
|
|
41
|
-
setContext(true);
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
console.error("Could not fetch user information:", e);
|
|
45
|
-
}
|
|
46
|
-
finally {
|
|
47
|
-
setLoading(false);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
checkUser();
|
|
51
|
-
}, []);
|
|
52
|
-
const onVerification = () => {
|
|
53
|
-
setContext(true);
|
|
54
|
-
};
|
|
55
|
-
return { showCode, onVerification, loading };
|
|
56
|
-
}
|
|
57
|
-
const WidgetVerificationInternal = class {
|
|
58
|
-
constructor(hostRef) {
|
|
59
|
-
registerInstance(this, hostRef);
|
|
60
|
-
h(this);
|
|
61
|
-
}
|
|
62
|
-
disconnectedCallback() { }
|
|
63
|
-
getStepTextProps(prefix) {
|
|
64
|
-
const props = getProps(this);
|
|
65
|
-
return extractProps(props, prefix);
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
const { showCode, onVerification, loading } = isDemo()
|
|
69
|
-
? useDemoWidgetVerificationInternal()
|
|
70
|
-
: useWidgetVerificationInternal();
|
|
71
|
-
// TODO: Shoelace spinner is throwing errors
|
|
72
|
-
if (loading)
|
|
73
|
-
return h$1("div", null);
|
|
74
|
-
// if (loading) {
|
|
75
|
-
// return <sl-spinner style="font-size: 2rem;"></sl-spinner>;
|
|
76
|
-
// }
|
|
77
|
-
if (showCode) {
|
|
78
|
-
return (h$1("sqm-code-verification", Object.assign({ onVerification: onVerification }, this.getStepTextProps("codeStep_"))));
|
|
79
|
-
}
|
|
80
|
-
return (h$1("sqm-email-verification", Object.assign({}, this.getStepTextProps("emailStep_"))));
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
function useDemoWidgetVerificationInternal() {
|
|
84
|
-
const [showCode, setShowCode] = Fn({
|
|
85
|
-
namespace: SHOW_CODE_NAMESPACE,
|
|
86
|
-
initialValue: false,
|
|
87
|
-
});
|
|
88
|
-
const [email, setEmail] = Fn({
|
|
89
|
-
namespace: VERIFICATION_EMAIL_NAMESPACE,
|
|
90
|
-
initialValue: undefined,
|
|
91
|
-
});
|
|
92
|
-
const setContext = Sn(VERIFICATION_PARENT_NAMESPACE);
|
|
93
|
-
const onVerification = () => {
|
|
94
|
-
setContext(true);
|
|
95
|
-
};
|
|
96
|
-
return { showCode, onVerification, loading: false };
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { WidgetVerificationInternal as sqm_widget_verification_internal };
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { r as registerInstance, h as h$1, c as Host } from './index-17b4da69.js';
|
|
2
|
-
import { b as browser, n as h, k as useState, f as useEffect } from './stencil-hooks.module-ac12ca1c.js';
|
|
3
|
-
import { F as Fn, b as useCallback } from './index.module-6c840c4e.js';
|
|
4
|
-
import { g as getProps } from './utils-334c1e34.js';
|
|
5
|
-
import { V as VERIFICATION_PARENT_NAMESPACE } from './keys-db1897ae.js';
|
|
6
|
-
|
|
7
|
-
const debug = browser("sq:widget-verification");
|
|
8
|
-
function useTemplateChildren({ parent, callback }) {
|
|
9
|
-
const parentObserver = new MutationObserver(listenForTemplateChanges);
|
|
10
|
-
const childTemplateObserver = new MutationObserver(callback);
|
|
11
|
-
parentObserver.observe(parent, {
|
|
12
|
-
childList: true,
|
|
13
|
-
// We only care about immediate children templates
|
|
14
|
-
subtree: false,
|
|
15
|
-
});
|
|
16
|
-
listenForTemplateChanges({ addedNodes: parent.querySelectorAll("template") });
|
|
17
|
-
function listenForTemplateChanges(mutationList) {
|
|
18
|
-
var _a;
|
|
19
|
-
// Be smart, only look at the mutation list
|
|
20
|
-
(_a = mutationList.addedNodes) === null || _a === void 0 ? void 0 : _a.forEach((t) => {
|
|
21
|
-
childTemplateObserver.observe(t.content, {
|
|
22
|
-
childList: true,
|
|
23
|
-
attributes: true,
|
|
24
|
-
// Look deep into the templates for re-rendering
|
|
25
|
-
subtree: true,
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return () => {
|
|
30
|
-
parentObserver.disconnect();
|
|
31
|
-
childTemplateObserver.disconnect();
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const WidgetVerification = class {
|
|
35
|
-
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
36
|
-
CODE STEP PROPS
|
|
37
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
38
|
-
constructor(hostRef) {
|
|
39
|
-
registerInstance(this, hostRef);
|
|
40
|
-
// ! Any updated must be reflected in sqm-widget-verification-internal AND sqm-email-verification AND sqm-code-verification
|
|
41
|
-
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
42
|
-
EMAIL STEP PROPS
|
|
43
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
44
|
-
/**
|
|
45
|
-
* @uiName Verify email widget header text
|
|
46
|
-
* @uiGroup Email Verification Step
|
|
47
|
-
*/
|
|
48
|
-
this.emailStep_verifyEmailHeaderText = "Start by verifying your email. We’ll send you a code through our referral provider, impact.com.";
|
|
49
|
-
/**
|
|
50
|
-
* @uiName Send code to email alert header
|
|
51
|
-
* @uiGroup Email Verification Step
|
|
52
|
-
*/
|
|
53
|
-
this.emailStep_sendCodeErrorHeader = "There was an error sending your code.";
|
|
54
|
-
/**
|
|
55
|
-
* @uiName Send code to email alert description
|
|
56
|
-
* @uiGroup Email Verification Step
|
|
57
|
-
*/
|
|
58
|
-
this.emailStep_sendCodeErrorDescription = "Please try again. If this problem continues, contact our program support team.";
|
|
59
|
-
/**
|
|
60
|
-
* @uiName Email input label
|
|
61
|
-
* @uiGroup Email Verification Step
|
|
62
|
-
*/
|
|
63
|
-
this.emailStep_emailLabel = "Email";
|
|
64
|
-
/**
|
|
65
|
-
* @uiName Send code button text
|
|
66
|
-
* @uiGroup Email Verification Step
|
|
67
|
-
*/
|
|
68
|
-
this.emailStep_sendCodeText = "Send code";
|
|
69
|
-
/**
|
|
70
|
-
* @uiName Send code button text
|
|
71
|
-
* @uiGroup Email Verification Step
|
|
72
|
-
*/
|
|
73
|
-
this.emailStep_emailValidationErrorText = "Please enter a valid email";
|
|
74
|
-
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
75
|
-
EMAIL STEP PROPS
|
|
76
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
|
77
|
-
/**
|
|
78
|
-
* @uiName Verify code widget header text
|
|
79
|
-
* @uiGroup Code Verification Step
|
|
80
|
-
*/
|
|
81
|
-
this.codeStep_verifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
|
|
82
|
-
/**
|
|
83
|
-
* @uiName Reverify code widget header text
|
|
84
|
-
* @uiGroup Code Verification Step
|
|
85
|
-
*/
|
|
86
|
-
this.codeStep_reverifyCodeHeaderText = "Enter the code sent to {email} from our referral provider, impact.com.";
|
|
87
|
-
/**
|
|
88
|
-
* Text displayed under verify button
|
|
89
|
-
* @uiName Resend code text
|
|
90
|
-
* @uiGroup Code Verification Step
|
|
91
|
-
*/
|
|
92
|
-
this.codeStep_resendCodeText = "Didn't receive your code? {resendCodeLink}";
|
|
93
|
-
/**
|
|
94
|
-
* The link that appears in the resend code link
|
|
95
|
-
* @uiName Resend code label
|
|
96
|
-
* @uiGroup Code Verification Step
|
|
97
|
-
*/
|
|
98
|
-
this.codeStep_resendCodeLabel = "Resend code";
|
|
99
|
-
/**
|
|
100
|
-
* Link text displayed under verify button
|
|
101
|
-
* @uiName Resend code text
|
|
102
|
-
* @uiGroup Code Verification Step
|
|
103
|
-
*/
|
|
104
|
-
this.codeStep_codeResentSuccessfullyText = "Another code has been sent to {email}";
|
|
105
|
-
/**
|
|
106
|
-
* Error text displayed under verification input
|
|
107
|
-
* @uiName Invalid code text
|
|
108
|
-
* @uiGroup Code Verification Step
|
|
109
|
-
*/
|
|
110
|
-
this.codeStep_invalidCodeText = "Please check your code and try again. If you’re still having trouble, try resending your code.";
|
|
111
|
-
/**
|
|
112
|
-
* @uiName Verify code button text
|
|
113
|
-
* @uiGroup Code Verification Step
|
|
114
|
-
*/
|
|
115
|
-
this.codeStep_verifyText = "Verify";
|
|
116
|
-
/**
|
|
117
|
-
* Displayed when the email verification fails due to a network error. The participant can try refreshing the page.
|
|
118
|
-
* @uiName Network error message
|
|
119
|
-
* @uiGroup Code Verification Step
|
|
120
|
-
*/
|
|
121
|
-
this.codeStep_networkErrorMessage = "An error occurred while verifying your email. Please refresh the page and try again.";
|
|
122
|
-
h(this);
|
|
123
|
-
}
|
|
124
|
-
disconnectedCallback() { }
|
|
125
|
-
render() {
|
|
126
|
-
const [context, setContext] = Fn({
|
|
127
|
-
namespace: VERIFICATION_PARENT_NAMESPACE,
|
|
128
|
-
initialValue: false,
|
|
129
|
-
});
|
|
130
|
-
const [container, setContainer] = useState(undefined);
|
|
131
|
-
const [slot, setSlot] = useState(undefined);
|
|
132
|
-
const updateTemplates = useCallback(() => {
|
|
133
|
-
const isAuth = context;
|
|
134
|
-
const templates = slot.querySelectorAll(`template`);
|
|
135
|
-
const template = Array.from(templates).find((t) => t.slot === (isAuth ? "verified" : "not-verified"));
|
|
136
|
-
if (template) {
|
|
137
|
-
// use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
|
|
138
|
-
const newContent = template.innerHTML || template.firstElementChild.outerHTML;
|
|
139
|
-
// if template contents are an exact match
|
|
140
|
-
if (newContent === container.innerHTML) {
|
|
141
|
-
debug("don't rerender");
|
|
142
|
-
}
|
|
143
|
-
else if (template) {
|
|
144
|
-
container.innerHTML = newContent;
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
const plopTargets = Array.from(slot.children).filter((el) => el.tagName === "RAISINS-PLOP-TARGET");
|
|
148
|
-
// if editing in raisins
|
|
149
|
-
if (plopTargets.length) {
|
|
150
|
-
const loggedInPlopTargets = plopTargets.filter((el) => el.slot === "verified");
|
|
151
|
-
const loggedOutPlopTargets = plopTargets.filter((el) => el.slot === "not-verified");
|
|
152
|
-
loggedOutPlopTargets.forEach((target, i) => {
|
|
153
|
-
if (isAuth) {
|
|
154
|
-
target.style.display = "none";
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
// Place last plop target at the bottom of the parent
|
|
158
|
-
if (i === loggedOutPlopTargets.length - 1) {
|
|
159
|
-
target.style.bottom = "0px";
|
|
160
|
-
target.style.left = "0px";
|
|
161
|
-
target.style.right = "0px";
|
|
162
|
-
target.style.position = "absolute";
|
|
163
|
-
}
|
|
164
|
-
target.style.height = "25px";
|
|
165
|
-
});
|
|
166
|
-
loggedInPlopTargets.forEach((target, i) => {
|
|
167
|
-
if (!isAuth) {
|
|
168
|
-
target.style.display = "none";
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
// Place last plop target at the bottom of the parent
|
|
172
|
-
if (i === loggedInPlopTargets.length - 1) {
|
|
173
|
-
target.style.bottom = "0px";
|
|
174
|
-
target.style.left = "0px";
|
|
175
|
-
target.style.right = "0px";
|
|
176
|
-
target.style.position = "absolute";
|
|
177
|
-
}
|
|
178
|
-
target.style.height = "25px";
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
}, [container, slot, context]);
|
|
182
|
-
useEffect(() => {
|
|
183
|
-
if (!container || !slot) {
|
|
184
|
-
debug("DOM not ready:");
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
// Run on first render
|
|
188
|
-
updateTemplates();
|
|
189
|
-
return useTemplateChildren({ parent: slot, callback: updateTemplates });
|
|
190
|
-
}, [slot, container, context]);
|
|
191
|
-
// useEffect(() => {
|
|
192
|
-
// const host = useHost();
|
|
193
|
-
// const callback = (e: CustomEvent) => {
|
|
194
|
-
// e.stopPropagation();
|
|
195
|
-
// setContext({ token: e.detail.token });
|
|
196
|
-
// };
|
|
197
|
-
// host.addEventListener(VERIFICATION_EVENT_KEY, callback);
|
|
198
|
-
// return () => {
|
|
199
|
-
// host.removeEventListener(VERIFICATION_EVENT_KEY, callback);
|
|
200
|
-
// };
|
|
201
|
-
// }, []);
|
|
202
|
-
return (h$1(Host, null, h$1("div", { ref: setSlot, style: { display: "contents" } }, h$1("template", { slot: "not-verified" }, h$1("sqm-widget-verification-internal", Object.assign({}, getProps(this)))), h$1("slot", { name: "not-verified" }), h$1("slot", { name: "verified" })), h$1("div", { ref: setContainer }, h$1("slot", { name: "shown" }))));
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export { WidgetVerification as sqm_widget_verification };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { k as useState, f as useEffect } from './stencil-hooks.module-ac12ca1c.js';
|
|
2
|
-
import { d as dist, g as getEnvironmentSDK, E as En } from './index.module-6c840c4e.js';
|
|
3
|
-
|
|
4
|
-
const GET_USER_STATUS = dist.gql `
|
|
5
|
-
query getUserStatus {
|
|
6
|
-
user: viewer {
|
|
7
|
-
... on User {
|
|
8
|
-
id
|
|
9
|
-
impactConnection {
|
|
10
|
-
connected
|
|
11
|
-
publisher {
|
|
12
|
-
id
|
|
13
|
-
payoutsAccount {
|
|
14
|
-
hold
|
|
15
|
-
holdReasons
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
23
|
-
function getStatus(data) {
|
|
24
|
-
var _a, _b, _c, _d, _e;
|
|
25
|
-
const account = (_b = (_a = data.user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.payoutsAccount;
|
|
26
|
-
if (!((_d = (_c = data.user) === null || _c === void 0 ? void 0 : _c.impactConnection) === null || _d === void 0 ? void 0 : _d.connected) || !account)
|
|
27
|
-
return "INFORMATION_REQUIRED";
|
|
28
|
-
if ((_e = account.holdReasons) === null || _e === void 0 ? void 0 : _e.includes("IDV_CHECK_REQUIRED"))
|
|
29
|
-
return "VERIFICATION_NEEDED";
|
|
30
|
-
if (account.hold)
|
|
31
|
-
return "HOLD";
|
|
32
|
-
return "DONE";
|
|
33
|
-
}
|
|
34
|
-
function usePayoutStatus(props) {
|
|
35
|
-
const { type } = getEnvironmentSDK();
|
|
36
|
-
const { loading, data, errors, refetch } = En(GET_USER_STATUS, {});
|
|
37
|
-
const [status, setStatus] = useState(undefined);
|
|
38
|
-
const [showDialog, setShowDialog] = useState(false);
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (!data)
|
|
41
|
-
return;
|
|
42
|
-
const s = getStatus(data);
|
|
43
|
-
setStatus(s);
|
|
44
|
-
}, [data]);
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
const cb = () => refetch();
|
|
47
|
-
window.addEventListener("sqm:tax-form-updated", cb);
|
|
48
|
-
return () => window.removeEventListener("sqm:tax-form-updated", cb);
|
|
49
|
-
}, []);
|
|
50
|
-
return {
|
|
51
|
-
states: {
|
|
52
|
-
loading,
|
|
53
|
-
status,
|
|
54
|
-
showVerifyIdentity: showDialog,
|
|
55
|
-
error: !!errors,
|
|
56
|
-
},
|
|
57
|
-
data: { type },
|
|
58
|
-
text: props.getTextProps(),
|
|
59
|
-
callbacks: {
|
|
60
|
-
onTermsClick: () => window.open(props.termsUrl, "_blank").focus(),
|
|
61
|
-
onClick: () => setShowDialog(true),
|
|
62
|
-
onCancel: () => setShowDialog(false),
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { getStatus as g, usePayoutStatus as u };
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { k as useState, f as useEffect } from './stencil-hooks.module-ac12ca1c.js';
|
|
2
|
-
import { d as dist, K, o as an, c as xe } from './index.module-6c840c4e.js';
|
|
3
|
-
|
|
4
|
-
const UserLookupQuery = dist.gql `
|
|
5
|
-
query userLookup {
|
|
6
|
-
viewer {
|
|
7
|
-
... on User {
|
|
8
|
-
id
|
|
9
|
-
accountId
|
|
10
|
-
email
|
|
11
|
-
impactConnection {
|
|
12
|
-
user {
|
|
13
|
-
id
|
|
14
|
-
email
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
const ParticipantVerificationEmailMutation = dist.gql `
|
|
22
|
-
mutation requestUserEmailVerification($user: UserIdInput!) {
|
|
23
|
-
requestUserEmailVerification(user: $user) {
|
|
24
|
-
success
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
`;
|
|
28
|
-
const ImpactVerificationEmailMutation = dist.gql `
|
|
29
|
-
mutation requestImpactPublisherEmail2FA($user: UserIdInput!) {
|
|
30
|
-
requestImpactPublisherEmail2FA(user: $user) {
|
|
31
|
-
success
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
const VerifyUserEmailMutation = dist.gql `
|
|
36
|
-
mutation verifyUserEmail($user: UserIdInput!, $code: String!) {
|
|
37
|
-
verifyUserEmail(user: $user, code: $code) {
|
|
38
|
-
id
|
|
39
|
-
accountId
|
|
40
|
-
email
|
|
41
|
-
emailVerified
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
const SubmitImpactCodeMutation = dist.gql `
|
|
46
|
-
mutation submitImpactPublisherEmail2FACode(
|
|
47
|
-
$user: UserIdInput!
|
|
48
|
-
$code: String!
|
|
49
|
-
) {
|
|
50
|
-
submitImpactPublisherEmail2FACode(user: $user, code: $code) {
|
|
51
|
-
verifiedEmail
|
|
52
|
-
accessKey
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
`;
|
|
56
|
-
// ! It's important when using this hook to ensure initialisation
|
|
57
|
-
// ! is done before calling any mutations
|
|
58
|
-
function useVerificationEmail() {
|
|
59
|
-
const userIdentity = K();
|
|
60
|
-
const [hasEmails, setHasEmails] = useState({
|
|
61
|
-
participant: false,
|
|
62
|
-
impact: false,
|
|
63
|
-
});
|
|
64
|
-
const [fetch] = an(UserLookupQuery);
|
|
65
|
-
// Send mutations
|
|
66
|
-
const [sendParticipantEmail, { loading: participantEmailLoading, errors: participantEmailErrors },] = xe(ParticipantVerificationEmailMutation);
|
|
67
|
-
const [sendImpactEmail, { loading: impactEmailLoading, errors: impactEmailErrors },] = xe(ImpactVerificationEmailMutation);
|
|
68
|
-
const sendLoading = participantEmailLoading || impactEmailLoading;
|
|
69
|
-
const sendErrors = participantEmailErrors || impactEmailErrors;
|
|
70
|
-
// Verification mutations
|
|
71
|
-
const [verifyUserEmail, { loading: verifyMutationLoading, errors: verifyMutationErrors },] = xe(VerifyUserEmailMutation);
|
|
72
|
-
const [submitImpactCode, { loading: submitImpactCodeLoading, errors: submitImpactCodeErrors },] = xe(SubmitImpactCodeMutation);
|
|
73
|
-
const verifyLoading = verifyMutationLoading || submitImpactCodeLoading;
|
|
74
|
-
const verifyErrors = verifyMutationErrors || submitImpactCodeErrors;
|
|
75
|
-
const [initialized, setInitialized] = useState(false);
|
|
76
|
-
const initialise = async () => {
|
|
77
|
-
var _a, _b, _c, _d;
|
|
78
|
-
try {
|
|
79
|
-
const lookup = await fetch({});
|
|
80
|
-
if (!lookup || lookup instanceof Error)
|
|
81
|
-
throw new Error();
|
|
82
|
-
setHasEmails({
|
|
83
|
-
participant: !!((_a = lookup === null || lookup === void 0 ? void 0 : lookup.viewer) === null || _a === void 0 ? void 0 : _a.email),
|
|
84
|
-
impact: !!((_d = (_c = (_b = lookup === null || lookup === void 0 ? void 0 : lookup.viewer) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.email),
|
|
85
|
-
});
|
|
86
|
-
setInitialized(true);
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
console.error("Could not initialise verification", e);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
const sendVerificationEmail = async () => {
|
|
93
|
-
let result = null;
|
|
94
|
-
if (!initialized)
|
|
95
|
-
return result;
|
|
96
|
-
if (!hasEmails.participant && !hasEmails.impact)
|
|
97
|
-
return result;
|
|
98
|
-
try {
|
|
99
|
-
const request = hasEmails.impact ? sendImpactEmail : sendParticipantEmail;
|
|
100
|
-
const res = await request({
|
|
101
|
-
user: {
|
|
102
|
-
id: userIdentity.id,
|
|
103
|
-
accountId: userIdentity.accountId,
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
if (res instanceof Error || !res)
|
|
107
|
-
throw new Error();
|
|
108
|
-
result = hasEmails.impact
|
|
109
|
-
? res.requestImpactPublisherEmail2FA
|
|
110
|
-
: res.requestUserEmailVerification;
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
console.error("Could not send verification email", e);
|
|
114
|
-
}
|
|
115
|
-
finally {
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
const verifyVerificationEmail = async (code) => {
|
|
120
|
-
var _a;
|
|
121
|
-
let result = null;
|
|
122
|
-
if (!initialized)
|
|
123
|
-
return result;
|
|
124
|
-
if (!hasEmails.participant && !hasEmails.impact)
|
|
125
|
-
return result;
|
|
126
|
-
try {
|
|
127
|
-
const request = hasEmails.impact ? submitImpactCode : verifyUserEmail;
|
|
128
|
-
const res = await request({
|
|
129
|
-
user: {
|
|
130
|
-
id: userIdentity.id,
|
|
131
|
-
accountId: userIdentity.accountId,
|
|
132
|
-
},
|
|
133
|
-
code,
|
|
134
|
-
});
|
|
135
|
-
if (res instanceof Error || !res)
|
|
136
|
-
throw new Error();
|
|
137
|
-
result = {
|
|
138
|
-
success: true,
|
|
139
|
-
accessKey: hasEmails.impact
|
|
140
|
-
? (_a = res.submitImpactPublisherEmail2FACode) === null || _a === void 0 ? void 0 : _a.accessKey : undefined,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
catch (e) {
|
|
144
|
-
console.error("Could not verify email", e);
|
|
145
|
-
}
|
|
146
|
-
finally {
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
if (!initialized)
|
|
152
|
-
initialise();
|
|
153
|
-
}, []);
|
|
154
|
-
return {
|
|
155
|
-
initialized,
|
|
156
|
-
send: [
|
|
157
|
-
sendVerificationEmail,
|
|
158
|
-
{ loading: sendLoading, errors: sendErrors },
|
|
159
|
-
],
|
|
160
|
-
verify: [
|
|
161
|
-
verifyVerificationEmail,
|
|
162
|
-
{ loading: verifyLoading, errors: verifyErrors },
|
|
163
|
-
],
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export { useVerificationEmail as u };
|