@saasquatch/mint-components 1.11.0-0 → 1.11.0-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/sqm-banking-info-form_16.cjs.entry.js +47 -58
- package/dist/cjs/{sqm-invoice-table-view-1ea0d1fe.js → sqm-invoice-table-view-c26fb670.js} +5 -8
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +1 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +2 -3
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +30 -39
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +2 -3
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +12 -12
- package/dist/collection/components/tax-and-cash/utils.js +4 -7
- package/dist/esm/sqm-banking-info-form_16.entry.js +47 -58
- package/dist/esm/{sqm-invoice-table-view-6945ea24.js → sqm-invoice-table-view-2175569f.js} +5 -8
- package/dist/esm/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-2175569f.js +1 -0
- 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-03deaf76.entry.js → p-05a9bc83.entry.js} +1 -1
- package/dist/mint-components/p-227dec48.js +1 -0
- package/dist/mint-components/p-3dbf752a.system.entry.js +1 -0
- package/dist/mint-components/p-482bf487.system.js +1 -0
- package/dist/mint-components/{p-e566b746.system.entry.js → p-5301a2da.system.entry.js} +1 -1
- package/dist/mint-components/{p-c6c63bc0.entry.js → p-76b69493.entry.js} +11 -6
- package/dist/mint-components/p-97198e2c.system.js +1 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.d.ts +1 -2
- package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +1 -2
- package/dist/types/components/tax-and-cash/utils.d.ts +2 -2
- package/docs/docs.docx +0 -0
- package/package.json +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-6945ea24.js +0 -1
- package/dist/mint-components/p-869c4ee1.system.entry.js +0 -1
- package/dist/mint-components/p-956cd716.system.js +0 -1
- package/dist/mint-components/p-bfdd2042.js +0 -1
|
@@ -16,7 +16,7 @@ const useChildElements = require('./useChildElements-e0d44916.js');
|
|
|
16
16
|
const luxon = require('./luxon-05098e19.js');
|
|
17
17
|
const useReferralTable = require('./useReferralTable-a76adb0d.js');
|
|
18
18
|
const utils = require('./utils-6847bc06.js');
|
|
19
|
-
const sqmInvoiceTableView = require('./sqm-invoice-table-view-
|
|
19
|
+
const sqmInvoiceTableView = require('./sqm-invoice-table-view-c26fb670.js');
|
|
20
20
|
|
|
21
21
|
const TAX_CONTEXT_NAMESPACE = "sq:tax-and-cash";
|
|
22
22
|
const TAX_FORM_CONTEXT_NAMESPACE = "sq:tax-form-context";
|
|
@@ -1635,7 +1635,13 @@ const GET_TAX_DOCUMENT = index_module.dist.gql `
|
|
|
1635
1635
|
createImpactPublisherTaxDocumentInput: $vars
|
|
1636
1636
|
) {
|
|
1637
1637
|
documentUrl
|
|
1638
|
-
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
`;
|
|
1641
|
+
const COMPLETE_TAX_DOCUMENT = index_module.dist.gql `
|
|
1642
|
+
mutation completeImpactPublisherTaxDocument($vars: UserIdInput!) {
|
|
1643
|
+
completeImpactPublisherTaxDocument(user: $vars) {
|
|
1644
|
+
success
|
|
1639
1645
|
}
|
|
1640
1646
|
}
|
|
1641
1647
|
`;
|
|
@@ -1647,20 +1653,21 @@ const DOCUSIGN_ERROR_STATES = [
|
|
|
1647
1653
|
];
|
|
1648
1654
|
const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
|
|
1649
1655
|
function useDocusignForm(props) {
|
|
1650
|
-
var _a, _b, _c
|
|
1656
|
+
var _a, _b, _c;
|
|
1651
1657
|
const user = index_module.Q();
|
|
1652
1658
|
const context = index_module.In(TAX_FORM_CONTEXT_NAMESPACE);
|
|
1653
1659
|
const [step, setStep] = index_module.bn(TAX_CONTEXT_NAMESPACE);
|
|
1654
1660
|
const { data, loading: userLoading, refetch, } = index_module.Mn(USER_QUERY_NAMESPACE);
|
|
1655
1661
|
const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
|
|
1656
1662
|
const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = index_module.$e(GET_TAX_DOCUMENT);
|
|
1663
|
+
const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = index_module.$e(COMPLETE_TAX_DOCUMENT);
|
|
1657
1664
|
const [docusignStatus, setDocusignStatus] = stencilHooks_module.useState(undefined);
|
|
1658
1665
|
const [participantType, setParticipantType] = stencilHooks_module.useState(undefined);
|
|
1659
1666
|
const [errors, setErrors] = stencilHooks_module.useState({});
|
|
1660
1667
|
const [loading, setLoading] = stencilHooks_module.useState(false);
|
|
1661
1668
|
// Only look at current document if it's valid (same as required type)
|
|
1662
|
-
const existingDocumentType = sqmInvoiceTableView.validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType
|
|
1663
|
-
?
|
|
1669
|
+
const existingDocumentType = sqmInvoiceTableView.validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) && (publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument)
|
|
1670
|
+
? publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType : undefined;
|
|
1664
1671
|
const actualDocumentType = existingDocumentType ||
|
|
1665
1672
|
getDocumentType(participantType) || (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType);
|
|
1666
1673
|
stencilHooks_module.useEffect(() => {
|
|
@@ -1681,6 +1688,7 @@ function useDocusignForm(props) {
|
|
|
1681
1688
|
try {
|
|
1682
1689
|
const result = await createTaxDocument({
|
|
1683
1690
|
vars: {
|
|
1691
|
+
provider: "COMPLY_EXCHANGE",
|
|
1684
1692
|
user: {
|
|
1685
1693
|
id: user.id,
|
|
1686
1694
|
accountId: user.accountId,
|
|
@@ -1699,13 +1707,23 @@ function useDocusignForm(props) {
|
|
|
1699
1707
|
};
|
|
1700
1708
|
fetchDocument();
|
|
1701
1709
|
}, [user, publisher, participantType]);
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1710
|
+
const completeDocument = async () => {
|
|
1711
|
+
if (!user)
|
|
1712
|
+
return;
|
|
1704
1713
|
try {
|
|
1705
1714
|
setLoading(true);
|
|
1706
|
-
await
|
|
1707
|
-
|
|
1708
|
-
|
|
1715
|
+
const result = await completeTaxDocument({
|
|
1716
|
+
vars: {
|
|
1717
|
+
id: user.id,
|
|
1718
|
+
accountId: user.accountId,
|
|
1719
|
+
},
|
|
1720
|
+
});
|
|
1721
|
+
console.log({ result });
|
|
1722
|
+
if (!result || result.message)
|
|
1723
|
+
throw new Error();
|
|
1724
|
+
// @ts-expect-error: no data type for result
|
|
1725
|
+
if (!result.completeImpactPublisherTaxDocument.success)
|
|
1726
|
+
throw new Error();
|
|
1709
1727
|
setStep(context.overrideNextStep ||
|
|
1710
1728
|
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
1711
1729
|
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
@@ -1719,32 +1737,6 @@ function useDocusignForm(props) {
|
|
|
1719
1737
|
setLoading(false);
|
|
1720
1738
|
}
|
|
1721
1739
|
};
|
|
1722
|
-
// useEffect(() => {
|
|
1723
|
-
// const onSubmit = async () => {
|
|
1724
|
-
// try {
|
|
1725
|
-
// setLoading(true);
|
|
1726
|
-
// await refetch();
|
|
1727
|
-
// // Skip banking info form if it already is saved
|
|
1728
|
-
// // or if brandedSignup is false
|
|
1729
|
-
// setStep(
|
|
1730
|
-
// context.overrideNextStep ||
|
|
1731
|
-
// !!publisher?.withdrawalSettings ||
|
|
1732
|
-
// !publisher?.brandedSignup
|
|
1733
|
-
// ? "/dashboard"
|
|
1734
|
-
// : "/4"
|
|
1735
|
-
// );
|
|
1736
|
-
// } catch (e) {
|
|
1737
|
-
// setErrors({ general: true });
|
|
1738
|
-
// } finally {
|
|
1739
|
-
// setLoading(false);
|
|
1740
|
-
// }
|
|
1741
|
-
// };
|
|
1742
|
-
// // Handled in view
|
|
1743
|
-
// if (DOCUSIGN_ERROR_STATES.includes(docusignStatus)) return;
|
|
1744
|
-
// if (DOCUSIGN_SUCCESS_STATES.includes(docusignStatus)) {
|
|
1745
|
-
// onSubmit();
|
|
1746
|
-
// }
|
|
1747
|
-
// }, [docusignStatus, refetch]);
|
|
1748
1740
|
const allLoading = userLoading || documentLoading || loading;
|
|
1749
1741
|
return {
|
|
1750
1742
|
states: {
|
|
@@ -1752,7 +1744,7 @@ function useDocusignForm(props) {
|
|
|
1752
1744
|
hideSteps: context.hideSteps,
|
|
1753
1745
|
disabled: allLoading,
|
|
1754
1746
|
participantTypeDisabled: allLoading || !!existingDocumentType,
|
|
1755
|
-
loading: userLoading || loading,
|
|
1747
|
+
loading: userLoading || loading || completeDocumentLoading,
|
|
1756
1748
|
urlLoading: documentLoading,
|
|
1757
1749
|
loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
|
|
1758
1750
|
formState: {
|
|
@@ -1766,12 +1758,11 @@ function useDocusignForm(props) {
|
|
|
1766
1758
|
},
|
|
1767
1759
|
data: {
|
|
1768
1760
|
taxForm: actualDocumentType,
|
|
1769
|
-
documentUrl: (
|
|
1770
|
-
returnUrl: (_f = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
1761
|
+
documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
|
|
1771
1762
|
},
|
|
1772
1763
|
callbacks: {
|
|
1773
1764
|
setDocusignStatus,
|
|
1774
|
-
|
|
1765
|
+
completeDocument,
|
|
1775
1766
|
setParticipantType,
|
|
1776
1767
|
},
|
|
1777
1768
|
text: props.getTextProps(),
|
|
@@ -1857,7 +1848,7 @@ const DocusignIframe = ({ states, data, callbacks, text, }) => {
|
|
|
1857
1848
|
if (!allowed)
|
|
1858
1849
|
return;
|
|
1859
1850
|
if (e.data === "Complyexchange Thank you page Exit") {
|
|
1860
|
-
callbacks.
|
|
1851
|
+
callbacks.completeDocument();
|
|
1861
1852
|
}
|
|
1862
1853
|
}, []);
|
|
1863
1854
|
stencilHooks_module.useEffect(() => {
|
|
@@ -2182,9 +2173,8 @@ const DocusignForm = class {
|
|
|
2182
2173
|
urlLoading: props.states.urlLoading,
|
|
2183
2174
|
}, data: {
|
|
2184
2175
|
documentUrl: props.data.documentUrl,
|
|
2185
|
-
returnUrl: props.data.returnUrl,
|
|
2186
2176
|
}, callbacks: {
|
|
2187
|
-
|
|
2177
|
+
completeDocument: props.callbacks.completeDocument,
|
|
2188
2178
|
}, text: props.text }));
|
|
2189
2179
|
return (index.h(index.Host, null, index.h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
|
|
2190
2180
|
docusignIframeSlot: _isDemo
|
|
@@ -2532,7 +2522,7 @@ function useIndirectTaxForm(props) {
|
|
|
2532
2522
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
2533
2523
|
};
|
|
2534
2524
|
const onSubmit = async (event) => {
|
|
2535
|
-
var _a, _b, _c, _d, _e
|
|
2525
|
+
var _a, _b, _c, _d, _e;
|
|
2536
2526
|
if (!option) {
|
|
2537
2527
|
setErrors({ taxDetails: true });
|
|
2538
2528
|
return;
|
|
@@ -2593,7 +2583,7 @@ function useIndirectTaxForm(props) {
|
|
|
2593
2583
|
await refetch();
|
|
2594
2584
|
const resultPublisher = (_e = (_d = (_c = result
|
|
2595
2585
|
.createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
|
|
2596
|
-
const hasValidCurrentDocument = sqmInvoiceTableView.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType
|
|
2586
|
+
const hasValidCurrentDocument = sqmInvoiceTableView.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
2597
2587
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
2598
2588
|
!hasValidCurrentDocument) {
|
|
2599
2589
|
// Go to docusign form
|
|
@@ -3733,8 +3723,7 @@ function getCurrentStep(user) {
|
|
|
3733
3723
|
}
|
|
3734
3724
|
const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, } = user.impactConnection.publisher;
|
|
3735
3725
|
// If they do have a required document, look at current document
|
|
3736
|
-
if (requiredTaxDocumentType &&
|
|
3737
|
-
!sqmInvoiceTableView.validTaxDocument(requiredTaxDocumentType, currentTaxDocument === null || currentTaxDocument === void 0 ? void 0 : currentTaxDocument.type))
|
|
3726
|
+
if (requiredTaxDocumentType && !currentTaxDocument)
|
|
3738
3727
|
return "/3";
|
|
3739
3728
|
if (!withdrawalSettings && brandedSignup)
|
|
3740
3729
|
return "/4";
|
|
@@ -5181,7 +5170,7 @@ function getIndirectTaxType(taxInformation) {
|
|
|
5181
5170
|
return "Indirect Tax";
|
|
5182
5171
|
}
|
|
5183
5172
|
const useTaxAndCashDashboard = (props) => {
|
|
5184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
5173
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5185
5174
|
const setStep = index_module.wn(TAX_CONTEXT_NAMESPACE);
|
|
5186
5175
|
const setContext = index_module.wn(TAX_FORM_CONTEXT_NAMESPACE);
|
|
5187
5176
|
const [showDialog, setShowDialog] = stencilHooks_module.useState(false);
|
|
@@ -5192,8 +5181,8 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
5192
5181
|
}, []);
|
|
5193
5182
|
const { data, loading, errors: userError, } = index_module.Mn(USER_QUERY_NAMESPACE);
|
|
5194
5183
|
const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
|
|
5195
|
-
const documentType =
|
|
5196
|
-
const submissionDate = (
|
|
5184
|
+
const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
|
|
5185
|
+
const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
|
|
5197
5186
|
const dateSubmitted = submissionDate
|
|
5198
5187
|
? luxon.luxon.DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy")
|
|
5199
5188
|
: undefined;
|
|
@@ -5214,23 +5203,23 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
5214
5203
|
});
|
|
5215
5204
|
setStep("/3");
|
|
5216
5205
|
};
|
|
5217
|
-
const provinceName = (
|
|
5206
|
+
const provinceName = (_d = sqmInvoiceTableView.INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _d === void 0 ? void 0 : _d.displayName;
|
|
5218
5207
|
return {
|
|
5219
5208
|
states: {
|
|
5220
5209
|
dateSubmitted,
|
|
5221
5210
|
documentType,
|
|
5222
5211
|
canEditPayoutInfo: publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup,
|
|
5223
5212
|
documentTypeString: sqmInvoiceTableView.taxTypeToName(documentType),
|
|
5224
|
-
status: (
|
|
5225
|
-
subRegion: getSubRegionName((
|
|
5226
|
-
subRegionTaxNumber: (
|
|
5227
|
-
qstNumber: (
|
|
5213
|
+
status: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _e === void 0 ? void 0 : _e.status,
|
|
5214
|
+
subRegion: getSubRegionName((_f = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _f === void 0 ? void 0 : _f.indirectTaxRegion),
|
|
5215
|
+
subRegionTaxNumber: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.withholdingTaxId,
|
|
5216
|
+
qstNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.additionalTaxId,
|
|
5228
5217
|
indirectTaxType: getIndirectTaxType(publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation),
|
|
5229
|
-
indirectTaxNumber: (
|
|
5218
|
+
indirectTaxNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.indirectTaxId,
|
|
5230
5219
|
isBusinessEntity: (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) === "W8BENE",
|
|
5231
5220
|
province: provinceName,
|
|
5232
|
-
country: getCountryName((
|
|
5233
|
-
notRegistered: !((
|
|
5221
|
+
country: getCountryName((_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxCountryCode, locale),
|
|
5222
|
+
notRegistered: !((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxId),
|
|
5234
5223
|
noFormNeeded: !documentType,
|
|
5235
5224
|
disabled: loading,
|
|
5236
5225
|
loading,
|
|
@@ -434,11 +434,9 @@ const LoadingView = () => {
|
|
|
434
434
|
index.h("sl-skeleton", { class: sheet.classes.ButtonSkeleton })));
|
|
435
435
|
};
|
|
436
436
|
|
|
437
|
-
function validTaxDocument(requiredType
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if ((requiredType === "W8BEN" || requiredType === "W8BENE") &&
|
|
441
|
-
(currentType === "W8BEN" || currentType === "W8BENE"))
|
|
437
|
+
function validTaxDocument(requiredType) {
|
|
438
|
+
const validTypes = ["W9", "W8BENE", "W8BEN"];
|
|
439
|
+
if (validTypes.includes(requiredType))
|
|
442
440
|
return true;
|
|
443
441
|
return false;
|
|
444
442
|
}
|
|
@@ -450,9 +448,8 @@ const taxTypeToName = (taxType) => {
|
|
|
450
448
|
case "W9":
|
|
451
449
|
return "W-9";
|
|
452
450
|
case "W8BEN":
|
|
453
|
-
return "W-8 BEN";
|
|
454
451
|
case "W8BENE":
|
|
455
|
-
return "W-8
|
|
452
|
+
return "W-8";
|
|
456
453
|
default:
|
|
457
454
|
return "";
|
|
458
455
|
}
|
|
@@ -743,7 +740,7 @@ const docusignFormProps = {
|
|
|
743
740
|
},
|
|
744
741
|
},
|
|
745
742
|
callbacks: {
|
|
746
|
-
|
|
743
|
+
completeDocument: async () => { },
|
|
747
744
|
setParticipantType: (p) => console.log({ p }),
|
|
748
745
|
setDocusignStatus: (status) => console.log(status),
|
|
749
746
|
},
|
|
@@ -30,7 +30,7 @@ const sqmPortalResetPasswordView = require('./sqm-portal-reset-password-view-96f
|
|
|
30
30
|
const sqmPortalVerifyEmailView = require('./sqm-portal-verify-email-view-7ffcc0d4.js');
|
|
31
31
|
const ShadowViewAddon = require('./ShadowViewAddon-21aa34f8.js');
|
|
32
32
|
const sqmPortalContainerView = require('./sqm-portal-container-view-5fb2ad49.js');
|
|
33
|
-
const sqmInvoiceTableView = require('./sqm-invoice-table-view-
|
|
33
|
+
const sqmInvoiceTableView = require('./sqm-invoice-table-view-c26fb670.js');
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -136,9 +136,8 @@ export class DocusignForm {
|
|
|
136
136
|
urlLoading: props.states.urlLoading,
|
|
137
137
|
}, data: {
|
|
138
138
|
documentUrl: props.data.documentUrl,
|
|
139
|
-
returnUrl: props.data.returnUrl,
|
|
140
139
|
}, callbacks: {
|
|
141
|
-
|
|
140
|
+
completeDocument: props.callbacks.completeDocument,
|
|
142
141
|
}, text: props.text }));
|
|
143
142
|
return (h(Host, null,
|
|
144
143
|
h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
|
|
@@ -562,7 +561,7 @@ export class DocusignForm {
|
|
|
562
561
|
"mutable": false,
|
|
563
562
|
"complexType": {
|
|
564
563
|
"original": "DemoData<UseDocusignFormResult>",
|
|
565
|
-
"resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; participantTypeDisabled: boolean; loading: boolean; urlLoading: boolean; loadingError: boolean; formState: { participantType: ParticipantType; taxFormExpired: boolean; errors: {}; }; docusignStatus: DocusignStatus; documentType: TaxDocumentType; documentTypeString: string; }; data?: { taxForm: TaxDocumentType; documentUrl: string;
|
|
564
|
+
"resolved": "{ states?: { step: string; hideSteps: boolean; disabled: boolean; participantTypeDisabled: boolean; loading: boolean; urlLoading: boolean; loadingError: boolean; formState: { participantType: ParticipantType; taxFormExpired: boolean; errors: {}; }; docusignStatus: DocusignStatus; documentType: TaxDocumentType; documentTypeString: string; }; data?: { taxForm: TaxDocumentType; documentUrl: string; }; }",
|
|
566
565
|
"references": {
|
|
567
566
|
"DemoData": {
|
|
568
567
|
"location": "import",
|
|
@@ -11,7 +11,13 @@ const GET_TAX_DOCUMENT = gql `
|
|
|
11
11
|
createImpactPublisherTaxDocumentInput: $vars
|
|
12
12
|
) {
|
|
13
13
|
documentUrl
|
|
14
|
-
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const COMPLETE_TAX_DOCUMENT = gql `
|
|
18
|
+
mutation completeImpactPublisherTaxDocument($vars: UserIdInput!) {
|
|
19
|
+
completeImpactPublisherTaxDocument(user: $vars) {
|
|
20
|
+
success
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
`;
|
|
@@ -24,20 +30,21 @@ export const DOCUSIGN_ERROR_STATES = [
|
|
|
24
30
|
export const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
|
|
25
31
|
export const DOCUSIGN_SUCCESS_STATES = ["signing_complete", "viewing_complete"];
|
|
26
32
|
export function useDocusignForm(props) {
|
|
27
|
-
var _a, _b, _c
|
|
33
|
+
var _a, _b, _c;
|
|
28
34
|
const user = useUserIdentity();
|
|
29
35
|
const context = useParentValue(TAX_FORM_CONTEXT_NAMESPACE);
|
|
30
36
|
const [step, setStep] = useParent(TAX_CONTEXT_NAMESPACE);
|
|
31
37
|
const { data, loading: userLoading, refetch, } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
32
38
|
const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
|
|
33
39
|
const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = useMutation(GET_TAX_DOCUMENT);
|
|
40
|
+
const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = useMutation(COMPLETE_TAX_DOCUMENT);
|
|
34
41
|
const [docusignStatus, setDocusignStatus] = useState(undefined);
|
|
35
42
|
const [participantType, setParticipantType] = useState(undefined);
|
|
36
43
|
const [errors, setErrors] = useState({});
|
|
37
44
|
const [loading, setLoading] = useState(false);
|
|
38
45
|
// Only look at current document if it's valid (same as required type)
|
|
39
|
-
const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType
|
|
40
|
-
?
|
|
46
|
+
const existingDocumentType = validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) && (publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument)
|
|
47
|
+
? publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType : undefined;
|
|
41
48
|
const actualDocumentType = existingDocumentType ||
|
|
42
49
|
getDocumentType(participantType) || (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType);
|
|
43
50
|
useEffect(() => {
|
|
@@ -58,6 +65,7 @@ export function useDocusignForm(props) {
|
|
|
58
65
|
try {
|
|
59
66
|
const result = await createTaxDocument({
|
|
60
67
|
vars: {
|
|
68
|
+
provider: "COMPLY_EXCHANGE",
|
|
61
69
|
user: {
|
|
62
70
|
id: user.id,
|
|
63
71
|
accountId: user.accountId,
|
|
@@ -76,13 +84,23 @@ export function useDocusignForm(props) {
|
|
|
76
84
|
};
|
|
77
85
|
fetchDocument();
|
|
78
86
|
}, [user, publisher, participantType]);
|
|
79
|
-
const
|
|
80
|
-
|
|
87
|
+
const completeDocument = async () => {
|
|
88
|
+
if (!user)
|
|
89
|
+
return;
|
|
81
90
|
try {
|
|
82
91
|
setLoading(true);
|
|
83
|
-
await
|
|
84
|
-
|
|
85
|
-
|
|
92
|
+
const result = await completeTaxDocument({
|
|
93
|
+
vars: {
|
|
94
|
+
id: user.id,
|
|
95
|
+
accountId: user.accountId,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
console.log({ result });
|
|
99
|
+
if (!result || result.message)
|
|
100
|
+
throw new Error();
|
|
101
|
+
// @ts-expect-error: no data type for result
|
|
102
|
+
if (!result.completeImpactPublisherTaxDocument.success)
|
|
103
|
+
throw new Error();
|
|
86
104
|
setStep(context.overrideNextStep ||
|
|
87
105
|
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
88
106
|
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
@@ -96,32 +114,6 @@ export function useDocusignForm(props) {
|
|
|
96
114
|
setLoading(false);
|
|
97
115
|
}
|
|
98
116
|
};
|
|
99
|
-
// useEffect(() => {
|
|
100
|
-
// const onSubmit = async () => {
|
|
101
|
-
// try {
|
|
102
|
-
// setLoading(true);
|
|
103
|
-
// await refetch();
|
|
104
|
-
// // Skip banking info form if it already is saved
|
|
105
|
-
// // or if brandedSignup is false
|
|
106
|
-
// setStep(
|
|
107
|
-
// context.overrideNextStep ||
|
|
108
|
-
// !!publisher?.withdrawalSettings ||
|
|
109
|
-
// !publisher?.brandedSignup
|
|
110
|
-
// ? "/dashboard"
|
|
111
|
-
// : "/4"
|
|
112
|
-
// );
|
|
113
|
-
// } catch (e) {
|
|
114
|
-
// setErrors({ general: true });
|
|
115
|
-
// } finally {
|
|
116
|
-
// setLoading(false);
|
|
117
|
-
// }
|
|
118
|
-
// };
|
|
119
|
-
// // Handled in view
|
|
120
|
-
// if (DOCUSIGN_ERROR_STATES.includes(docusignStatus)) return;
|
|
121
|
-
// if (DOCUSIGN_SUCCESS_STATES.includes(docusignStatus)) {
|
|
122
|
-
// onSubmit();
|
|
123
|
-
// }
|
|
124
|
-
// }, [docusignStatus, refetch]);
|
|
125
117
|
const allLoading = userLoading || documentLoading || loading;
|
|
126
118
|
return {
|
|
127
119
|
states: {
|
|
@@ -129,7 +121,7 @@ export function useDocusignForm(props) {
|
|
|
129
121
|
hideSteps: context.hideSteps,
|
|
130
122
|
disabled: allLoading,
|
|
131
123
|
participantTypeDisabled: allLoading || !!existingDocumentType,
|
|
132
|
-
loading: userLoading || loading,
|
|
124
|
+
loading: userLoading || loading || completeDocumentLoading,
|
|
133
125
|
urlLoading: documentLoading,
|
|
134
126
|
loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
|
|
135
127
|
formState: {
|
|
@@ -143,12 +135,11 @@ export function useDocusignForm(props) {
|
|
|
143
135
|
},
|
|
144
136
|
data: {
|
|
145
137
|
taxForm: actualDocumentType,
|
|
146
|
-
documentUrl: (
|
|
147
|
-
returnUrl: (_f = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
138
|
+
documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
|
|
148
139
|
},
|
|
149
140
|
callbacks: {
|
|
150
141
|
setDocusignStatus,
|
|
151
|
-
|
|
142
|
+
completeDocument,
|
|
152
143
|
setParticipantType,
|
|
153
144
|
},
|
|
154
145
|
text: props.getTextProps(),
|
|
@@ -107,7 +107,7 @@ export function useIndirectTaxForm(props) {
|
|
|
107
107
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
108
108
|
};
|
|
109
109
|
const onSubmit = async (event) => {
|
|
110
|
-
var _a, _b, _c, _d, _e
|
|
110
|
+
var _a, _b, _c, _d, _e;
|
|
111
111
|
if (!option) {
|
|
112
112
|
setErrors({ taxDetails: true });
|
|
113
113
|
return;
|
|
@@ -168,7 +168,7 @@ export function useIndirectTaxForm(props) {
|
|
|
168
168
|
await refetch();
|
|
169
169
|
const resultPublisher = (_e = (_d = (_c = result
|
|
170
170
|
.createImpactConnection) === null || _c === void 0 ? void 0 : _c.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher;
|
|
171
|
-
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType
|
|
171
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
172
172
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
173
173
|
!hasValidCurrentDocument) {
|
|
174
174
|
// Go to docusign form
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getContextValueName, useHost, useLocale, useParentQuery, useParentState, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { useEffect, useMemo } from "@saasquatch/universal-hooks";
|
|
3
|
-
import { getCountryObj
|
|
3
|
+
import { getCountryObj } from "../utils";
|
|
4
4
|
import { COUNTRIES_NAMESPACE, COUNTRIES_QUERY_NAMESPACE, CURRENCIES_NAMESPACE, CURRENCIES_QUERY_NAMESPACE, FINANCE_NETWORK_SETTINGS_NAMESPACE, GET_COUNTRIES, GET_CURRENCIES, GET_FINANCE_NETWORK_SETTINGS, GET_USER, SORTED_COUNTRIES_NAMESPACE, TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAMESPACE, USER_FORM_CONTEXT_NAMESPACE, USER_QUERY_NAMESPACE, } from "./data";
|
|
5
5
|
function getCurrentStep(user) {
|
|
6
6
|
var _a;
|
|
@@ -9,8 +9,7 @@ function getCurrentStep(user) {
|
|
|
9
9
|
}
|
|
10
10
|
const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, } = user.impactConnection.publisher;
|
|
11
11
|
// If they do have a required document, look at current document
|
|
12
|
-
if (requiredTaxDocumentType &&
|
|
13
|
-
!validTaxDocument(requiredTaxDocumentType, currentTaxDocument === null || currentTaxDocument === void 0 ? void 0 : currentTaxDocument.type))
|
|
12
|
+
if (requiredTaxDocumentType && !currentTaxDocument)
|
|
14
13
|
return "/3";
|
|
15
14
|
if (!withdrawalSettings && brandedSignup)
|
|
16
15
|
return "/4";
|
package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useLocale, useParentQueryValue, useSetParent } from "@saasquatch/component-boilerplate";
|
|
1
|
+
import { useLocale, useParentQueryValue, useSetParent, } from "@saasquatch/component-boilerplate";
|
|
2
2
|
import { useEffect, useState } from "@saasquatch/universal-hooks";
|
|
3
3
|
import { DateTime } from "luxon";
|
|
4
4
|
import { vatLabels } from "../countries";
|
|
@@ -40,7 +40,7 @@ function getIndirectTaxType(taxInformation) {
|
|
|
40
40
|
return "Indirect Tax";
|
|
41
41
|
}
|
|
42
42
|
export const useTaxAndCashDashboard = (props) => {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
43
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
44
44
|
const setStep = useSetParent(TAX_CONTEXT_NAMESPACE);
|
|
45
45
|
const setContext = useSetParent(TAX_FORM_CONTEXT_NAMESPACE);
|
|
46
46
|
const [showDialog, setShowDialog] = useState(false);
|
|
@@ -51,8 +51,8 @@ export const useTaxAndCashDashboard = (props) => {
|
|
|
51
51
|
}, []);
|
|
52
52
|
const { data, loading, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
53
53
|
const publisher = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.publisher;
|
|
54
|
-
const documentType =
|
|
55
|
-
const submissionDate = (
|
|
54
|
+
const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
|
|
55
|
+
const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
|
|
56
56
|
const dateSubmitted = submissionDate
|
|
57
57
|
? DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy")
|
|
58
58
|
: undefined;
|
|
@@ -73,23 +73,23 @@ export const useTaxAndCashDashboard = (props) => {
|
|
|
73
73
|
});
|
|
74
74
|
setStep("/3");
|
|
75
75
|
};
|
|
76
|
-
const provinceName = (
|
|
76
|
+
const provinceName = (_d = INDIRECT_TAX_PROVINCES.find((p) => { var _a; return p.regionCode === ((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxRegion); })) === null || _d === void 0 ? void 0 : _d.displayName;
|
|
77
77
|
return {
|
|
78
78
|
states: {
|
|
79
79
|
dateSubmitted,
|
|
80
80
|
documentType,
|
|
81
81
|
canEditPayoutInfo: publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup,
|
|
82
82
|
documentTypeString: taxTypeToName(documentType),
|
|
83
|
-
status: (
|
|
84
|
-
subRegion: getSubRegionName((
|
|
85
|
-
subRegionTaxNumber: (
|
|
86
|
-
qstNumber: (
|
|
83
|
+
status: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _e === void 0 ? void 0 : _e.status,
|
|
84
|
+
subRegion: getSubRegionName((_f = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _f === void 0 ? void 0 : _f.indirectTaxRegion),
|
|
85
|
+
subRegionTaxNumber: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.withholdingTaxId,
|
|
86
|
+
qstNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.additionalTaxId,
|
|
87
87
|
indirectTaxType: getIndirectTaxType(publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation),
|
|
88
|
-
indirectTaxNumber: (
|
|
88
|
+
indirectTaxNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.indirectTaxId,
|
|
89
89
|
isBusinessEntity: (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) === "W8BENE",
|
|
90
90
|
province: provinceName,
|
|
91
|
-
country: getCountryName((
|
|
92
|
-
notRegistered: !((
|
|
91
|
+
country: getCountryName((_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxCountryCode, locale),
|
|
92
|
+
notRegistered: !((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxId),
|
|
93
93
|
noFormNeeded: !documentType,
|
|
94
94
|
disabled: loading,
|
|
95
95
|
loading,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { intl } from "../../global/global";
|
|
2
|
-
export function validTaxDocument(requiredType
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if ((requiredType === "W8BEN" || requiredType === "W8BENE") &&
|
|
6
|
-
(currentType === "W8BEN" || currentType === "W8BENE"))
|
|
2
|
+
export function validTaxDocument(requiredType) {
|
|
3
|
+
const validTypes = ["W9", "W8BENE", "W8BEN"];
|
|
4
|
+
if (validTypes.includes(requiredType))
|
|
7
5
|
return true;
|
|
8
6
|
return false;
|
|
9
7
|
}
|
|
@@ -15,9 +13,8 @@ export const taxTypeToName = (taxType) => {
|
|
|
15
13
|
case "W9":
|
|
16
14
|
return "W-9";
|
|
17
15
|
case "W8BEN":
|
|
18
|
-
return "W-8 BEN";
|
|
19
16
|
case "W8BENE":
|
|
20
|
-
return "W-8
|
|
17
|
+
return "W-8";
|
|
21
18
|
default:
|
|
22
19
|
return "";
|
|
23
20
|
}
|