@saasquatch/mint-components 1.12.0-11 → 1.12.0-13
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/loader.cjs.js +1 -1
- package/dist/cjs/mint-components.cjs.js +1 -1
- package/dist/cjs/sqm-banking-info-form_16.cjs.entry.js +165 -61
- package/dist/cjs/sqm-big-stat_39.cjs.entry.js +55 -15
- package/dist/cjs/sqm-code-verification.cjs.entry.js +5 -5
- package/dist/cjs/sqm-email-verification.cjs.entry.js +1 -1
- package/dist/cjs/{sqm-invoice-table-view-c58966f8.js → sqm-invoice-table-view-e92c557a.js} +79 -23
- package/dist/cjs/sqm-stencilbook.cjs.entry.js +12 -21
- package/dist/cjs/sqm-widget-verification-internal.cjs.entry.js +7 -1
- package/dist/cjs/usePayoutStatus-5ac536a3.js +1045 -0
- package/dist/cjs/{useVerificationEmail-6aacdb71.js → useVerificationEmail-2eb28c2a.js} +5 -1
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/sqm-code-verification-view.js +1 -1
- package/dist/collection/components/sqm-widget-verification/sqm-code-verification/useCodeVerification.js +3 -3
- package/dist/collection/components/sqm-widget-verification/sqm-widget-verification-internal.js +7 -1
- package/dist/collection/components/sqm-widget-verification/useVerificationEmail.js +5 -1
- package/dist/collection/components/tax-and-cash/BankingForm.stories.js +1 -0
- package/dist/collection/components/tax-and-cash/TaxForm.stories.js +76 -23
- package/dist/collection/components/tax-and-cash/eventKeys.js +1 -0
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form.js +32 -10
- package/dist/collection/components/tax-and-cash/sqm-banking-info-form/useBankingInfoForm.js +6 -1
- package/dist/collection/components/tax-and-cash/sqm-docusign-form/useDocusignForm.js +3 -0
- package/dist/collection/components/tax-and-cash/sqm-indirect-tax-form/useIndirectTaxForm.js +3 -0
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/PayoutDetailsCard.stories.js +0 -7
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card-view.js +0 -5
- package/dist/collection/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.js +0 -56
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.js +5 -9
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.js +28 -11
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.js +155 -6
- package/dist/collection/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.js +20 -9
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.js +87 -23
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.js +153 -2
- package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js +13 -5
- package/dist/collection/components/tax-and-cash/useVeriffApp.js +64 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mint-components.js +1 -1
- package/dist/esm/sqm-banking-info-form_16.entry.js +165 -61
- package/dist/esm/sqm-big-stat_39.entry.js +55 -15
- package/dist/esm/sqm-code-verification.entry.js +5 -5
- package/dist/esm/sqm-email-verification.entry.js +1 -1
- package/dist/esm/{sqm-invoice-table-view-d1cfdaf4.js → sqm-invoice-table-view-c184248a.js} +79 -23
- package/dist/esm/sqm-stencilbook.entry.js +12 -21
- package/dist/esm/sqm-widget-verification-internal.entry.js +7 -1
- package/dist/esm/usePayoutStatus-d613ff10.js +1039 -0
- package/dist/esm/{useVerificationEmail-c32696ba.js → useVerificationEmail-2a21d0e3.js} +5 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mint-components.js +1 -1
- package/dist/esm-es5/sqm-banking-info-form_16.entry.js +1 -1
- package/dist/esm-es5/sqm-big-stat_39.entry.js +1 -1
- package/dist/esm-es5/sqm-code-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-email-verification.entry.js +1 -1
- package/dist/esm-es5/sqm-invoice-table-view-c184248a.js +1 -0
- package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
- package/dist/esm-es5/sqm-widget-verification-internal.entry.js +1 -1
- package/dist/esm-es5/usePayoutStatus-d613ff10.js +6 -0
- package/dist/esm-es5/useVerificationEmail-2a21d0e3.js +1 -0
- package/dist/mint-components/mint-components.esm.js +1 -1
- package/dist/mint-components/{p-1712a9fd.entry.js → p-02892b2a.entry.js} +2 -2
- package/dist/mint-components/p-03e1ac96.system.entry.js +1 -0
- package/dist/mint-components/p-13ce67a3.js +1 -0
- package/dist/mint-components/p-209eab38.system.js +6 -0
- package/dist/mint-components/p-2584baa5.entry.js +16 -0
- package/dist/mint-components/p-2c99add0.js +31 -0
- package/dist/mint-components/{p-24092973.entry.js → p-4e21de5f.entry.js} +2 -2
- package/dist/mint-components/p-8c26c4ce.entry.js +195 -0
- package/dist/mint-components/{p-e45a8501.system.entry.js → p-8fa2809f.system.entry.js} +1 -1
- package/dist/mint-components/{p-b62faaa5.system.entry.js → p-9266a8fc.system.entry.js} +1 -1
- package/dist/mint-components/p-9379ee08.js +48 -0
- package/dist/mint-components/p-a567ba84.system.entry.js +1 -0
- package/dist/mint-components/p-a8c28561.system.js +1 -0
- package/dist/mint-components/{p-5f766d09.entry.js → p-a9b7e11f.entry.js} +2 -2
- package/dist/mint-components/p-b7836281.system.js +1 -0
- package/dist/mint-components/{p-331d060e.entry.js → p-b9e863d0.entry.js} +14 -14
- package/dist/mint-components/p-c520d10d.system.entry.js +1 -0
- package/dist/mint-components/{p-aabab609.system.entry.js → p-c5d26757.system.entry.js} +1 -1
- package/dist/mint-components/p-ca809fdd.system.js +1 -1
- package/dist/types/components/sqm-widget-verification/useVerificationEmail.d.ts +1 -0
- package/dist/types/components/tax-and-cash/TaxForm.stories.d.ts +3 -0
- package/dist/types/components/tax-and-cash/eventKeys.d.ts +1 -0
- package/dist/types/components/tax-and-cash/sqm-banking-info-form/sqm-banking-info-form-view.d.ts +2 -0
- package/dist/types/components/tax-and-cash/sqm-payout-details-card/PayoutDetailsCard.stories.d.ts +0 -1
- package/dist/types/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card-view.d.ts +0 -4
- package/dist/types/components/tax-and-cash/sqm-payout-details-card/sqm-payout-details-card.d.ts +1 -16
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/PayoutStatusAlert.stories.d.ts +3 -1
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert-view.d.ts +7 -2
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/sqm-payout-status-alert.d.ts +25 -0
- package/dist/types/components/tax-and-cash/sqm-payout-status-alert/usePayoutStatus.d.ts +3 -4
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard-view.d.ts +8 -4
- package/dist/types/components/tax-and-cash/sqm-tax-and-cash-dashboard/sqm-tax-and-cash-dashboard.d.ts +24 -0
- package/dist/types/components/tax-and-cash/useVeriffApp.d.ts +6 -0
- package/dist/types/components.d.ts +98 -22
- package/docs/docs.docx +0 -0
- package/docs/picklesdoc--2024-01-15--11-20-00.xlsx +0 -0
- package/docs/picklesdoc--2024-01-15--11-24-04.xlsx +0 -0
- package/docs/raisins.json +1 -1
- package/grapesjs/grapesjs.js +1 -1
- package/package.json +2 -1
- package/dist/cjs/usePayoutStatus-b9fb7399.js +0 -70
- package/dist/esm/usePayoutStatus-1a635054.js +0 -67
- package/dist/esm-es5/sqm-invoice-table-view-d1cfdaf4.js +0 -1
- package/dist/esm-es5/usePayoutStatus-1a635054.js +0 -1
- package/dist/esm-es5/useVerificationEmail-c32696ba.js +0 -1
- package/dist/mint-components/p-0e45bc0e.system.entry.js +0 -1
- package/dist/mint-components/p-1e616d45.system.js +0 -1
- package/dist/mint-components/p-282a7d85.entry.js +0 -195
- package/dist/mint-components/p-4364001c.entry.js +0 -12
- package/dist/mint-components/p-4bd7a472.js +0 -1
- package/dist/mint-components/p-517224ef.js +0 -19
- package/dist/mint-components/p-8300d8c8.system.js +0 -1
- package/dist/mint-components/p-8bddb468.system.entry.js +0 -1
- package/dist/mint-components/p-974070c4.system.entry.js +0 -1
- package/dist/mint-components/p-d7806f31.js +0 -48
- package/dist/mint-components/p-e990dc21.system.js +0 -1
|
@@ -197,6 +197,30 @@ export class TaxAndCashDashboard {
|
|
|
197
197
|
* @uiWidget textArea
|
|
198
198
|
*/
|
|
199
199
|
this.verificationRequiredDescription = "Complete your verification to start receiving your cash rewards. It should only take a few minutes verify.";
|
|
200
|
+
/**
|
|
201
|
+
* @uiName Verification required internal alert header
|
|
202
|
+
*/
|
|
203
|
+
this.verificationRequiredInternalHeader = "Identity Verification in Progress";
|
|
204
|
+
/**
|
|
205
|
+
* @uiName Verification required internal alert description
|
|
206
|
+
*/
|
|
207
|
+
this.verificationRequiredInternalDescription = "Identity verification submission has been received. Our system is currently performing additional checks and analyzing the results. You will be updated shortley.";
|
|
208
|
+
/**
|
|
209
|
+
* @uiName Verification review internal alert header
|
|
210
|
+
*/
|
|
211
|
+
this.verificationReviewInternalHeader = "Identity Verification Under Review";
|
|
212
|
+
/**
|
|
213
|
+
* @uiName Verification review internal alert description
|
|
214
|
+
*/
|
|
215
|
+
this.verificationReviewInternalDescription = "Identity verification requires further review due to a potential error. Our team is reviewing the information and will update you shortly.";
|
|
216
|
+
/**
|
|
217
|
+
* @uiName Verification failed internal alert header
|
|
218
|
+
*/
|
|
219
|
+
this.verificationFailedInternalHeader = "Identity Verification Unsuccessful";
|
|
220
|
+
/**
|
|
221
|
+
* @uiName Verification failed internal alert description
|
|
222
|
+
*/
|
|
223
|
+
this.verificationFailedInternalDescription = "Identity verification has failed. Our team is reviewing the report and will contact you with further information.";
|
|
200
224
|
/**
|
|
201
225
|
* Part of the alert displayed at the top of the page when the user needs to verify their identity.
|
|
202
226
|
* @uiName Verification required alert button text
|
|
@@ -1060,6 +1084,132 @@ export class TaxAndCashDashboard {
|
|
|
1060
1084
|
"reflect": false,
|
|
1061
1085
|
"defaultValue": "\"Complete your verification to start receiving your cash rewards. It should only take a few minutes verify.\""
|
|
1062
1086
|
},
|
|
1087
|
+
"verificationRequiredInternalHeader": {
|
|
1088
|
+
"type": "string",
|
|
1089
|
+
"mutable": false,
|
|
1090
|
+
"complexType": {
|
|
1091
|
+
"original": "string",
|
|
1092
|
+
"resolved": "string",
|
|
1093
|
+
"references": {}
|
|
1094
|
+
},
|
|
1095
|
+
"required": false,
|
|
1096
|
+
"optional": false,
|
|
1097
|
+
"docs": {
|
|
1098
|
+
"tags": [{
|
|
1099
|
+
"text": "Verification required internal alert header",
|
|
1100
|
+
"name": "uiName"
|
|
1101
|
+
}],
|
|
1102
|
+
"text": ""
|
|
1103
|
+
},
|
|
1104
|
+
"attribute": "verification-required-internal-header",
|
|
1105
|
+
"reflect": false,
|
|
1106
|
+
"defaultValue": "\"Identity Verification in Progress\""
|
|
1107
|
+
},
|
|
1108
|
+
"verificationRequiredInternalDescription": {
|
|
1109
|
+
"type": "string",
|
|
1110
|
+
"mutable": false,
|
|
1111
|
+
"complexType": {
|
|
1112
|
+
"original": "string",
|
|
1113
|
+
"resolved": "string",
|
|
1114
|
+
"references": {}
|
|
1115
|
+
},
|
|
1116
|
+
"required": false,
|
|
1117
|
+
"optional": false,
|
|
1118
|
+
"docs": {
|
|
1119
|
+
"tags": [{
|
|
1120
|
+
"text": "Verification required internal alert description",
|
|
1121
|
+
"name": "uiName"
|
|
1122
|
+
}],
|
|
1123
|
+
"text": ""
|
|
1124
|
+
},
|
|
1125
|
+
"attribute": "verification-required-internal-description",
|
|
1126
|
+
"reflect": false,
|
|
1127
|
+
"defaultValue": "\"Identity verification submission has been received. Our system is currently performing additional checks and analyzing the results. You will be updated shortley.\""
|
|
1128
|
+
},
|
|
1129
|
+
"verificationReviewInternalHeader": {
|
|
1130
|
+
"type": "string",
|
|
1131
|
+
"mutable": false,
|
|
1132
|
+
"complexType": {
|
|
1133
|
+
"original": "string",
|
|
1134
|
+
"resolved": "string",
|
|
1135
|
+
"references": {}
|
|
1136
|
+
},
|
|
1137
|
+
"required": false,
|
|
1138
|
+
"optional": false,
|
|
1139
|
+
"docs": {
|
|
1140
|
+
"tags": [{
|
|
1141
|
+
"text": "Verification review internal alert header",
|
|
1142
|
+
"name": "uiName"
|
|
1143
|
+
}],
|
|
1144
|
+
"text": ""
|
|
1145
|
+
},
|
|
1146
|
+
"attribute": "verification-review-internal-header",
|
|
1147
|
+
"reflect": false,
|
|
1148
|
+
"defaultValue": "\"Identity Verification Under Review\""
|
|
1149
|
+
},
|
|
1150
|
+
"verificationReviewInternalDescription": {
|
|
1151
|
+
"type": "string",
|
|
1152
|
+
"mutable": false,
|
|
1153
|
+
"complexType": {
|
|
1154
|
+
"original": "string",
|
|
1155
|
+
"resolved": "string",
|
|
1156
|
+
"references": {}
|
|
1157
|
+
},
|
|
1158
|
+
"required": false,
|
|
1159
|
+
"optional": false,
|
|
1160
|
+
"docs": {
|
|
1161
|
+
"tags": [{
|
|
1162
|
+
"text": "Verification review internal alert description",
|
|
1163
|
+
"name": "uiName"
|
|
1164
|
+
}],
|
|
1165
|
+
"text": ""
|
|
1166
|
+
},
|
|
1167
|
+
"attribute": "verification-review-internal-description",
|
|
1168
|
+
"reflect": false,
|
|
1169
|
+
"defaultValue": "\"Identity verification requires further review due to a potential error. Our team is reviewing the information and will update you shortly.\""
|
|
1170
|
+
},
|
|
1171
|
+
"verificationFailedInternalHeader": {
|
|
1172
|
+
"type": "string",
|
|
1173
|
+
"mutable": false,
|
|
1174
|
+
"complexType": {
|
|
1175
|
+
"original": "string",
|
|
1176
|
+
"resolved": "string",
|
|
1177
|
+
"references": {}
|
|
1178
|
+
},
|
|
1179
|
+
"required": false,
|
|
1180
|
+
"optional": false,
|
|
1181
|
+
"docs": {
|
|
1182
|
+
"tags": [{
|
|
1183
|
+
"text": "Verification failed internal alert header",
|
|
1184
|
+
"name": "uiName"
|
|
1185
|
+
}],
|
|
1186
|
+
"text": ""
|
|
1187
|
+
},
|
|
1188
|
+
"attribute": "verification-failed-internal-header",
|
|
1189
|
+
"reflect": false,
|
|
1190
|
+
"defaultValue": "\"Identity Verification Unsuccessful\""
|
|
1191
|
+
},
|
|
1192
|
+
"verificationFailedInternalDescription": {
|
|
1193
|
+
"type": "string",
|
|
1194
|
+
"mutable": false,
|
|
1195
|
+
"complexType": {
|
|
1196
|
+
"original": "string",
|
|
1197
|
+
"resolved": "string",
|
|
1198
|
+
"references": {}
|
|
1199
|
+
},
|
|
1200
|
+
"required": false,
|
|
1201
|
+
"optional": false,
|
|
1202
|
+
"docs": {
|
|
1203
|
+
"tags": [{
|
|
1204
|
+
"text": "Verification failed internal alert description",
|
|
1205
|
+
"name": "uiName"
|
|
1206
|
+
}],
|
|
1207
|
+
"text": ""
|
|
1208
|
+
},
|
|
1209
|
+
"attribute": "verification-failed-internal-description",
|
|
1210
|
+
"reflect": false,
|
|
1211
|
+
"defaultValue": "\"Identity verification has failed. Our team is reviewing the report and will contact you with further information.\""
|
|
1212
|
+
},
|
|
1063
1213
|
"verificationRequiredButtonText": {
|
|
1064
1214
|
"type": "string",
|
|
1065
1215
|
"mutable": false,
|
|
@@ -1521,7 +1671,7 @@ export class TaxAndCashDashboard {
|
|
|
1521
1671
|
"mutable": false,
|
|
1522
1672
|
"complexType": {
|
|
1523
1673
|
"original": "DemoData<UseTaxAndCashDashboardResult>",
|
|
1524
|
-
"resolved": "{ states?: { status?: string; documentType: TaxDocumentType; documentTypeString: string; canEditPayoutInfo: boolean; disabled?: boolean; dateSubmitted?: string; noFormNeeded?: boolean; indirectTaxType?: string; qstNumber?: string; subRegionTaxNumber?: string; subRegion?: string; indirectTaxNumber?: string; province?: string; country?: string; notRegistered?: boolean; isBusinessEntity?: boolean; loading?: boolean; loadingError?: boolean; showNewFormDialog: boolean;
|
|
1674
|
+
"resolved": "{ states?: { status?: string; documentType: TaxDocumentType; documentTypeString: string; canEditPayoutInfo: boolean; disabled?: boolean; dateSubmitted?: string; noFormNeeded?: boolean; indirectTaxType?: string; qstNumber?: string; subRegionTaxNumber?: string; subRegion?: string; indirectTaxNumber?: string; province?: string; country?: string; notRegistered?: boolean; isBusinessEntity?: boolean; loading?: boolean; loadingError?: boolean; showNewFormDialog: boolean; hasHold: boolean; payoutStatus: PayoutStatus; veriffLoading: boolean; errors?: { general?: boolean; }; }; }",
|
|
1525
1675
|
"references": {
|
|
1526
1676
|
"DemoData": {
|
|
1527
1677
|
"location": "import",
|
|
@@ -1565,13 +1715,14 @@ function useDemoTaxAndCashDashboard(props) {
|
|
|
1565
1715
|
hasHold: false,
|
|
1566
1716
|
showVerifyIdentity: false,
|
|
1567
1717
|
payoutStatus: "DONE",
|
|
1718
|
+
veriffLoading: false,
|
|
1568
1719
|
},
|
|
1569
1720
|
callbacks: {
|
|
1570
1721
|
onClick: () => console.debug("check step"),
|
|
1571
1722
|
onEditPayoutInfo: () => console.debug("payout info"),
|
|
1572
1723
|
onNewFormCancel: () => console.log("hide"),
|
|
1573
1724
|
onNewFormClick: () => console.log("show"),
|
|
1574
|
-
|
|
1725
|
+
onVerifyClick: () => console.log("verify"),
|
|
1575
1726
|
},
|
|
1576
1727
|
text: props.getTextProps(),
|
|
1577
1728
|
}, props.demoData || {}, { arrayMerge: (_, a) => a });
|
package/dist/collection/components/tax-and-cash/sqm-tax-and-cash-dashboard/useTaxAndCashDashboard.js
CHANGED
|
@@ -6,6 +6,7 @@ import { TAX_CONTEXT_NAMESPACE, TAX_FORM_CONTEXT_NAMESPACE, USER_QUERY_NAMESPACE
|
|
|
6
6
|
import { INDIRECT_TAX_PROVINCES, INDIRECT_TAX_SPAIN_REGIONS, } from "../subregions";
|
|
7
7
|
import { taxTypeToName } from "../utils";
|
|
8
8
|
import { getStatus } from "../sqm-payout-status-alert/usePayoutStatus";
|
|
9
|
+
import { useVeriffApp, VERIFF_COMPLETE_EVENT_KEY } from "../useVeriffApp";
|
|
9
10
|
function getCountryName(countryCode, locale) {
|
|
10
11
|
if (!countryCode)
|
|
11
12
|
return undefined;
|
|
@@ -45,13 +46,13 @@ export const useTaxAndCashDashboard = (props) => {
|
|
|
45
46
|
const setStep = useSetParent(TAX_CONTEXT_NAMESPACE);
|
|
46
47
|
const setContext = useSetParent(TAX_FORM_CONTEXT_NAMESPACE);
|
|
47
48
|
const [showDialog, setShowDialog] = useState(false);
|
|
48
|
-
const
|
|
49
|
+
const { render, loading: veriffLoading, errors: veriffErrors, } = useVeriffApp();
|
|
49
50
|
const locale = useLocale();
|
|
50
51
|
useEffect(() => {
|
|
51
52
|
// Clear override context once on submitted
|
|
52
53
|
setContext({});
|
|
53
54
|
}, []);
|
|
54
|
-
const { data, loading, errors: userError, } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
55
|
+
const { data, loading, errors: userError, refetch, } = useParentQueryValue(USER_QUERY_NAMESPACE);
|
|
55
56
|
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;
|
|
56
57
|
const documentType = publisher === null || publisher === void 0 ? void 0 : publisher.requiredTaxDocumentType;
|
|
57
58
|
const submissionDate = (_c = publisher === null || publisher === void 0 ? void 0 : publisher.currentTaxDocument) === null || _c === void 0 ? void 0 : _c.dateCreated;
|
|
@@ -76,7 +77,14 @@ export const useTaxAndCashDashboard = (props) => {
|
|
|
76
77
|
setStep("/3");
|
|
77
78
|
};
|
|
78
79
|
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;
|
|
79
|
-
const payoutStatus = getStatus(data);
|
|
80
|
+
const payoutStatus = data ? getStatus(data) : null;
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const cb = () => refetch();
|
|
83
|
+
window.addEventListener(VERIFF_COMPLETE_EVENT_KEY, cb);
|
|
84
|
+
return () => {
|
|
85
|
+
window.removeEventListener(VERIFF_COMPLETE_EVENT_KEY, cb);
|
|
86
|
+
};
|
|
87
|
+
}, []);
|
|
80
88
|
return {
|
|
81
89
|
states: {
|
|
82
90
|
dateSubmitted,
|
|
@@ -100,14 +108,14 @@ export const useTaxAndCashDashboard = (props) => {
|
|
|
100
108
|
showNewFormDialog: showDialog,
|
|
101
109
|
hasHold: !!((_m = publisher === null || publisher === void 0 ? void 0 : publisher.payoutsAccount) === null || _m === void 0 ? void 0 : _m.hold),
|
|
102
110
|
payoutStatus,
|
|
103
|
-
|
|
111
|
+
veriffLoading,
|
|
104
112
|
},
|
|
105
113
|
callbacks: {
|
|
106
114
|
onClick: () => setShowDialog(true),
|
|
115
|
+
onVerifyClick: () => render(),
|
|
107
116
|
onEditPayoutInfo,
|
|
108
117
|
onNewFormCancel: () => setShowDialog(false),
|
|
109
118
|
onNewFormClick,
|
|
110
|
-
onVerifyIdentityCancel: () => setShowVerification(false),
|
|
111
119
|
},
|
|
112
120
|
text: props.getTextProps(),
|
|
113
121
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useMutation, useUserIdentity, } from "@saasquatch/component-boilerplate";
|
|
2
|
+
import { createVeriffFrame, MESSAGES } from "@veriff/incontext-sdk";
|
|
3
|
+
import { gql } from "graphql-request";
|
|
4
|
+
const CREATE_IMPACT_VERIFICATION_SESSION = gql `
|
|
5
|
+
mutation createImpactVerificationSession($user: UserIdInput!) {
|
|
6
|
+
createImpactPublisherIdentityVerificationSession(user: $user) {
|
|
7
|
+
sessionUrl
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
const REFRESH_USER_STATUS = gql `
|
|
12
|
+
mutation refreshImpactPublisherFinanceStatus($user: UserIdInput!) {
|
|
13
|
+
refreshImpactPublisherFinanceStatus(user: $user) {
|
|
14
|
+
id
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
export const VERIFF_COMPLETE_EVENT_KEY = "sqm:veriff-updated";
|
|
19
|
+
export function useVeriffApp() {
|
|
20
|
+
const { id, accountId } = useUserIdentity();
|
|
21
|
+
const [createImpactVerificationSessionMutation, { loading, errors }] = useMutation(CREATE_IMPACT_VERIFICATION_SESSION);
|
|
22
|
+
const [refreshImpactPublisherFinanceStatus, { loading: refreshLoading, errors: refreshErrors },] = useMutation(REFRESH_USER_STATUS);
|
|
23
|
+
const refresh = async () => {
|
|
24
|
+
try {
|
|
25
|
+
const res = await refreshImpactPublisherFinanceStatus({
|
|
26
|
+
user: { id, accountId },
|
|
27
|
+
});
|
|
28
|
+
if (!res || res.message)
|
|
29
|
+
throw new Error();
|
|
30
|
+
window.dispatchEvent(new Event(VERIFF_COMPLETE_EVENT_KEY));
|
|
31
|
+
}
|
|
32
|
+
catch (e) {
|
|
33
|
+
console.error("Failed to initialise Veriff:", e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const render = async () => {
|
|
37
|
+
try {
|
|
38
|
+
const res = await createImpactVerificationSessionMutation({
|
|
39
|
+
user: { id, accountId },
|
|
40
|
+
});
|
|
41
|
+
if (!res || res.message)
|
|
42
|
+
throw new Error();
|
|
43
|
+
const sessionUrl = res.createImpactPublisherIdentityVerificationSession.sessionUrl;
|
|
44
|
+
createVeriffFrame({
|
|
45
|
+
url: sessionUrl,
|
|
46
|
+
onEvent: (msg) => {
|
|
47
|
+
switch (msg) {
|
|
48
|
+
case MESSAGES.FINISHED:
|
|
49
|
+
case MESSAGES.CANCELED:
|
|
50
|
+
refresh();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.error("Failed to initialise Veriff:", e);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
render,
|
|
61
|
+
loading: loading || refreshLoading,
|
|
62
|
+
errors: errors || refreshErrors,
|
|
63
|
+
};
|
|
64
|
+
}
|