@saasquatch/mint-components 2.2.0-7 → 2.2.0-8
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-1c054d52.js → ShadowViewAddon-3b477e58.js} +429 -27
- package/dist/cjs/{data-c03e282a.js → data-89ac73dd.js} +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_10.cjs.entry.js +48 -307
- package/dist/cjs/sqm-big-stat_46.cjs.entry.js +334 -36
- package/dist/cjs/sqm-code-verification.cjs.entry.js +1 -1
- package/dist/cjs/sqm-email-verification_2.cjs.entry.js +19 -12
- package/dist/cjs/sqm-empty_4.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-partner-info-modal-view-97770d03.js → sqm-partner-info-modal-view-f6faecf5.js} +1 -1
- package/dist/cjs/{sqm-portal-container-view-70a47420.js → sqm-portal-container-view-757f921b.js} +5 -6
- package/dist/cjs/{sqm-portal-email-verification-view-d51c2a06.js → sqm-portal-email-verification-view-abb773a7.js} +1 -1
- package/dist/cjs/sqm-portal-email-verification.cjs.entry.js +2 -2
- package/dist/cjs/sqm-portal-forgot-password_6.cjs.entry.js +5 -5
- package/dist/cjs/{sqm-portal-profile-view-e6927959.js → sqm-portal-profile-view-3515e1e5.js} +1 -1
- package/dist/cjs/sqm-portal-profile.cjs.entry.js +2 -2
- package/dist/cjs/{sqm-portal-registration-form-view-fd48f1d3.js → sqm-portal-registration-form-view-a45f7a52.js} +1 -1
- package/dist/cjs/{sqm-portal-reset-password-view-d90d77f9.js → sqm-portal-reset-password-view-a767b044.js} +1 -1
- package/dist/cjs/sqm-portal-reset-password.cjs.entry.js +2 -2
- package/dist/cjs/{sqm-portal-verify-email-view-6258dcae.js → sqm-portal-verify-email-view-717d0633.js} +1 -1
- package/dist/cjs/sqm-referral-table_11.cjs.entry.js +1 -1
- package/dist/cjs/sqm-rewards-table-customer-note-cell.cjs.entry.js +1 -1
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +176 -32
- package/dist/cjs/{sqm-text-span-view-8a32dd8c.js → sqm-text-span-view-b9e10f5d.js} +1 -1
- package/dist/cjs/sqm-text-span.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-user-info-form-view-4d56b339.js → sqm-user-info-form-view-0e1ddbe4.js} +3 -388
- package/dist/cjs/{usePayoutStatus-0a98ee05.js → useIndirectTaxForm-c3c1ec56.js} +291 -0
- package/dist/cjs/utils-a3b3d05b.js +478 -0
- package/dist/collection/components/sqm-big-stat/useBigStat.js +5 -6
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field-view.js +1 -1
- package/dist/collection/components/sqm-checkbox-field/sqm-checkbox-field.js +2 -3
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal-view.js +1 -1
- package/dist/collection/components/sqm-partner-info-modal/sqm-partner-info-modal.js +2 -2
- package/dist/collection/components/sqm-partner-info-modal/usePartnerInfoModal.js +15 -8
- package/dist/collection/components/sqm-portal-container/sqm-portal-container-view.js +6 -7
- package/dist/collection/components/sqm-portal-google-login/sqm-portal-google-login.js +1 -1
- package/dist/collection/components/sqm-portal-login/sqm-portal-login.js +1 -1
- package/dist/collection/components/sqm-referral-iframe/ReferralIframe.stories.js +1 -0
- package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe-view.js +1 -1
- package/dist/collection/components/sqm-referral-iframe/sqm-referral-iframe.js +27 -1
- package/dist/collection/components/sqm-share-code/sqm-share-code.js +0 -1
- package/dist/collection/components/sqm-share-link/ShareLink.stories.js +136 -11
- package/dist/collection/components/sqm-share-link/UseShareLink.stories.js +14 -5
- package/dist/collection/components/sqm-share-link/sqm-share-link-view.js +192 -0
- package/dist/collection/components/sqm-share-link/sqm-share-link.js +935 -48
- package/dist/collection/components/sqm-share-link/useShareLink.js +227 -14
- package/dist/collection/components/sqm-text-span/sqm-text-span-view.js +1 -1
- package/dist/collection/components/tax-and-cash/data.js +1 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/formDefinitions.js +19 -1
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +50 -0
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/sqm-indirect-tax-form.js +4 -4
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js +2 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.js +65 -7
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash/useTaxAndCash.js +49 -3
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +2 -2
- package/dist/esm/{ShadowViewAddon-4d554869.js → ShadowViewAddon-e115fa1c.js} +431 -30
- package/dist/esm/{data-017e5ef2.js → data-8698cbc6.js} +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_10.entry.js +36 -295
- package/dist/esm/sqm-big-stat_46.entry.js +333 -35
- package/dist/esm/sqm-code-verification.entry.js +1 -1
- package/dist/esm/sqm-email-verification_2.entry.js +19 -12
- package/dist/esm/sqm-empty_4.entry.js +1 -1
- package/dist/esm/{sqm-partner-info-modal-view-5709904e.js → sqm-partner-info-modal-view-d6f3a215.js} +1 -1
- package/dist/esm/{sqm-portal-container-view-a8c708cd.js → sqm-portal-container-view-200c9df8.js} +6 -7
- package/dist/esm/{sqm-portal-email-verification-view-58bad294.js → sqm-portal-email-verification-view-fde1eb35.js} +1 -1
- package/dist/esm/sqm-portal-email-verification.entry.js +2 -2
- package/dist/esm/sqm-portal-forgot-password_6.entry.js +5 -5
- package/dist/esm/{sqm-portal-profile-view-115bad4a.js → sqm-portal-profile-view-2018590a.js} +1 -1
- package/dist/esm/sqm-portal-profile.entry.js +2 -2
- package/dist/esm/{sqm-portal-registration-form-view-9bf30b56.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
- package/dist/esm/{sqm-portal-reset-password-view-f8d1689c.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
- package/dist/esm/sqm-portal-reset-password.entry.js +2 -2
- package/dist/esm/{sqm-portal-verify-email-view-c053ead1.js → sqm-portal-verify-email-view-590f964b.js} +1 -1
- package/dist/esm/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm/sqm-rewards-table-customer-note-cell.entry.js +1 -1
- package/dist/esm/sqm-stencilbook.entry.js +174 -30
- package/dist/esm/{sqm-text-span-view-4db9e33f.js → sqm-text-span-view-72f43dff.js} +1 -1
- package/dist/esm/sqm-text-span.entry.js +1 -1
- package/dist/esm/{sqm-user-info-form-view-d13f9d3e.js → sqm-user-info-form-view-e1ba6009.js} +3 -385
- package/dist/esm/{usePayoutStatus-227ae365.js → useIndirectTaxForm-b2888ea5.js} +291 -3
- package/dist/esm/utils-4f5cd04c.js +467 -0
- package/dist/esm-es5/ShadowViewAddon-e115fa1c.js +1 -0
- package/dist/esm-es5/data-8698cbc6.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_10.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_46.entry.js +1 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-email-verification_2.entry.js +1 -1
- package/dist/esm-es5/sqm-empty_4.entry.js +1 -1
- package/dist/esm-es5/{sqm-partner-info-modal-view-5709904e.js → sqm-partner-info-modal-view-d6f3a215.js} +1 -1
- package/dist/esm-es5/sqm-portal-container-view-200c9df8.js +1 -0
- package/dist/esm-es5/{sqm-portal-email-verification-view-58bad294.js → sqm-portal-email-verification-view-fde1eb35.js} +1 -1
- package/dist/esm-es5/sqm-portal-email-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-portal-forgot-password_6.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-profile-view-115bad4a.js → sqm-portal-profile-view-2018590a.js} +1 -1
- package/dist/esm-es5/sqm-portal-profile.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-registration-form-view-9bf30b56.js → sqm-portal-registration-form-view-79265df5.js} +1 -1
- package/dist/esm-es5/{sqm-portal-reset-password-view-f8d1689c.js → sqm-portal-reset-password-view-f84c04cf.js} +1 -1
- package/dist/esm-es5/sqm-portal-reset-password.entry.js +1 -1
- package/dist/esm-es5/{sqm-portal-verify-email-view-c053ead1.js → sqm-portal-verify-email-view-590f964b.js} +1 -1
- package/dist/esm-es5/sqm-referral-table_11.entry.js +1 -1
- package/dist/esm-es5/sqm-rewards-table-customer-note-cell.entry.js +1 -1
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/{sqm-text-span-view-4db9e33f.js → sqm-text-span-view-72f43dff.js} +1 -1
- package/dist/esm-es5/sqm-text-span.entry.js +1 -1
- package/dist/esm-es5/sqm-user-info-form-view-e1ba6009.js +1 -0
- package/dist/esm-es5/useIndirectTaxForm-b2888ea5.js +6 -0
- package/dist/esm-es5/utils-4f5cd04c.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-4034f157.js → p-0afa6148.js} +1 -1
- package/dist/mint-components/p-0b1e90fe.system.js +1 -0
- package/dist/mint-components/{p-731c4d33.entry.js → p-13d1b10d.entry.js} +1 -1
- package/dist/mint-components/{p-b1b20d42.entry.js → p-1d398dbc.entry.js} +1 -1
- package/dist/mint-components/p-1e6a2945.js +1 -0
- package/dist/mint-components/p-1efb42e2.js +499 -0
- package/dist/mint-components/p-1f387c7b.system.js +1 -1
- package/dist/mint-components/{p-d6ccb6fc.entry.js → p-2ed13619.entry.js} +1 -1
- package/dist/mint-components/{p-b1765c78.system.js → p-31815fb6.system.js} +1 -1
- package/dist/mint-components/p-335a5736.entry.js +1 -0
- package/dist/mint-components/{p-dbc8afaa.system.entry.js → p-33ca28ba.system.entry.js} +1 -1
- package/dist/mint-components/{p-d1c1c2c9.entry.js → p-3596e241.entry.js} +2 -2
- package/dist/mint-components/{p-1faa6ddf.system.entry.js → p-37e24621.system.entry.js} +1 -1
- package/dist/mint-components/{p-dafe30c3.entry.js → p-4d73a616.entry.js} +1 -1
- package/dist/mint-components/{p-9ba8b28b.system.entry.js → p-51ae6716.system.entry.js} +1 -1
- package/dist/mint-components/p-58c24352.system.js +6 -0
- package/dist/mint-components/{p-00046ec1.js → p-5c52100b.js} +1 -0
- package/dist/mint-components/{p-f368f04a.system.js → p-686dd5eb.system.js} +1 -1
- package/dist/mint-components/{p-379cb9f1.system.js → p-7562cd98.system.js} +1 -1
- package/dist/mint-components/{p-bd972473.system.js → p-7628e56f.system.js} +1 -1
- package/dist/mint-components/{p-d71a8b38.entry.js → p-7cbdf341.entry.js} +2 -2
- package/dist/mint-components/p-7d2d9ef9.system.js +1 -0
- package/dist/mint-components/{p-8d073bdf.entry.js → p-84495fb8.entry.js} +1 -1
- package/dist/mint-components/{p-cfba6b4e.system.entry.js → p-86d20b47.system.entry.js} +1 -1
- package/dist/mint-components/{p-71561bb2.system.entry.js → p-8899ff38.system.entry.js} +1 -1
- package/dist/mint-components/p-9674856e.entry.js +9 -0
- package/dist/mint-components/p-9c1f5317.system.js +1 -0
- package/dist/mint-components/p-9f48640d.js +1 -0
- package/dist/mint-components/{p-df88dcaa.system.js → p-a4825ec2.system.js} +1 -1
- package/dist/mint-components/p-a88b8165.system.entry.js +1 -0
- package/dist/mint-components/p-abe9f5b1.js +99 -0
- package/dist/mint-components/{p-31edeff4.system.js → p-ae2f610e.system.js} +1 -1
- package/dist/mint-components/p-b222bace.system.entry.js +1 -0
- package/dist/mint-components/{p-45e2a83a.js → p-b3ad957c.js} +1 -1
- package/dist/mint-components/{p-2ab31786.js → p-b871d158.js} +1 -1
- package/dist/mint-components/p-b96ed8eb.js +1 -0
- package/dist/mint-components/p-bbd41807.entry.js +291 -0
- package/dist/mint-components/{p-9b15ee47.system.js → p-be6a0dee.system.js} +1 -1
- package/dist/mint-components/{p-a7f72a66.js → p-bee4af5d.js} +1 -1
- package/dist/mint-components/{p-0102ad17.system.entry.js → p-c0f8f977.system.entry.js} +1 -1
- package/dist/mint-components/{p-50d959bd.js → p-c813ec64.js} +1 -1
- package/dist/mint-components/p-cdabd9de.system.js +1 -0
- package/dist/mint-components/{p-7699d40a.system.entry.js → p-cfc35705.system.entry.js} +1 -1
- package/dist/mint-components/p-d2ede7cd.system.entry.js +1 -0
- package/dist/mint-components/{p-e1292288.system.entry.js → p-d3b1ab20.system.entry.js} +1 -1
- package/dist/mint-components/p-db6bf7cf.system.entry.js +1 -0
- package/dist/mint-components/p-e30abc44.js +1 -0
- package/dist/mint-components/{p-3218bb1d.entry.js → p-e506bf7f.entry.js} +1 -1
- package/dist/mint-components/{p-ae4994e1.js → p-e8e7af06.js} +1 -1
- package/dist/mint-components/p-ebc519bc.system.js +1 -0
- package/dist/mint-components/{p-eee0bcf4.entry.js → p-ef32fa8f.entry.js} +1 -1
- package/dist/mint-components/{p-ca5b9f4d.system.entry.js → p-fa85ea51.system.entry.js} +1 -1
- package/dist/mint-components/p-ffcebe78.entry.js +83 -0
- package/dist/types/components/sqm-checkbox-field/sqm-checkbox-field.d.ts +1 -1
- package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe-view.d.ts +1 -0
- package/dist/types/components/sqm-referral-iframe/sqm-referral-iframe.d.ts +5 -0
- package/dist/types/components/sqm-share-link/ShareLink.stories.d.ts +9 -0
- package/dist/types/components/sqm-share-link/UseShareLink.stories.d.ts +6 -0
- package/dist/types/components/sqm-share-link/sqm-share-link-view.d.ts +41 -0
- package/dist/types/components/sqm-share-link/sqm-share-link.d.ts +195 -2
- package/dist/types/components/sqm-share-link/useShareLink.d.ts +33 -4
- package/dist/types/components/tax-and-cash/data.d.ts +2 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/formDefinitions.d.ts +6 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.d.ts +8 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.d.ts +2 -0
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash/sqm-tax-and-cash.d.ts +10 -0
- package/dist/types/components.d.ts +397 -4
- package/docs/docs.docx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +1 -1
- package/readme.md +60 -1
- package/shoelace/assets/icons/twitter-x.svg +4 -0
- package/dist/cjs/utils-15ce04e3.js +0 -93
- package/dist/esm/utils-17daa419.js +0 -85
- package/dist/esm-es5/ShadowViewAddon-4d554869.js +0 -1
- package/dist/esm-es5/data-017e5ef2.js +0 -1
- package/dist/esm-es5/sqm-portal-container-view-a8c708cd.js +0 -1
- package/dist/esm-es5/sqm-user-info-form-view-d13f9d3e.js +0 -1
- package/dist/esm-es5/usePayoutStatus-227ae365.js +0 -6
- package/dist/esm-es5/utils-17daa419.js +0 -1
- package/dist/mint-components/p-00dd7f08.js +0 -1
- package/dist/mint-components/p-3254fbb4.entry.js +0 -291
- package/dist/mint-components/p-4a8ffa03.system.js +0 -1
- package/dist/mint-components/p-4e34bcb1.system.js +0 -1
- package/dist/mint-components/p-53d90eb5.js +0 -463
- package/dist/mint-components/p-5e300ec1.system.js +0 -6
- package/dist/mint-components/p-614723aa.js +0 -1
- package/dist/mint-components/p-6af71f23.entry.js +0 -9
- package/dist/mint-components/p-6c23abd8.entry.js +0 -1
- package/dist/mint-components/p-753d06ef.entry.js +0 -133
- package/dist/mint-components/p-7aace2b3.system.js +0 -1
- package/dist/mint-components/p-b0ab1065.system.entry.js +0 -1
- package/dist/mint-components/p-b52a7da9.system.entry.js +0 -1
- package/dist/mint-components/p-b699f76e.system.js +0 -1
- package/dist/mint-components/p-b6a1e2ac.js +0 -1
- package/dist/mint-components/p-b7370480.js +0 -1
- package/dist/mint-components/p-ce7d824b.js +0 -49
- package/dist/mint-components/p-e93cdcbd.system.js +0 -1
- package/dist/mint-components/p-eb285d38.system.entry.js +0 -1
- package/dist/mint-components/p-f782ff10.system.entry.js +0 -1
- package/docs/stats.json +0 -122783
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { k as useState, f as useEffect } from './dom-context-hooks.module-50442785.js';
|
|
2
|
-
import { d as dist, J, $ as $e, g as getEnvironmentSDK, w as wn } from './index.module-02cb914c.js';
|
|
1
|
+
import { k as useState, f as useEffect, m as useRef, u as useMemo } from './dom-context-hooks.module-50442785.js';
|
|
2
|
+
import { d as dist, J, $ as $e, g as getEnvironmentSDK, w as wn, L, F as Fn, q as Pn, r as $n } from './index.module-02cb914c.js';
|
|
3
|
+
import { j as jsonpointer } from './jsonpointer-388a7082.js';
|
|
4
|
+
import { I as INDIRECT_TAX_SPAIN_REGIONS, a as INDIRECT_TAX_PROVINCES, g as getCountryObj, b as validTaxDocument } from './utils-4f5cd04c.js';
|
|
5
|
+
import { a as TAX_FORM_CONTEXT_NAMESPACE, U as USER_FORM_CONTEXT_NAMESPACE, d as COUNTRIES_QUERY_NAMESPACE, T as TAX_CONTEXT_NAMESPACE, c as USER_QUERY_NAMESPACE } from './data-8698cbc6.js';
|
|
3
6
|
import { T as TAX_FORM_UPDATED_EVENT_KEY } from './eventKeys-f76b6a03.js';
|
|
4
7
|
|
|
5
8
|
var toArray = function toArray(a) {
|
|
@@ -1106,4 +1109,289 @@ function usePayoutStatus(props) {
|
|
|
1106
1109
|
};
|
|
1107
1110
|
}
|
|
1108
1111
|
|
|
1109
|
-
|
|
1112
|
+
const CONNECT_PARTNER = dist.gql `
|
|
1113
|
+
mutation createImpactConnection($vars: ImpactConnectionInput!) {
|
|
1114
|
+
createImpactConnection(impactConnectionInput: $vars) {
|
|
1115
|
+
success
|
|
1116
|
+
validationErrors {
|
|
1117
|
+
field
|
|
1118
|
+
message
|
|
1119
|
+
}
|
|
1120
|
+
user {
|
|
1121
|
+
id
|
|
1122
|
+
accountId
|
|
1123
|
+
impactConnection {
|
|
1124
|
+
connected
|
|
1125
|
+
publisher {
|
|
1126
|
+
brandedSignup
|
|
1127
|
+
requiredTaxDocumentType
|
|
1128
|
+
currentTaxDocument {
|
|
1129
|
+
type
|
|
1130
|
+
status
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
`;
|
|
1138
|
+
const COMPLETE_PARTNER = dist.gql `
|
|
1139
|
+
mutation completeImpactConnection($vars: ImpactConnectionInput!) {
|
|
1140
|
+
completeImpactConnection(impactConnectionInput: $vars) {
|
|
1141
|
+
success
|
|
1142
|
+
validationErrors {
|
|
1143
|
+
field
|
|
1144
|
+
message
|
|
1145
|
+
}
|
|
1146
|
+
user {
|
|
1147
|
+
id
|
|
1148
|
+
accountId
|
|
1149
|
+
impactConnection {
|
|
1150
|
+
connected
|
|
1151
|
+
publisher {
|
|
1152
|
+
brandedSignup
|
|
1153
|
+
requiredTaxDocumentType
|
|
1154
|
+
currentTaxDocument {
|
|
1155
|
+
type
|
|
1156
|
+
status
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
`;
|
|
1164
|
+
function getOption(countries, countryCode) {
|
|
1165
|
+
if (!countries)
|
|
1166
|
+
return;
|
|
1167
|
+
if (countries.find((c) => c.countryCode === countryCode)) {
|
|
1168
|
+
return "otherRegion";
|
|
1169
|
+
}
|
|
1170
|
+
else {
|
|
1171
|
+
return "notRegistered";
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
function useIndirectTaxForm(props) {
|
|
1175
|
+
var _a, _b, _c, _d, _e;
|
|
1176
|
+
const user = J();
|
|
1177
|
+
const locale = L();
|
|
1178
|
+
const formRef = useRef(null);
|
|
1179
|
+
const context = Fn(TAX_FORM_CONTEXT_NAMESPACE);
|
|
1180
|
+
const [step, setStep] = Pn(TAX_CONTEXT_NAMESPACE);
|
|
1181
|
+
const [connectImpactPartner, { loading: connectLoading }] = $e(CONNECT_PARTNER);
|
|
1182
|
+
const [completeImpactPartner, { loading: completeLoading }] = $e(COMPLETE_PARTNER);
|
|
1183
|
+
const userForm = Fn(USER_FORM_CONTEXT_NAMESPACE);
|
|
1184
|
+
const { data: userData, refetch, errors: userError, } = $n(USER_QUERY_NAMESPACE);
|
|
1185
|
+
const { data: _countriesRes, loading: countriesLoading } = $n(COUNTRIES_QUERY_NAMESPACE);
|
|
1186
|
+
const intlLocale = (locale === null || locale === void 0 ? void 0 : locale.replace("_", "-")) || "en";
|
|
1187
|
+
const _countries = useMemo(() => { var _a, _b; return (_b = (_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map((country) => getCountryObj({ countryCode: country.countryCode, locale: intlLocale })); }, [(_a = _countriesRes === null || _countriesRes === void 0 ? void 0 : _countriesRes.impactPayoutCountries) === null || _a === void 0 ? void 0 : _a.data]);
|
|
1188
|
+
const [loading, setLoading] = useState(false);
|
|
1189
|
+
const [formState, setFormState] = useState({});
|
|
1190
|
+
const [errors, setErrors] = useState({});
|
|
1191
|
+
const [countrySearch, setCountrySearch] = useState("");
|
|
1192
|
+
const [filteredCountries, setFilteredCountries] = useState(_countries || []);
|
|
1193
|
+
const [option, setOption] = useState("notRegistered");
|
|
1194
|
+
const publisher = (_c = (_b = userData === null || userData === void 0 ? void 0 : userData.user) === null || _b === void 0 ? void 0 : _b.impactConnection) === null || _c === void 0 ? void 0 : _c.publisher;
|
|
1195
|
+
useEffect(() => {
|
|
1196
|
+
// reset redirect hash
|
|
1197
|
+
window.location.hash = "";
|
|
1198
|
+
}, []);
|
|
1199
|
+
useEffect(() => {
|
|
1200
|
+
var _a;
|
|
1201
|
+
if (!((_a = publisher === null || publisher === void 0 ? void 0 : publisher.taxInformation) === null || _a === void 0 ? void 0 : _a.indirectTaxCountryCode))
|
|
1202
|
+
return;
|
|
1203
|
+
const _option = getOption(_countries, publisher.taxInformation.indirectTaxCountryCode);
|
|
1204
|
+
setOption(_option);
|
|
1205
|
+
}, [publisher, _countries]);
|
|
1206
|
+
useEffect(() => {
|
|
1207
|
+
if (countrySearch.trim() === "") {
|
|
1208
|
+
setFilteredCountries(_countries || []);
|
|
1209
|
+
}
|
|
1210
|
+
else {
|
|
1211
|
+
setFilteredCountries((_countries === null || _countries === void 0 ? void 0 : _countries.filter((c) => c.displayName.toLowerCase().includes(countrySearch.toLowerCase()))) || []);
|
|
1212
|
+
}
|
|
1213
|
+
}, [countrySearch, _countries]);
|
|
1214
|
+
useEffect(() => {
|
|
1215
|
+
var _a, _b;
|
|
1216
|
+
const user = userData === null || userData === void 0 ? void 0 : userData.user;
|
|
1217
|
+
if (!user)
|
|
1218
|
+
return;
|
|
1219
|
+
if ((_b = (_a = user.impactConnection) === null || _a === void 0 ? void 0 : _a.publisher) === null || _b === void 0 ? void 0 : _b.taxInformation) {
|
|
1220
|
+
setFormState({
|
|
1221
|
+
province: user.impactConnection.publisher.taxInformation.indirectTaxRegion,
|
|
1222
|
+
subRegion: user.impactConnection.publisher.taxInformation.indirectTaxRegion,
|
|
1223
|
+
hasQst: !!user.impactConnection.publisher.taxInformation.additionalTaxId,
|
|
1224
|
+
qstNumber: user.impactConnection.publisher.taxInformation.additionalTaxId,
|
|
1225
|
+
hasSubRegionTaxNumber: !!user.impactConnection.publisher.taxInformation.withholdingTaxId,
|
|
1226
|
+
subRegionTaxNumber: user.impactConnection.publisher.taxInformation.withholdingTaxId,
|
|
1227
|
+
selectedRegion: user.impactConnection.publisher.taxInformation.indirectTaxCountryCode,
|
|
1228
|
+
indirectTaxNumber: user.impactConnection.publisher.taxInformation.indirectTaxId,
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
else {
|
|
1232
|
+
setFormState({
|
|
1233
|
+
selectedRegion: (user === null || user === void 0 ? void 0 : user.countryCode) || (userForm === null || userForm === void 0 ? void 0 : userForm.countryCode),
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
}, [userData, userForm]);
|
|
1237
|
+
const onFormChange = (field, e) => {
|
|
1238
|
+
var _a, _b;
|
|
1239
|
+
const value = (_b = (_a = e.detail) === null || _a === void 0 ? void 0 : _a.item) === null || _b === void 0 ? void 0 : _b.__value;
|
|
1240
|
+
if (!value)
|
|
1241
|
+
console.error("Could not detect select change");
|
|
1242
|
+
setFormState((p) => ({ ...p, [field]: value }));
|
|
1243
|
+
};
|
|
1244
|
+
async function connectPartner(formData) {
|
|
1245
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1246
|
+
const vars = {
|
|
1247
|
+
user: {
|
|
1248
|
+
id: user.id,
|
|
1249
|
+
accountId: user.accountId,
|
|
1250
|
+
},
|
|
1251
|
+
firstName: userForm.firstName,
|
|
1252
|
+
lastName: userForm.lastName,
|
|
1253
|
+
countryCode: userForm.countryCode,
|
|
1254
|
+
currency: userForm.currency,
|
|
1255
|
+
address: userForm.address,
|
|
1256
|
+
city: userForm.city,
|
|
1257
|
+
state: userForm.state,
|
|
1258
|
+
postalCode: userForm.postalCode,
|
|
1259
|
+
phoneNumber: userForm.phoneNumber,
|
|
1260
|
+
phoneNumberCountryCode: userForm.phoneNumberCountryCode,
|
|
1261
|
+
indirectTaxCountryCode: formData.selectedRegion,
|
|
1262
|
+
indirectTaxRegion: formData.province || formData.subRegion,
|
|
1263
|
+
indirectTaxId: formData.indirectTaxNumber,
|
|
1264
|
+
additionalTaxId: formData.qstNumber,
|
|
1265
|
+
withholdingTaxId: formData.subRegionTaxNumber,
|
|
1266
|
+
};
|
|
1267
|
+
// If the partner has already been started call completeImpactConnection
|
|
1268
|
+
// to fill in the remaining details. Otherwise create from scratch.
|
|
1269
|
+
let result = null;
|
|
1270
|
+
let connectionResult;
|
|
1271
|
+
if (((_b = (_a = userData === null || userData === void 0 ? void 0 : userData.user) === null || _a === void 0 ? void 0 : _a.impactConnection) === null || _b === void 0 ? void 0 : _b.connectionStatus) === "STARTED") {
|
|
1272
|
+
result = await completeImpactPartner({
|
|
1273
|
+
vars,
|
|
1274
|
+
});
|
|
1275
|
+
connectionResult = (_c = result) === null || _c === void 0 ? void 0 : _c.completeImpactConnection;
|
|
1276
|
+
}
|
|
1277
|
+
else {
|
|
1278
|
+
result = await connectImpactPartner({
|
|
1279
|
+
vars,
|
|
1280
|
+
});
|
|
1281
|
+
connectionResult = (_d = result) === null || _d === void 0 ? void 0 : _d.createImpactConnection;
|
|
1282
|
+
}
|
|
1283
|
+
if (!result || ((_e = result) === null || _e === void 0 ? void 0 : _e.message))
|
|
1284
|
+
throw new Error();
|
|
1285
|
+
if (!(connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.success)) {
|
|
1286
|
+
// Output backend errors to console for now
|
|
1287
|
+
console.error("Failed to create Impact connection: ", connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.validationErrors);
|
|
1288
|
+
throw new Error();
|
|
1289
|
+
}
|
|
1290
|
+
await refetch();
|
|
1291
|
+
const resultPublisher = (_g = (_f = connectionResult === null || connectionResult === void 0 ? void 0 : connectionResult.user) === null || _f === void 0 ? void 0 : _f.impactConnection) === null || _g === void 0 ? void 0 : _g.publisher;
|
|
1292
|
+
const hasValidCurrentDocument = validTaxDocument(resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) && (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.currentTaxDocument);
|
|
1293
|
+
// Fire form change event
|
|
1294
|
+
window.dispatchEvent(new Event(TAX_FORM_UPDATED_EVENT_KEY));
|
|
1295
|
+
return {
|
|
1296
|
+
resultPublisher,
|
|
1297
|
+
hasValidCurrentDocument,
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
const onSubmit = async (event) => {
|
|
1301
|
+
if (!option) {
|
|
1302
|
+
setErrors({ taxDetails: true });
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
let formData = { taxOption: option };
|
|
1306
|
+
let validationErrors = {};
|
|
1307
|
+
const controls = event.target.getFormControls();
|
|
1308
|
+
controls.forEach((control) => {
|
|
1309
|
+
if (!control.name || !control.id)
|
|
1310
|
+
return;
|
|
1311
|
+
if (option === "notRegistered")
|
|
1312
|
+
return; // Don't include fields for notRegistered option
|
|
1313
|
+
const key = control.name;
|
|
1314
|
+
const value = control.value;
|
|
1315
|
+
jsonpointer.set(formData, key, value);
|
|
1316
|
+
if (control.required && !value) {
|
|
1317
|
+
jsonpointer.set(validationErrors, key, true);
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
setErrors(validationErrors);
|
|
1321
|
+
if (Object.keys(validationErrors).length) {
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
setLoading(true);
|
|
1325
|
+
try {
|
|
1326
|
+
const { resultPublisher, hasValidCurrentDocument } = await connectPartner(formData);
|
|
1327
|
+
if ((resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.requiredTaxDocumentType) &&
|
|
1328
|
+
!hasValidCurrentDocument) {
|
|
1329
|
+
// Go to docusign form
|
|
1330
|
+
setStep("/3");
|
|
1331
|
+
}
|
|
1332
|
+
else {
|
|
1333
|
+
if (resultPublisher === null || resultPublisher === void 0 ? void 0 : resultPublisher.brandedSignup) {
|
|
1334
|
+
// Go to banking information form
|
|
1335
|
+
setStep("/4");
|
|
1336
|
+
}
|
|
1337
|
+
else {
|
|
1338
|
+
// Go right to the dashboard
|
|
1339
|
+
setStep("/dashboard");
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
catch (e) {
|
|
1344
|
+
setErrors({ general: true });
|
|
1345
|
+
}
|
|
1346
|
+
finally {
|
|
1347
|
+
setLoading(false);
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
const onBack = () => {
|
|
1351
|
+
setStep(context.overrideBackStep || "/1");
|
|
1352
|
+
};
|
|
1353
|
+
return {
|
|
1354
|
+
states: {
|
|
1355
|
+
step: step === null || step === void 0 ? void 0 : step.replace("/", ""),
|
|
1356
|
+
hideSteps: context.hideSteps,
|
|
1357
|
+
disabled: loading || countriesLoading || connectLoading || completeLoading,
|
|
1358
|
+
loading: loading || connectLoading || countriesLoading || completeLoading,
|
|
1359
|
+
isPartner: !!((_e = (_d = userData === null || userData === void 0 ? void 0 : userData.user) === null || _d === void 0 ? void 0 : _d.impactConnection) === null || _e === void 0 ? void 0 : _e.publisher),
|
|
1360
|
+
loadingError: !!(userError === null || userError === void 0 ? void 0 : userError.message),
|
|
1361
|
+
formState: {
|
|
1362
|
+
checked: option,
|
|
1363
|
+
errors,
|
|
1364
|
+
},
|
|
1365
|
+
},
|
|
1366
|
+
callbacks: {
|
|
1367
|
+
onBack,
|
|
1368
|
+
onSubmit,
|
|
1369
|
+
onFormChange,
|
|
1370
|
+
onChange: setOption,
|
|
1371
|
+
setCountrySearch,
|
|
1372
|
+
onQstToggle: () => setFormState((p) => ({ ...p, hasQst: !p.hasQst })),
|
|
1373
|
+
onSpainToggle: () => setFormState((p) => ({
|
|
1374
|
+
...p,
|
|
1375
|
+
hasSubRegionTaxNumber: !p.hasSubRegionTaxNumber,
|
|
1376
|
+
})),
|
|
1377
|
+
},
|
|
1378
|
+
data: {
|
|
1379
|
+
esRegions: INDIRECT_TAX_SPAIN_REGIONS,
|
|
1380
|
+
countries: filteredCountries,
|
|
1381
|
+
allCountries: _countries,
|
|
1382
|
+
provinces: INDIRECT_TAX_PROVINCES,
|
|
1383
|
+
},
|
|
1384
|
+
text: props.getTextProps(),
|
|
1385
|
+
refs: {
|
|
1386
|
+
formRef,
|
|
1387
|
+
},
|
|
1388
|
+
slotProps: {
|
|
1389
|
+
formState: {
|
|
1390
|
+
...formState,
|
|
1391
|
+
errors,
|
|
1392
|
+
},
|
|
1393
|
+
},
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
export { COMPLETE_PARTNER as C, VERIFF_COMPLETE_EVENT_KEY as V, useIndirectTaxForm as a, useVeriffApp as b, CONNECT_PARTNER as c, getStatus as g, usePayoutStatus as u };
|