@saasquatch/mint-components 1.11.0-0 → 1.11.0-2
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 +74 -79
- package/dist/cjs/{sqm-invoice-table-view-1ea0d1fe.js → sqm-invoice-table-view-7739a5b4.js} +6 -8
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +1 -1
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +2 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js +4 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form-view.js +1 -5
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/sqm-docusign-form.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +36 -43
- 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/data.js +14 -13
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +5 -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 +74 -79
- package/dist/esm/{sqm-invoice-table-view-6945ea24.js → sqm-invoice-table-view-fb2f95b9.js} +6 -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-fb2f95b9.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-28b6106f.js +1 -0
- package/dist/mint-components/p-51721f6b.system.js +1 -0
- package/dist/mint-components/{p-03deaf76.entry.js → p-70232f5f.entry.js} +1 -1
- package/dist/mint-components/p-97198e2c.system.js +1 -1
- package/dist/mint-components/{p-c6c63bc0.entry.js → p-b19524e2.entry.js} +25 -19
- package/dist/mint-components/p-ce523fb3.system.entry.js +1 -0
- package/dist/mint-components/{p-e566b746.system.entry.js → p-e17d1ed7.system.entry.js} +1 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.d.ts +1 -1
- package/dist/types/components/tax-and-cash/sqm-docusign-form/useDocusignForm.d.ts +2 -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-7739a5b4.js');
|
|
20
20
|
|
|
21
21
|
const TAX_CONTEXT_NAMESPACE = "sq:tax-and-cash";
|
|
22
22
|
const TAX_FORM_CONTEXT_NAMESPACE = "sq:tax-form-context";
|
|
@@ -69,19 +69,20 @@ const GET_USER = index_module.dist.gql `
|
|
|
69
69
|
type
|
|
70
70
|
dateCreated
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
# !!!!! UNCOMMENT ME !!!!!!!!
|
|
73
|
+
# withdrawalSettings {
|
|
74
|
+
# paymentMethod
|
|
75
|
+
# paypalEmailAddress
|
|
76
|
+
# bankCountry
|
|
77
|
+
# bankAccountNumber
|
|
78
|
+
# paymentSchedulingType
|
|
79
|
+
# paymentThreshold
|
|
80
|
+
# paymentDay
|
|
81
|
+
# }
|
|
82
|
+
# payoutsAccount {
|
|
83
|
+
# hold
|
|
84
|
+
# balance
|
|
85
|
+
# }
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -1635,7 +1636,13 @@ const GET_TAX_DOCUMENT = index_module.dist.gql `
|
|
|
1635
1636
|
createImpactPublisherTaxDocumentInput: $vars
|
|
1636
1637
|
) {
|
|
1637
1638
|
documentUrl
|
|
1638
|
-
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
`;
|
|
1642
|
+
const COMPLETE_TAX_DOCUMENT = index_module.dist.gql `
|
|
1643
|
+
mutation completeImpactPublisherTaxDocument($vars: UserIdInput!) {
|
|
1644
|
+
completeImpactPublisherTaxDocument(user: $vars) {
|
|
1645
|
+
success
|
|
1639
1646
|
}
|
|
1640
1647
|
}
|
|
1641
1648
|
`;
|
|
@@ -1647,20 +1654,21 @@ const DOCUSIGN_ERROR_STATES = [
|
|
|
1647
1654
|
];
|
|
1648
1655
|
const DOCUSIGN_EXPIRED_STATES = ["ttl_expired", "session_timeout"];
|
|
1649
1656
|
function useDocusignForm(props) {
|
|
1650
|
-
var _a, _b, _c
|
|
1657
|
+
var _a, _b, _c;
|
|
1651
1658
|
const user = index_module.Q();
|
|
1652
1659
|
const context = index_module.In(TAX_FORM_CONTEXT_NAMESPACE);
|
|
1653
1660
|
const [step, setStep] = index_module.bn(TAX_CONTEXT_NAMESPACE);
|
|
1654
1661
|
const { data, loading: userLoading, refetch, } = index_module.Mn(USER_QUERY_NAMESPACE);
|
|
1655
1662
|
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
1663
|
const [createTaxDocument, { loading: documentLoading, data: document, errors: documentErrors },] = index_module.$e(GET_TAX_DOCUMENT);
|
|
1664
|
+
const [completeTaxDocument, { loading: completeDocumentLoading, data: completeData, errors: completeErrors, },] = index_module.$e(COMPLETE_TAX_DOCUMENT);
|
|
1657
1665
|
const [docusignStatus, setDocusignStatus] = stencilHooks_module.useState(undefined);
|
|
1658
1666
|
const [participantType, setParticipantType] = stencilHooks_module.useState(undefined);
|
|
1659
1667
|
const [errors, setErrors] = stencilHooks_module.useState({});
|
|
1660
1668
|
const [loading, setLoading] = stencilHooks_module.useState(false);
|
|
1661
1669
|
// 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
|
-
?
|
|
1670
|
+
const existingDocumentType = sqmInvoiceTableView.validTaxDocument(publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) && (publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument)
|
|
1671
|
+
? publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType : undefined;
|
|
1664
1672
|
const actualDocumentType = existingDocumentType ||
|
|
1665
1673
|
getDocumentType(participantType) || (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType);
|
|
1666
1674
|
stencilHooks_module.useEffect(() => {
|
|
@@ -1681,6 +1689,7 @@ function useDocusignForm(props) {
|
|
|
1681
1689
|
try {
|
|
1682
1690
|
const result = await createTaxDocument({
|
|
1683
1691
|
vars: {
|
|
1692
|
+
provider: "COMPLY_EXCHANGE",
|
|
1684
1693
|
user: {
|
|
1685
1694
|
id: user.id,
|
|
1686
1695
|
accountId: user.accountId,
|
|
@@ -1699,18 +1708,22 @@ function useDocusignForm(props) {
|
|
|
1699
1708
|
};
|
|
1700
1709
|
fetchDocument();
|
|
1701
1710
|
}, [user, publisher, participantType]);
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1711
|
+
const completeDocument = async () => {
|
|
1712
|
+
if (!user)
|
|
1713
|
+
return;
|
|
1704
1714
|
try {
|
|
1705
1715
|
setLoading(true);
|
|
1706
|
-
await
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1716
|
+
const result = await completeTaxDocument({
|
|
1717
|
+
vars: {
|
|
1718
|
+
id: user.id,
|
|
1719
|
+
accountId: user.accountId,
|
|
1720
|
+
},
|
|
1721
|
+
});
|
|
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();
|
|
1714
1727
|
}
|
|
1715
1728
|
catch (e) {
|
|
1716
1729
|
setErrors({ general: true });
|
|
@@ -1719,32 +1732,13 @@ function useDocusignForm(props) {
|
|
|
1719
1732
|
setLoading(false);
|
|
1720
1733
|
}
|
|
1721
1734
|
};
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
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]);
|
|
1735
|
+
const progressStep = () => {
|
|
1736
|
+
setStep(context.overrideNextStep ||
|
|
1737
|
+
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
1738
|
+
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
1739
|
+
? "/dashboard"
|
|
1740
|
+
: "/4");
|
|
1741
|
+
};
|
|
1748
1742
|
const allLoading = userLoading || documentLoading || loading;
|
|
1749
1743
|
return {
|
|
1750
1744
|
states: {
|
|
@@ -1752,7 +1746,7 @@ function useDocusignForm(props) {
|
|
|
1752
1746
|
hideSteps: context.hideSteps,
|
|
1753
1747
|
disabled: allLoading,
|
|
1754
1748
|
participantTypeDisabled: allLoading || !!existingDocumentType,
|
|
1755
|
-
loading: userLoading || loading,
|
|
1749
|
+
loading: userLoading || loading || completeDocumentLoading,
|
|
1756
1750
|
urlLoading: documentLoading,
|
|
1757
1751
|
loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
|
|
1758
1752
|
formState: {
|
|
@@ -1766,11 +1760,11 @@ function useDocusignForm(props) {
|
|
|
1766
1760
|
},
|
|
1767
1761
|
data: {
|
|
1768
1762
|
taxForm: actualDocumentType,
|
|
1769
|
-
documentUrl: (
|
|
1770
|
-
returnUrl: (_f = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
1763
|
+
documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
|
|
1771
1764
|
},
|
|
1772
1765
|
callbacks: {
|
|
1773
1766
|
setDocusignStatus,
|
|
1767
|
+
completeDocument,
|
|
1774
1768
|
progressStep,
|
|
1775
1769
|
setParticipantType,
|
|
1776
1770
|
},
|
|
@@ -1856,7 +1850,10 @@ const DocusignIframe = ({ states, data, callbacks, text, }) => {
|
|
|
1856
1850
|
const allowed = allowedDomains.some((d) => { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.includes(d); });
|
|
1857
1851
|
if (!allowed)
|
|
1858
1852
|
return;
|
|
1859
|
-
if (e.data === "Complyexchange Thank you page
|
|
1853
|
+
if (e.data === "Complyexchange Thank you page Load") {
|
|
1854
|
+
callbacks.completeDocument();
|
|
1855
|
+
}
|
|
1856
|
+
if (e.data == "Complyexchange Thank you page Exit") {
|
|
1860
1857
|
callbacks.progressStep();
|
|
1861
1858
|
}
|
|
1862
1859
|
}, []);
|
|
@@ -2050,11 +2047,7 @@ const DocusignFormView = (props) => {
|
|
|
2050
2047
|
? text.taxFormDescriptionIndividualParticipant
|
|
2051
2048
|
: text.taxFormDescriptionBusinessEntity,
|
|
2052
2049
|
}, { documentType: documentTypeString }))),
|
|
2053
|
-
index.h("div", null,
|
|
2054
|
-
index.h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "primary", open: true, class: classes.InfoAlert },
|
|
2055
|
-
index.h("sl-icon", { class: classes.InfoIcon, slot: "icon", name: "info-circle" }),
|
|
2056
|
-
text.docusignSessionWarning),
|
|
2057
|
-
slots.docusignIframeSlot))));
|
|
2050
|
+
index.h("div", null, slots.docusignIframeSlot))));
|
|
2058
2051
|
};
|
|
2059
2052
|
|
|
2060
2053
|
const DocusignForm = class {
|
|
@@ -2182,9 +2175,9 @@ const DocusignForm = class {
|
|
|
2182
2175
|
urlLoading: props.states.urlLoading,
|
|
2183
2176
|
}, data: {
|
|
2184
2177
|
documentUrl: props.data.documentUrl,
|
|
2185
|
-
returnUrl: props.data.returnUrl,
|
|
2186
2178
|
}, callbacks: {
|
|
2187
2179
|
progressStep: props.callbacks.progressStep,
|
|
2180
|
+
completeDocument: props.callbacks.completeDocument,
|
|
2188
2181
|
}, text: props.text }));
|
|
2189
2182
|
return (index.h(index.Host, null, index.h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
|
|
2190
2183
|
docusignIframeSlot: _isDemo
|
|
@@ -2532,7 +2525,7 @@ function useIndirectTaxForm(props) {
|
|
|
2532
2525
|
setFormState((p) => ({ ...p, [field]: value }));
|
|
2533
2526
|
};
|
|
2534
2527
|
const onSubmit = async (event) => {
|
|
2535
|
-
var _a, _b, _c, _d, _e
|
|
2528
|
+
var _a, _b, _c, _d, _e;
|
|
2536
2529
|
if (!option) {
|
|
2537
2530
|
setErrors({ taxDetails: true });
|
|
2538
2531
|
return;
|
|
@@ -2593,7 +2586,7 @@ function useIndirectTaxForm(props) {
|
|
|
2593
2586
|
await refetch();
|
|
2594
2587
|
const resultPublisher = (_e = (_d = (_c = result
|
|
2595
2588
|
.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
|
|
2589
|
+
const hasValidCurrentDocument = sqmInvoiceTableView.validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
2597
2590
|
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
2598
2591
|
!hasValidCurrentDocument) {
|
|
2599
2592
|
// Go to docusign form
|
|
@@ -3733,8 +3726,7 @@ function getCurrentStep(user) {
|
|
|
3733
3726
|
}
|
|
3734
3727
|
const { requiredTaxDocumentType, currentTaxDocument, withdrawalSettings, brandedSignup, } = user.impactConnection.publisher;
|
|
3735
3728
|
// 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))
|
|
3729
|
+
if (requiredTaxDocumentType && !currentTaxDocument)
|
|
3738
3730
|
return "/3";
|
|
3739
3731
|
if (!withdrawalSettings && brandedSignup)
|
|
3740
3732
|
return "/4";
|
|
@@ -3782,6 +3774,9 @@ function useTaxAndCash() {
|
|
|
3782
3774
|
namespace: USER_QUERY_NAMESPACE,
|
|
3783
3775
|
query: GET_USER,
|
|
3784
3776
|
skip: !user,
|
|
3777
|
+
options: {
|
|
3778
|
+
batch: false,
|
|
3779
|
+
},
|
|
3785
3780
|
});
|
|
3786
3781
|
const countryCode = ((_c = (_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) === null || _c === void 0 ? void 0 : _c.countryCode) ||
|
|
3787
3782
|
userFormContext.countryCode;
|
|
@@ -5181,7 +5176,7 @@ function getIndirectTaxType(taxInformation) {
|
|
|
5181
5176
|
return "Indirect Tax";
|
|
5182
5177
|
}
|
|
5183
5178
|
const useTaxAndCashDashboard = (props) => {
|
|
5184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
5179
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
5185
5180
|
const setStep = index_module.wn(TAX_CONTEXT_NAMESPACE);
|
|
5186
5181
|
const setContext = index_module.wn(TAX_FORM_CONTEXT_NAMESPACE);
|
|
5187
5182
|
const [showDialog, setShowDialog] = stencilHooks_module.useState(false);
|
|
@@ -5192,8 +5187,8 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
5192
5187
|
}, []);
|
|
5193
5188
|
const { data, loading, errors: userError, } = index_module.Mn(USER_QUERY_NAMESPACE);
|
|
5194
5189
|
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 = (
|
|
5190
|
+
const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
|
|
5191
|
+
const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
|
|
5197
5192
|
const dateSubmitted = submissionDate
|
|
5198
5193
|
? luxon.luxon.DateTime.fromMillis(submissionDate).toFormat("LLL dd, yyyy")
|
|
5199
5194
|
: undefined;
|
|
@@ -5214,23 +5209,23 @@ const useTaxAndCashDashboard = (props) => {
|
|
|
5214
5209
|
});
|
|
5215
5210
|
setStep("/3");
|
|
5216
5211
|
};
|
|
5217
|
-
const provinceName = (
|
|
5212
|
+
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
5213
|
return {
|
|
5219
5214
|
states: {
|
|
5220
5215
|
dateSubmitted,
|
|
5221
5216
|
documentType,
|
|
5222
5217
|
canEditPayoutInfo: publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup,
|
|
5223
5218
|
documentTypeString: sqmInvoiceTableView.taxTypeToName(documentType),
|
|
5224
|
-
status: (
|
|
5225
|
-
subRegion: getSubRegionName((
|
|
5226
|
-
subRegionTaxNumber: (
|
|
5227
|
-
qstNumber: (
|
|
5219
|
+
status: (_e = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _e === void 0 ? void 0 : _e.status,
|
|
5220
|
+
subRegion: getSubRegionName((_f = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _f === void 0 ? void 0 : _f.indirectTaxRegion),
|
|
5221
|
+
subRegionTaxNumber: (_g = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _g === void 0 ? void 0 : _g.withholdingTaxId,
|
|
5222
|
+
qstNumber: (_h = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _h === void 0 ? void 0 : _h.additionalTaxId,
|
|
5228
5223
|
indirectTaxType: getIndirectTaxType(publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation),
|
|
5229
|
-
indirectTaxNumber: (
|
|
5224
|
+
indirectTaxNumber: (_j = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _j === void 0 ? void 0 : _j.indirectTaxId,
|
|
5230
5225
|
isBusinessEntity: (publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType) === "W8BENE",
|
|
5231
5226
|
province: provinceName,
|
|
5232
|
-
country: getCountryName((
|
|
5233
|
-
notRegistered: !((
|
|
5227
|
+
country: getCountryName((_k = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _k === void 0 ? void 0 : _k.indirectTaxCountryCode, locale),
|
|
5228
|
+
notRegistered: !((_l = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _l === void 0 ? void 0 : _l.indirectTaxId),
|
|
5234
5229
|
noFormNeeded: !documentType,
|
|
5235
5230
|
disabled: loading,
|
|
5236
5231
|
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,8 @@ const docusignFormProps = {
|
|
|
743
740
|
},
|
|
744
741
|
},
|
|
745
742
|
callbacks: {
|
|
746
|
-
progressStep:
|
|
743
|
+
progressStep: () => { },
|
|
744
|
+
completeDocument: async () => { },
|
|
747
745
|
setParticipantType: (p) => console.log({ p }),
|
|
748
746
|
setDocusignStatus: (status) => console.log(status),
|
|
749
747
|
},
|
|
@@ -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-7739a5b4.js');
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -236,7 +236,8 @@ const docusignFormProps = {
|
|
|
236
236
|
},
|
|
237
237
|
},
|
|
238
238
|
callbacks: {
|
|
239
|
-
progressStep:
|
|
239
|
+
progressStep: () => { },
|
|
240
|
+
completeDocument: async () => { },
|
|
240
241
|
setParticipantType: (p) => console.log({ p }),
|
|
241
242
|
setDocusignStatus: (status) => console.log(status),
|
|
242
243
|
},
|
package/dist/collection/components/tax-and-cash/sqm-docusign-form/docusign-iframe/DocusignIframe.js
CHANGED
|
@@ -72,7 +72,10 @@ export const DocusignIframe = ({ states, data, callbacks, text, }) => {
|
|
|
72
72
|
const allowed = allowedDomains.some((d) => { var _a; return (_a = e.origin) === null || _a === void 0 ? void 0 : _a.includes(d); });
|
|
73
73
|
if (!allowed)
|
|
74
74
|
return;
|
|
75
|
-
if (e.data === "Complyexchange Thank you page
|
|
75
|
+
if (e.data === "Complyexchange Thank you page Load") {
|
|
76
|
+
callbacks.completeDocument();
|
|
77
|
+
}
|
|
78
|
+
if (e.data == "Complyexchange Thank you page Exit") {
|
|
76
79
|
callbacks.progressStep();
|
|
77
80
|
}
|
|
78
81
|
}, []);
|
|
@@ -177,9 +177,5 @@ export const DocusignFormView = (props) => {
|
|
|
177
177
|
? text.taxFormDescriptionIndividualParticipant
|
|
178
178
|
: text.taxFormDescriptionBusinessEntity,
|
|
179
179
|
}, { documentType: documentTypeString }))),
|
|
180
|
-
h("div", null,
|
|
181
|
-
h("sl-alert", { exportparts: "base: alert-base, icon:alert-icon", type: "primary", open: true, class: classes.InfoAlert },
|
|
182
|
-
h("sl-icon", { class: classes.InfoIcon, slot: "icon", name: "info-circle" }),
|
|
183
|
-
text.docusignSessionWarning),
|
|
184
|
-
slots.docusignIframeSlot))));
|
|
180
|
+
h("div", null, slots.docusignIframeSlot))));
|
|
185
181
|
};
|
|
@@ -136,9 +136,9 @@ 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
|
progressStep: props.callbacks.progressStep,
|
|
141
|
+
completeDocument: props.callbacks.completeDocument,
|
|
142
142
|
}, text: props.text }));
|
|
143
143
|
return (h(Host, null,
|
|
144
144
|
h(DocusignFormView, { callbacks: props.callbacks, states: props.states, text: props.text, slots: {
|
|
@@ -562,7 +562,7 @@ export class DocusignForm {
|
|
|
562
562
|
"mutable": false,
|
|
563
563
|
"complexType": {
|
|
564
564
|
"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;
|
|
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; }; }",
|
|
566
566
|
"references": {
|
|
567
567
|
"DemoData": {
|
|
568
568
|
"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,18 +84,22 @@ 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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
const result = await completeTaxDocument({
|
|
93
|
+
vars: {
|
|
94
|
+
id: user.id,
|
|
95
|
+
accountId: user.accountId,
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
if (!result || result.message)
|
|
99
|
+
throw new Error();
|
|
100
|
+
// @ts-expect-error: no data type for result
|
|
101
|
+
if (!result.completeImpactPublisherTaxDocument.success)
|
|
102
|
+
throw new Error();
|
|
91
103
|
}
|
|
92
104
|
catch (e) {
|
|
93
105
|
setErrors({ general: true });
|
|
@@ -96,32 +108,13 @@ export function useDocusignForm(props) {
|
|
|
96
108
|
setLoading(false);
|
|
97
109
|
}
|
|
98
110
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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]);
|
|
111
|
+
const progressStep = () => {
|
|
112
|
+
setStep(context.overrideNextStep ||
|
|
113
|
+
!!(publisher === null || publisher === void 0 ? void 0 : publisher.withdrawalSettings) ||
|
|
114
|
+
!(publisher === null || publisher === void 0 ? void 0 : publisher.brandedSignup)
|
|
115
|
+
? "/dashboard"
|
|
116
|
+
: "/4");
|
|
117
|
+
};
|
|
125
118
|
const allLoading = userLoading || documentLoading || loading;
|
|
126
119
|
return {
|
|
127
120
|
states: {
|
|
@@ -129,7 +122,7 @@ export function useDocusignForm(props) {
|
|
|
129
122
|
hideSteps: context.hideSteps,
|
|
130
123
|
disabled: allLoading,
|
|
131
124
|
participantTypeDisabled: allLoading || !!existingDocumentType,
|
|
132
|
-
loading: userLoading || loading,
|
|
125
|
+
loading: userLoading || loading || completeDocumentLoading,
|
|
133
126
|
urlLoading: documentLoading,
|
|
134
127
|
loadingError: !!(documentErrors === null || documentErrors === void 0 ? void 0 : documentErrors.message),
|
|
135
128
|
formState: {
|
|
@@ -143,11 +136,11 @@ export function useDocusignForm(props) {
|
|
|
143
136
|
},
|
|
144
137
|
data: {
|
|
145
138
|
taxForm: actualDocumentType,
|
|
146
|
-
documentUrl: (
|
|
147
|
-
returnUrl: (_f = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _f === void 0 ? void 0 : _f.returnUrl,
|
|
139
|
+
documentUrl: (_c = document === null || document === void 0 ? void 0 : document.createImpactPublisherTaxDocument) === null || _c === void 0 ? void 0 : _c.documentUrl,
|
|
148
140
|
},
|
|
149
141
|
callbacks: {
|
|
150
142
|
setDocusignStatus,
|
|
143
|
+
completeDocument,
|
|
151
144
|
progressStep,
|
|
152
145
|
setParticipantType,
|
|
153
146
|
},
|
|
@@ -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
|
|
@@ -50,19 +50,20 @@ export const GET_USER = gql `
|
|
|
50
50
|
type
|
|
51
51
|
dateCreated
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
# !!!!! UNCOMMENT ME !!!!!!!!
|
|
54
|
+
# withdrawalSettings {
|
|
55
|
+
# paymentMethod
|
|
56
|
+
# paypalEmailAddress
|
|
57
|
+
# bankCountry
|
|
58
|
+
# bankAccountNumber
|
|
59
|
+
# paymentSchedulingType
|
|
60
|
+
# paymentThreshold
|
|
61
|
+
# paymentDay
|
|
62
|
+
# }
|
|
63
|
+
# payoutsAccount {
|
|
64
|
+
# hold
|
|
65
|
+
# balance
|
|
66
|
+
# }
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
}
|
|
@@ -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";
|
|
@@ -58,6 +57,9 @@ export function useTaxAndCash() {
|
|
|
58
57
|
namespace: USER_QUERY_NAMESPACE,
|
|
59
58
|
query: GET_USER,
|
|
60
59
|
skip: !user,
|
|
60
|
+
options: {
|
|
61
|
+
batch: false,
|
|
62
|
+
},
|
|
61
63
|
});
|
|
62
64
|
const countryCode = ((_c = (_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) === null || _c === void 0 ? void 0 : _c.countryCode) ||
|
|
63
65
|
userFormContext.countryCode;
|