@justifi/webcomponents 6.12.7-rc.2 → 6.12.7-rc.3
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/{Analytics-BeXvM43S.js → Analytics-GYqUuEeO.js} +2 -2
- package/dist/cjs/{Plaid-KasiL5mp.js → Plaid-6FYKaSTI.js} +7 -2
- package/dist/cjs/additional-questions-form-step_15.cjs.entry.js +35 -39
- package/dist/cjs/bank-account-document-form-inputs.cjs.entry.js +1 -1
- package/dist/cjs/bank-account-form.cjs.entry.js +2 -2
- package/dist/cjs/{business.service-BBovho58.js → business.service-t-p3-gP-.js} +1 -1
- package/dist/cjs/card-form.cjs.entry.js +2 -2
- package/dist/cjs/{check-pkg-version-BhNoPxct.js → check-pkg-version-wcoV7eK1.js} +1 -1
- package/dist/cjs/{checkout.service-C0M9hmsL.js → checkout.service-BiLHhmjP.js} +1 -1
- package/dist/cjs/dispute-notification_2.cjs.entry.js +6 -6
- package/dist/cjs/{event-types-DDNVjmfR.js → event-types-DcN23uI_.js} +1 -1
- package/dist/cjs/{get-business-Ggw-UjXj.js → get-business-BqO_Sa6H.js} +2 -2
- package/dist/cjs/{get-payment-details-BVKRwME1.js → get-payment-details-Cs-P5xoW.js} +2 -2
- package/dist/cjs/{get-subaccounts-RRmcS9xU.js → get-subaccounts-BbiIbUED.js} +2 -2
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/justifi-apple-pay_11.cjs.entry.js +7 -7
- package/dist/cjs/justifi-bank-account-billing-form-simple.cjs.entry.js +4 -4
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +4 -4
- package/dist/cjs/justifi-business-details.cjs.entry.js +7 -7
- package/dist/cjs/justifi-business-form.cjs.entry.js +7 -7
- package/dist/cjs/justifi-card-form.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkout.cjs.entry.js +4 -4
- package/dist/cjs/justifi-checkouts-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +7 -7
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +6 -6
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +5 -5
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +8 -8
- package/dist/cjs/justifi-payment-details.cjs.entry.js +7 -7
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +7 -7
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payments-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payout-details.cjs.entry.js +7 -7
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +6 -6
- package/dist/cjs/justifi-payouts-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +8 -8
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +7 -7
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +5 -5
- package/dist/cjs/justifi-terminal-orders-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +5 -5
- package/dist/cjs/justifi-terminals-list-filters.cjs.entry.js +1 -1
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +7 -7
- package/dist/cjs/{package-BEc4P6pn.js → package-BJUD_YSJ.js} +1 -1
- package/dist/cjs/{payment-provisioning-actions-Cn8bgHKu.js → payment-provisioning-actions-Dnvqbh2N.js} +2 -2
- package/dist/cjs/{payment.service-CbIxt30x.js → payment.service-DWK3fO_g.js} +1 -1
- package/dist/cjs/{payout.service-DVMvsdAf.js → payout.service-Cjc3PPfP.js} +1 -1
- package/dist/cjs/{payouts-status-CzS2CLGW.js → payouts-status-DluZkb6X.js} +2 -2
- package/dist/cjs/{plaid.service-DNT_DX6z.js → plaid.service-BaHuE_zZ.js} +1 -1
- package/dist/cjs/{terminal.service-BBHixg-d.js → terminal.service-DmlAGx7U.js} +1 -1
- package/dist/cjs/{utils-kDsk4nqH.js → utils-dnVbB8d6.js} +1 -1
- package/dist/collection/api/Document.js +7 -2
- package/dist/collection/components/business-forms/payment-provisioning/document-upload/document-upload-form-step.js +15 -17
- package/dist/collection/components/business-forms/payment-provisioning/document-upload/document-upload-options.js +15 -17
- package/dist/docs.json +2 -2
- package/dist/esm/{Analytics-D0PhqCxC.js → Analytics-Bg6T3DQV.js} +2 -2
- package/dist/esm/{Plaid-BM3JUIG5.js → Plaid-CeYMgNts.js} +7 -2
- package/dist/esm/additional-questions-form-step_15.entry.js +35 -39
- package/dist/esm/bank-account-document-form-inputs.entry.js +1 -1
- package/dist/esm/bank-account-form.entry.js +2 -2
- package/dist/esm/{business.service-C4BD3pf7.js → business.service-ZN8yGby7.js} +1 -1
- package/dist/esm/card-form.entry.js +2 -2
- package/dist/esm/{check-pkg-version-CAHx7crY.js → check-pkg-version-BXdtk1fk.js} +1 -1
- package/dist/esm/{checkout.service-DmWeKNQs.js → checkout.service-D_6Zw77V.js} +1 -1
- package/dist/esm/dispute-notification_2.entry.js +6 -6
- package/dist/esm/{event-types-eIqsrwmW.js → event-types-DXYUs2vg.js} +1 -1
- package/dist/esm/{get-business-DtFHdc37.js → get-business-rP66Ger-.js} +2 -2
- package/dist/esm/{get-payment-details-26GxiYgv.js → get-payment-details-zCO59zZz.js} +2 -2
- package/dist/esm/{get-subaccounts-xkGMPstt.js → get-subaccounts-DUopdVm2.js} +2 -2
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/justifi-apple-pay_11.entry.js +7 -7
- package/dist/esm/justifi-bank-account-billing-form-simple.entry.js +4 -4
- package/dist/esm/justifi-bank-account-form.entry.js +4 -4
- package/dist/esm/justifi-business-details.entry.js +7 -7
- package/dist/esm/justifi-business-form.entry.js +7 -7
- package/dist/esm/justifi-card-form.entry.js +4 -4
- package/dist/esm/justifi-checkout.entry.js +4 -4
- package/dist/esm/justifi-checkouts-list-filters.entry.js +1 -1
- package/dist/esm/justifi-checkouts-list.entry.js +7 -7
- package/dist/esm/justifi-dispute-management.entry.js +6 -6
- package/dist/esm/justifi-gross-payment-chart.entry.js +5 -5
- package/dist/esm/justifi-order-terminals.entry.js +8 -8
- package/dist/esm/justifi-payment-details.entry.js +7 -7
- package/dist/esm/justifi-payment-provisioning.entry.js +7 -7
- package/dist/esm/justifi-payment-transactions-list.entry.js +6 -6
- package/dist/esm/justifi-payments-list.entry.js +6 -6
- package/dist/esm/justifi-payout-details.entry.js +7 -7
- package/dist/esm/justifi-payout-transactions-list.entry.js +6 -6
- package/dist/esm/justifi-payouts-list-filters.entry.js +1 -1
- package/dist/esm/justifi-payouts-list.entry.js +8 -8
- package/dist/esm/justifi-refund-payment.entry.js +7 -7
- package/dist/esm/justifi-season-interruption-insurance.entry.js +5 -5
- package/dist/esm/justifi-terminal-orders-list-filters.entry.js +1 -1
- package/dist/esm/justifi-terminal-orders-list.entry.js +5 -5
- package/dist/esm/justifi-terminals-list-filters.entry.js +1 -1
- package/dist/esm/justifi-terminals-list.entry.js +7 -7
- package/dist/esm/{package-Blb_02Wm.js → package-DSjpDUHk.js} +1 -1
- package/dist/esm/{payment-provisioning-actions-fWdNDUdq.js → payment-provisioning-actions-BfMdBzzh.js} +2 -2
- package/dist/esm/{payment.service-CWR7jF-K.js → payment.service-CRgN4aGV.js} +1 -1
- package/dist/esm/{payout.service-CFU362cH.js → payout.service-B_APc0x_.js} +1 -1
- package/dist/esm/{payouts-status-D2G7FKu1.js → payouts-status-klusV0rp.js} +2 -2
- package/dist/esm/{plaid.service-0hd1i5Ga.js → plaid.service-DbrHt5kj.js} +1 -1
- package/dist/esm/{terminal.service-Dr6dERcJ.js → terminal.service-B5ezhIvW.js} +1 -1
- package/dist/esm/{utils-q7KOrlSX.js → utils-CfBIEaJJ.js} +1 -1
- package/dist/module/Plaid.js +7 -2
- package/dist/module/document-upload-form-step2.js +30 -34
- package/dist/module/package.js +1 -1
- package/dist/types/api/Document.d.ts +1 -2
- package/dist/types/components/business-forms/payment-provisioning/document-upload/document-upload-options.d.ts +2 -5
- package/dist/webcomponents/{p-b777d62f.entry.js → p-00335f02.entry.js} +1 -1
- package/dist/webcomponents/p-04480f3c.entry.js +1 -0
- package/dist/webcomponents/p-095e5b0e.entry.js +1 -0
- package/dist/webcomponents/{p-3a4137e7.entry.js → p-09d1663d.entry.js} +1 -1
- package/dist/webcomponents/{p-a4849f3b.entry.js → p-1358a4f0.entry.js} +1 -1
- package/dist/webcomponents/{p-af1d7ba7.entry.js → p-1f3515a8.entry.js} +1 -1
- package/dist/webcomponents/{p-f61066db.entry.js → p-21473196.entry.js} +1 -1
- package/dist/webcomponents/p-34f9fe96.entry.js +1 -0
- package/dist/webcomponents/{p-fed3bfac.entry.js → p-382f49f6.entry.js} +1 -1
- package/dist/webcomponents/{p-667a078f.entry.js → p-3a28052f.entry.js} +1 -1
- package/dist/webcomponents/{p-a3fe126f.entry.js → p-48319292.entry.js} +1 -1
- package/dist/webcomponents/{p-b17ce21d.entry.js → p-494e1254.entry.js} +1 -1
- package/dist/webcomponents/{p-3c3fbcca.entry.js → p-49c0879b.entry.js} +1 -1
- package/dist/webcomponents/{p-e0494c03.entry.js → p-4ae8f4e9.entry.js} +1 -1
- package/dist/webcomponents/{p-09f51c5c.entry.js → p-4f512f89.entry.js} +4 -4
- package/dist/webcomponents/{p-76897b50.entry.js → p-5fd4c94d.entry.js} +1 -1
- package/dist/webcomponents/{p-6768d5f6.entry.js → p-649f78de.entry.js} +1 -1
- package/dist/webcomponents/{p-368c600f.entry.js → p-69c5658c.entry.js} +1 -1
- package/dist/webcomponents/p-Bh1Vr2it.js +1 -0
- package/dist/webcomponents/{p-BrFax4_P.js → p-BtPSM2n_.js} +1 -1
- package/dist/webcomponents/p-C32sJPns.js +1 -0
- package/dist/webcomponents/{p-n_pmf4AT.js → p-Cdy3lPBL.js} +1 -1
- package/dist/webcomponents/{p-B3vR2OUB.js → p-CwP0ecN7.js} +1 -1
- package/dist/webcomponents/{p-DyNR3yHR.js → p-D8MQn8ZW.js} +1 -1
- package/dist/webcomponents/{p-Dzv0P2Ly.js → p-DGbFOjOo.js} +1 -1
- package/dist/webcomponents/p-DIpFohcg.js +1 -0
- package/dist/webcomponents/{p-czJ2qSU1.js → p-DOEMfCze.js} +1 -1
- package/dist/webcomponents/p-DSjpDUHk.js +1 -0
- package/dist/webcomponents/p-DfMQsL55.js +1 -0
- package/dist/webcomponents/{p-CL8LyqRI.js → p-DlHomiZY.js} +1 -1
- package/dist/webcomponents/{p-Cz0yhyYu.js → p-DnDbpabY.js} +1 -1
- package/dist/webcomponents/{p--RbNhyet.js → p-DspPkDq4.js} +1 -1
- package/dist/webcomponents/{p-a9976353.entry.js → p-b2224f12.entry.js} +1 -1
- package/dist/webcomponents/{p-6c807ddc.entry.js → p-b393864a.entry.js} +1 -1
- package/dist/webcomponents/{p-2ae9d5d3.entry.js → p-bbf54e31.entry.js} +1 -1
- package/dist/webcomponents/{p-eb9ea201.entry.js → p-bd466218.entry.js} +1 -1
- package/dist/webcomponents/{p-191797d9.entry.js → p-be4aee79.entry.js} +1 -1
- package/dist/webcomponents/{p-f1ee97ba.entry.js → p-cfe8eaf8.entry.js} +1 -1
- package/dist/webcomponents/{p-0c2cdb91.entry.js → p-d9287237.entry.js} +1 -1
- package/dist/webcomponents/p-d9eec0cc.entry.js +1 -0
- package/dist/webcomponents/{p-943dfa47.entry.js → p-daf41b49.entry.js} +1 -1
- package/dist/webcomponents/{p-31e0449b.entry.js → p-e29e32aa.entry.js} +1 -1
- package/dist/webcomponents/{p-864b6f32.entry.js → p-e679b76b.entry.js} +1 -1
- package/dist/webcomponents/{p-70cb8b60.entry.js → p-eb6150a8.entry.js} +1 -1
- package/dist/webcomponents/p-ebd5a44e.entry.js +1 -0
- package/dist/webcomponents/{p-374ce853.entry.js → p-f0d8ffe0.entry.js} +1 -1
- package/dist/webcomponents/{p-xWuaNtJy.js → p-jlR7CJl2.js} +1 -1
- package/dist/webcomponents/p-krYyRSq-.js +1 -0
- package/dist/webcomponents/{p-CDu7TeCZ.js → p-rISpbtJR.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/webcomponents/p-07a89d7a.entry.js +0 -1
- package/dist/webcomponents/p-2ade0336.entry.js +0 -1
- package/dist/webcomponents/p-557b2a80.entry.js +0 -1
- package/dist/webcomponents/p-6872d22b.entry.js +0 -1
- package/dist/webcomponents/p-BSyTbuZy.js +0 -1
- package/dist/webcomponents/p-Blb_02Wm.js +0 -1
- package/dist/webcomponents/p-C-zuQNNP.js +0 -1
- package/dist/webcomponents/p-D9ZHVy-j.js +0 -1
- package/dist/webcomponents/p-DdeBubpX.js +0 -1
- package/dist/webcomponents/p-d59c5fa6.entry.js +0 -1
- package/dist/webcomponents/p-vUN_uvAi.js +0 -1
|
@@ -57,21 +57,19 @@ const staticCategories = [
|
|
|
57
57
|
docTypeOptions: financialDocumentOptions,
|
|
58
58
|
},
|
|
59
59
|
];
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
],
|
|
74
|
-
}));
|
|
60
|
+
function buildPersonalDocumentCategories() {
|
|
61
|
+
return [
|
|
62
|
+
{
|
|
63
|
+
label: 'Identity Document - Group 1',
|
|
64
|
+
value: 'personal_group1',
|
|
65
|
+
docTypeOptions: personalDocGroup1Options,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: 'Identity Document - Group 2',
|
|
69
|
+
value: 'personal_group2',
|
|
70
|
+
docTypeOptions: personalDocGroup2Options,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
75
73
|
}
|
|
76
74
|
const financialOnlyCategories = [
|
|
77
75
|
{
|
|
@@ -80,11 +78,11 @@ const financialOnlyCategories = [
|
|
|
80
78
|
docTypeOptions: financialDocumentOptions,
|
|
81
79
|
},
|
|
82
80
|
];
|
|
83
|
-
function buildAllCategories(
|
|
81
|
+
function buildAllCategories(country) {
|
|
84
82
|
if (country === CountryCode.USA) {
|
|
85
83
|
return financialOnlyCategories;
|
|
86
84
|
}
|
|
87
|
-
return [...staticCategories, ...
|
|
85
|
+
return [...staticCategories, ...buildPersonalDocumentCategories()];
|
|
88
86
|
}
|
|
89
87
|
const personalDocGroup1Types = new Set(personalDocGroup1Options.filter(o => o.value).map(o => o.value));
|
|
90
88
|
const personalDocGroup2Types = new Set(personalDocGroup2Options.filter(o => o.value).map(o => o.value));
|
|
@@ -114,7 +112,7 @@ const DocumentUploadFormStep = /*@__PURE__*/ proxyCustomElement(class DocumentUp
|
|
|
114
112
|
const { owners, documents } = response.data;
|
|
115
113
|
this.owners = owners || [];
|
|
116
114
|
this.existingDocuments = documents || [];
|
|
117
|
-
this.categories = buildAllCategories(this.
|
|
115
|
+
this.categories = buildAllCategories(this.country);
|
|
118
116
|
},
|
|
119
117
|
onError: ({ error, code, severity }) => {
|
|
120
118
|
this.errorEvent.emit({
|
|
@@ -151,7 +149,6 @@ const DocumentUploadFormStep = /*@__PURE__*/ proxyCustomElement(class DocumentUp
|
|
|
151
149
|
docTypeValue: this.selectedDocType,
|
|
152
150
|
fileName: file.name,
|
|
153
151
|
file,
|
|
154
|
-
identityId: category.identityId,
|
|
155
152
|
status: 'uploading',
|
|
156
153
|
}));
|
|
157
154
|
const startIndex = this.uploadQueue.length;
|
|
@@ -162,7 +159,7 @@ const DocumentUploadFormStep = /*@__PURE__*/ proxyCustomElement(class DocumentUp
|
|
|
162
159
|
await Promise.all(newEntries.map(async (entry, i) => {
|
|
163
160
|
const index = startIndex + i;
|
|
164
161
|
try {
|
|
165
|
-
const docData = new EntityDocument({ file: entry.file, document_type: entry.docTypeValue }, this.businessId
|
|
162
|
+
const docData = new EntityDocument({ file: entry.file, document_type: entry.docTypeValue }, this.businessId);
|
|
166
163
|
const recordCreated = await this.postDocumentRecordData(docData);
|
|
167
164
|
if (!recordCreated) {
|
|
168
165
|
this.uploadQueue = this.uploadQueue.map((e, j) => j === index ? Object.assign(Object.assign({}, e), { status: 'error' }) : e);
|
|
@@ -300,19 +297,18 @@ const DocumentUploadFormStep = /*@__PURE__*/ proxyCustomElement(class DocumentUp
|
|
|
300
297
|
if (!hasUploadedDoc('business_document') && !hasExistingDoc(businessDocTypes)) {
|
|
301
298
|
errors['business_document'] = 'Please upload a business document';
|
|
302
299
|
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
300
|
+
const requiredCount = this.owners.length;
|
|
301
|
+
const group1Uploaded = this.uploadQueue.filter(entry => entry.categoryValue === 'personal_group1' && entry.status === 'uploaded').length;
|
|
302
|
+
const group1Existing = this.existingDocuments.filter(doc => personalDocGroup1Types.has(doc.document_type)).length;
|
|
303
|
+
if (group1Uploaded + group1Existing < requiredCount) {
|
|
304
|
+
errors['personal_group1'] =
|
|
305
|
+
`Please upload ${requiredCount} Group 1 identity document(s) (${group1Uploaded + group1Existing} of ${requiredCount} provided)`;
|
|
306
|
+
}
|
|
307
|
+
const group2Uploaded = this.uploadQueue.filter(entry => entry.categoryValue === 'personal_group2' && entry.status === 'uploaded').length;
|
|
308
|
+
const group2Existing = this.existingDocuments.filter(doc => personalDocGroup2Types.has(doc.document_type)).length;
|
|
309
|
+
if (group2Uploaded + group2Existing < requiredCount) {
|
|
310
|
+
errors['personal_group2'] =
|
|
311
|
+
`Please upload ${requiredCount} Group 2 identity document(s) (${group2Uploaded + group2Existing} of ${requiredCount} provided)`;
|
|
316
312
|
}
|
|
317
313
|
}
|
|
318
314
|
return errors;
|
|
@@ -321,7 +317,7 @@ const DocumentUploadFormStep = /*@__PURE__*/ proxyCustomElement(class DocumentUp
|
|
|
321
317
|
if (this.isLoading) {
|
|
322
318
|
return h(PaymentProvisioningLoading, null);
|
|
323
319
|
}
|
|
324
|
-
return (h("form", null, h("fieldset", null, h("legend", { class: "mb-0", part: heading2 }, "Document Uploads"), h("hr", { class: "mt-2" }), h("business-documents-on-file", { documents: this.existingDocuments, isLoading: this.isLoading })), h("fieldset", { class: "mt-4" }, h("div", { class: "d-flex align-items-center gap-2" }, h("legend", { class: "mb-0", part: heading2 }, "Add Document"), h("form-control-tooltip", { helpText: "Upload documents one at a time. Select the category and type, then choose a file. For
|
|
320
|
+
return (h("form", null, h("fieldset", null, h("legend", { class: "mb-0", part: heading2 }, "Document Uploads"), h("hr", { class: "mt-2" }), h("business-documents-on-file", { documents: this.existingDocuments, isLoading: this.isLoading })), this.country === CountryCode.CAN && this.owners.length > 0 && (h("div", { class: "alert alert-info mt-3" }, "One document from each group (Group 1 and Group 2) is required for each owner (", this.owners.length, " owner(s)).")), h("fieldset", { class: "mt-4" }, h("div", { class: "d-flex align-items-center gap-2" }, h("legend", { class: "mb-0", part: heading2 }, "Add Document"), h("form-control-tooltip", { helpText: "Upload documents one at a time. Select the category and type, then choose a file. For Canadian businesses, one Group 1 and one Group 2 identity document is required for each owner." })), h("hr", { class: "mt-2" }), h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "document_category", label: "Document Category", options: this.categoryOptions, defaultValue: this.selectedCategory, inputHandler: this.handleCategoryChange })), h("div", { class: "col-12 col-md-6" }, h("form-control-select", { name: "document_type", label: "Document Type", options: this.docTypeOptions, defaultValue: this.selectedDocType, inputHandler: this.handleDocTypeChange, disabled: !this.selectedCategory })), h("div", { class: "col-12" }, h("form-control-file", { key: this.fileInputKey, name: "document_file", label: "Upload Document", documentType: this.selectedDocType, onFileSelected: this.handleFileSelected, disabled: !this.selectedDocType, multiple: false })))), h("document-upload-list", { documents: this.uploadQueue }), Object.keys(this.errors).length > 0 && (h("div", { class: "alert alert-danger mt-3" }, h("ul", { class: "mb-0" }, Object.values(this.errors).map(err => h("li", null, err)))))));
|
|
325
321
|
}
|
|
326
322
|
static get watchers() { return {
|
|
327
323
|
"authToken": ["propChanged"],
|
package/dist/module/package.js
CHANGED
|
@@ -49,7 +49,6 @@ export interface DocumentRecordData {
|
|
|
49
49
|
document_type: EntityDocumentType;
|
|
50
50
|
file_name: string;
|
|
51
51
|
file_type: string;
|
|
52
|
-
identity_id?: string;
|
|
53
52
|
}
|
|
54
53
|
export declare class EntityDocumentStorage {
|
|
55
54
|
voided_check: EntityDocument[];
|
|
@@ -71,7 +70,7 @@ export declare class EntityDocument {
|
|
|
71
70
|
document_type: EntityDocumentType;
|
|
72
71
|
presigned_url: string | null;
|
|
73
72
|
record_data: DocumentRecordData | null;
|
|
74
|
-
constructor(fileData: EntityFileData, business_id: string
|
|
73
|
+
constructor(fileData: EntityFileData, business_id: string);
|
|
75
74
|
getFileData(): Promise<ArrayBuffer>;
|
|
76
75
|
setPresignedUrl(url: string): void;
|
|
77
76
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Identity } from '../../../../api';
|
|
2
1
|
import { CountryCode } from '../../../../utils/country-codes';
|
|
3
2
|
export declare const businessDocumentOptions: {
|
|
4
3
|
label: string;
|
|
@@ -19,7 +18,6 @@ export declare const personalDocGroup2Options: {
|
|
|
19
18
|
export interface DocumentCategory {
|
|
20
19
|
label: string;
|
|
21
20
|
value: string;
|
|
22
|
-
identityId?: string;
|
|
23
21
|
docTypeOptions: {
|
|
24
22
|
label: string;
|
|
25
23
|
value: string;
|
|
@@ -33,12 +31,11 @@ export interface UploadedDocumentEntry {
|
|
|
33
31
|
docTypeValue: string;
|
|
34
32
|
fileName: string;
|
|
35
33
|
file: File;
|
|
36
|
-
identityId?: string;
|
|
37
34
|
status: DocumentUploadStatus;
|
|
38
35
|
}
|
|
39
36
|
export declare const staticCategories: DocumentCategory[];
|
|
40
|
-
export declare function
|
|
37
|
+
export declare function buildPersonalDocumentCategories(): DocumentCategory[];
|
|
41
38
|
export declare const financialOnlyCategories: DocumentCategory[];
|
|
42
|
-
export declare function buildAllCategories(
|
|
39
|
+
export declare function buildAllCategories(country?: CountryCode): DocumentCategory[];
|
|
43
40
|
export declare const personalDocGroup1Types: Set<string>;
|
|
44
41
|
export declare const personalDocGroup2Types: Set<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-
|
|
1
|
+
import{r as t,h as o}from"./p-CV0Pyo1O.js";import{c as a}from"./p-D8MQn8ZW.js";import{J as s}from"./p-CwP0ecN7.js";import{w as r}from"./p-DVJaoI_m.js";import{S as p}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import"./p-DSjpDUHk.js";import"./p-CYQvLgSs.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-DGbFOjOo.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-D8GTwl9v.js";const i=class{constructor(o){t(this,o)}async componentWillLoad(){await r(),a(),this.analytics=new s(this)}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){return this.bankAccountFormElement.validate()}async tokenize({clientId:t,paymentMethodMetadata:o,account:a}){return this.bankAccountFormElement.tokenize({clientId:t,paymentMethodMetadata:o,account:a})}render(){return o(p,{key:"3a267a32b400d122cd124245979218ffc45453ee"},o("bank-account-form",{key:"72044965224da0d85455ad7688b3d1852a46126e",ref:t=>this.bankAccountFormElement=t}))}};export{i as justifi_bank_account_form}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as s,r as i,c as t}from"./p-CV0Pyo1O.js";import{a9 as e,a8 as r,a1 as o,t as l}from"./p-CPKMvyV_.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{c as n}from"./p-D8MQn8ZW.js";import{J as a}from"./p-CwP0ecN7.js";import{m as h,C as c,n as v,c as u,e as p}from"./p-DGbFOjOo.js";import{B as m}from"./p-DlHomiZY.js";import{B as f}from"./p-BcNb9bVO.js";import{m as w}from"./p-C32sJPns.js";import{S as b}from"./p-uZ5KAseb.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{g as y,a as g}from"./p-rISpbtJR.js";import{T as x}from"./p-jlR7CJl2.js";import{l as j}from"./p-BRnBHsdq.js";import"./p-DSjpDUHk.js";import"./p-CYQvLgSs.js";import"./p-D8GTwl9v.js";const S=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(b,{width:"25%"})),s("div",{class:"col-12"},s(b,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(b,{width:"50%"}),s(b,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(b,{width:"65%"}),s(b,{width:"35%"}))),C=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(b,{width:"40%",height:"40px"})),s(S,null)),k=()=>s("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},s("div",{class:"d-flex align-items-center gap-3"},s(b,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),s("div",{class:"flex-grow-1"},s("div",{class:"d-flex row flex-row"},s("div",{class:"col-6 flex-column"},s(b,null),s(b,{width:"60%"})),s("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},s(b,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),s(b,{width:"80px",height:"32px"}),s(b,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),s("div",{class:"mt-4"},s("div",{class:"d-flex flex-column gap-2"},s(b,null),s(b,null)))))),O=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.submitted=t(this,"submit-event",7),this.shipping=!1,this.submitButtonText="Submit Order",this.loading={business:!0,terminals:!0},this.submitting=!1,this.error=null,this.totalQuantity=0}componentWillLoad(){this.order=new v({business_id:this.businessId,sub_account_id:this.accountId,order_type:this.shipping?u.boardingShipping:u.boardingOnly}),n(),this.analytics=new a(this),this.loadData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}handleError(s,i,t){this.error={message:s,code:i,severity:t},this.errorEvent.emit({errorCode:i,message:s,severity:t})}loadData(){this.businessId&&this.authToken?(this.initializeGetBusiness(),this.initializeGetTerminalModels()):this.handleError("Invalid business id or auth token",p.MISSING_PROPS,c.ERROR)}initializeGetBusiness(){w({id:this.businessId,authToken:this.authToken,service:new m})({onSuccess:({business:s})=>{this.business=new f(s)},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t)},final:()=>{this.loading.business=!1}})}initializeGetTerminalModels(){(({id:s,authToken:i,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,n;try{const a=await t.fetchTerminalModels(s,i);if(a.error)return r({error:g(a.error),code:y(null===(n=a.error)||void 0===n?void 0:n.code),severity:c.ERROR});e({terminals:(null===(l=null===(o=a.data)||void 0===o?void 0:o.terminal_order_models)||void 0===l?void 0:l.map((s=>new h(s))))||[],orderLimit:null===(d=a.data)||void 0===d?void 0:d.order_limit})}catch(s){const i=y(null==s?void 0:s.code);return r({error:s.message||s,code:i,severity:c.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new x})({onSuccess:({terminals:s,orderLimit:i})=>{this.terminalModels=s,this.orderLimit=i,this.loading.terminals=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.loading.terminals=!1}})}submitOrder(){const s=(({authToken:s,service:i,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await i.orderTerminals(s,e,t);if(d.error)return o({error:g(d.error),code:y(null===(l=d.error)||void 0===l?void 0:l.code),severity:c.ERROR});{const{data:s}=d;r({data:s})}}catch(s){const i=y(null==s?void 0:s.code);return o({error:s.message||s,code:i,severity:c.ERROR})}})({authToken:this.authToken,service:new x});this.submitting=!0,s({terminalOrder:this.order.payload,onSuccess:({data:s})=>{this.submitted.emit(s),this.submitting=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.submitting=!1}})}onSelectedQuantityChange(s){this.order.updateTerminal(s.detail.modelName,s.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return s("div",null,this.loading.business&&s(C,null),this.loading.terminals&&s("div",{class:"mt-5"},s(k,null),s(k,null),s(k,null)))}renderBusinessDetails(){var i,t,o,l,d,n,a,h;if(!this.loading.business&&this.business)return s("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},s("div",{class:"row"},s("div",{class:"col-12"},s("h2",{part:r},this.business.legal_name))),s("div",{class:"row"},s("div",{class:"col-6"},s("h5",{part:e},"Representative:"),s("div",null,s("div",null,null===(t=null===(i=this.business)||void 0===i?void 0:i.representative)||void 0===t?void 0:t.name),s("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),s("div",null,null===(n=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===n?void 0:n.email),s("div",null,j(null===(h=null===(a=this.business)||void 0===a?void 0:a.representative)||void 0===h?void 0:h.phone)))),s("div",{class:"col-6"},s("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),s("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",s("br",null),this.business.legal_address.city,", ",this.business.legal_address.state," ",this.business.legal_address.postal_code))))}renderTerminals(){if(!this.loading.terminals&&this.terminalModels)return s("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((i=>s("terminal-quantity-selector",{modelName:i.model_name,description:i.description,imageUrl:i.image_url,helpUrl:i.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return s("div",{class:"mt-3"},s("div",{class:"text-end"},"Order limit: ",this.orderLimit),s("div",{class:"d-flex justify-content-end mt-3"},s("button",{class:"btn btn-primary submit-btn",onClick:this.submitOrder.bind(this),disabled:0===this.order.totalQuantity||this.submitting,part:o},this.submitting?"Submitting...":this.submitButtonText)))}render(){return s(d,{key:"a6d128c8f7075ba4bf6dc033e357dac187cdb965"},s("div",{key:"9e726c70efc7e9b9163ded2ca1e88dc4303b2f21",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{O as justifi_order_terminals}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as s,F as e,r as i,c as t}from"./p-CV0Pyo1O.js";import{E as a}from"./p-Cu7hgXL1.js";import{B as r}from"./p-DlHomiZY.js";import{m as o}from"./p-C32sJPns.js";import{C as n,e as l}from"./p-DGbFOjOo.js";import{J as p}from"./p-CwP0ecN7.js";import{c}from"./p-D8MQn8ZW.js";import{S as d}from"./p-DzEdYT8R.js";import"./p-CZfYo5-1.js";import{S as h}from"./p-uZ5KAseb.js";import"./p-CPKMvyV_.js";import"./p-CYQvLgSs.js";import"./p-DVJaoI_m.js";import"./p-D8GTwl9v.js";import"./p-BRnBHsdq.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import"./p-BcNb9bVO.js";import"./p-rISpbtJR.js";import"./p-DSjpDUHk.js";const m=()=>{const i=()=>s("div",{class:"mt-5"},s(h,{width:"40%",height:"1.5rem"}),s("hr",null),s("div",{class:"row g-3"},s("div",{class:"col-12 col-md-6"},s(h,null),s(h,null),s(h,null)),s("div",{class:"col-12 col-md-6"},s(h,null),s(h,null),s(h,null))));return s(e,null,s(i,null),s(i,null),s(i,null),s(i,null))},u=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event",7),this.loading=!0}componentWillLoad(){c(),this.analytics=new p(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetBusiness()}initializeGetBusiness(){this.businessId&&this.authToken?(this.getBusiness=o({id:this.businessId,authToken:this.authToken,service:new r}),this.fetchData()):(this.errorMessage="Invalid business id or auth token",this.errorEvent.emit({errorCode:l.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}updateOnPropChange(){this.getBusiness&&this.fetchData()}fetchData(){this.loading=!0,this.getBusiness({onSuccess:({business:s})=>{this.business=s,this.errorMessage=null},onError:({error:s,code:e,severity:i})=>{this.errorMessage=s,this.errorEvent.emit({errorCode:e,message:s,severity:i})},final:()=>{this.loading=!1}})}render(){return s(d,{key:"7ce48e6905cdbbf8f94470913ecfa3ef8dbb76c7"},this.loading&&s(m,{key:"7c3439e0c247436cd7951d3bdc32e7672c9f8447"}),!this.loading&&this.errorMessage&&a(this.errorMessage),!this.loading&&!this.errorMessage&&this.business&&s("justifi-details",{key:"bf57dacf2067f2704014ce3e002958e3306bba73",errorMessage:this.errorMessage},s("div",{key:"46d19a178ba0d33aa21a4f3900128e3e905731a9",slot:"detail-sections"},s("core-info-details",{key:"ac217a4cfe6b45810a85ca320760b7331f76e60b",business:this.business}),s("legal-address-details",{key:"1fc1a196a43bcf5f9eafd09bfe74c8bb7c409797",legalAddress:this.business.legal_address}),s("representative-details",{key:"1e0833606b129f69a05946726172963cbec05189",representative:this.business.representative}),s("owner-details",{key:"c974111dc67a8961ef6435c34843ca927ad8a7e5",owners:this.business.owners}),s("additional-questions-details",{key:"0951d284a373457e98a1dafc80231ec3ee057e0a",additionalQuestions:this.business.additional_questions}))))}static get watchers(){return{businessId:["propChanged"],authToken:["propChanged"],getBusiness:["updateOnPropChange"]}}};export{u as justifi_business_details}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,h as s,H as i}from"./p-CV0Pyo1O.js";import{C as a,e as r,z as n,w as o,x as l,y as h}from"./p-Dzv0P2Ly.js";import{m as c,a as d,c as u,d as m,e as b,f as p,g as f}from"./p-BrFax4_P.js";import{B as v,a as y,D as g,I as k}from"./p-CL8LyqRI.js";import{a as w,d as _,b as T,g as C,h as L}from"./p-B1yVkh15.js";import{F as x,c as S,a as O,b as j}from"./p-D9sqTVmd.js";import{A,C as D,e as E,R as I,f as V,O as H}from"./p-BcNb9bVO.js";import{C as P,P as B,I as N}from"./p-CVaOFfrI.js";import{b as M,a0 as R,C as F,x as W,u as q,D as z,aa as U,a6 as Z,aj as Y,am as $,A as G,a1 as Q}from"./p-CPKMvyV_.js";import{P as X}from"./p-DSclFZ32.js";import{a as K,c as J,d as tt,b as et}from"./p-BBSnDYJw.js";import{a as st,B as it}from"./p-XYgDHrVL.js";import{n as at}from"./p-BnjCmwMr.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{B as rt,C as nt,v as ot,D as lt,E as ht,F as ct,G as dt}from"./p-DV4n8kZd.js";import{B as ut}from"./p-CHo7TfsM.js";import"./p-CZfYo5-1.js";import{c as mt}from"./p-BzXQDB0t.js";import{s as bt,b as pt,d as ft}from"./p-BRnBHsdq.js";import{S as vt}from"./p-uZ5KAseb.js";import{u as yt,a as gt,b as kt}from"./p-C6o0liMT.js";import{A as wt}from"./p-CYQvLgSs.js";import{S as _t}from"./p-DzEdYT8R.js";import{P as Tt}from"./p-BSyTbuZy.js";import"./p-CDu7TeCZ.js";import"./p-BFTU3MAI.js";import"./p-D8GTwl9v.js";class Ct{constructor(t){this.id=t.id,this.account_owner_name=t.account_owner_name,this.full_name=t.full_name,this.account_type=t.account_type,this.account_number=t.account_number,this.acct_last_four=t.acct_last_four,this.account_number_last4=t.account_number_last4,this.routing_number=t.routing_number,this.institution_number=t.institution_number,this.transit_number=t.transit_number,this.bank_name=t.bank_name,this.country=t.country,this.currency=t.currency,this.nickname=t.nickname,this.metadata=t.metadata,this.business_id=t.business_id,this.platform_account_id=t.platform_account_id,this.created_at=t.created_at,this.updated_at=t.updated_at}get payload(){return{account_owner_name:this.account_owner_name||"",account_type:this.account_type||"",account_number:this.account_number||"",routing_number:this.routing_number||"",institution_number:this.institution_number||"",transit_number:this.transit_number||"",bank_name:this.bank_name||"",nickname:this.nickname||"",business_id:this.business_id||""}}}const Lt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.additional_questions={},this.recurringPayments=!1,this.isLoading=!1,this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.additional_questions=new A(t.data.additional_questions||{}),this.formController.setInitialValues(Object.assign({},this.additional_questions))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}})},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.additionalQuestions}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e})),this.additional_questions=new A(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}recurringPaymentsWatcher(t){this.recurringPayments="Yes"===(null==t?void 0:t.business_recurring_payments)}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{additional_questions:new A(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new x(w(this.allowOptionalFields))}componentDidLoad(){this.getBusiness&&this.getData(),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e,i,a,r;const n=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Additional Questions"),s("form-control-tooltip",{helpText:"This information helps us understand the business and identify and monitor trends to safeguard you and your customers."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_revenue",label:"What is your business' estimated annual revenue from its primary business activities?",inputHandler:this.inputHandler,errorText:null===(t=this.errors)||void 0===t?void 0:t.business_revenue,defaultValue:null==n?void 0:n.business_revenue,maskOptions:P.WHOLE})),s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_payment_volume",label:"What is your business' annual credit card & ACH volume anticipated to process?",inputHandler:this.inputHandler,errorText:null===(e=this.errors)||void 0===e?void 0:e.business_payment_volume,defaultValue:null==n?void 0:n.business_payment_volume,maskOptions:P.WHOLE})),s("div",{class:"col-12"},s("form-control-number",{name:"business_average_transaction_amount",label:"What is your average transaction size?",inputHandler:this.inputHandler,errorText:null===(i=this.errors)||void 0===i?void 0:i.business_average_transaction_amount,defaultValue:null==n?void 0:n.business_average_transaction_amount})),s("div",{class:"col-12"},s("form-control-select",{name:"business_when_service_received",label:"On average, how long after paying will your customers typically receive their goods or services?",inputHandler:this.inputHandler,errorText:null===(a=this.errors)||void 0===a?void 0:a.business_when_service_received,options:K,defaultValue:null==n?void 0:n.business_when_service_received})),s("div",{class:"col-12"},s("form-control-text",{name:"business_other_payment_details",label:"Is there anything else you would like us to know about how your customers pay the business? (optional)",inputHandler:this.inputHandler,errorText:null===(r=this.errors)||void 0===r?void 0:r.business_other_payment_details,defaultValue:null==n?void 0:n.business_other_payment_details})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],additional_questions:["recurringPaymentsWatcher"]}}},xt=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n;return s("div",{key:"d3445ce89732e19baea2e8f224c42011d5a03998",class:"row gy-3"},s("div",{key:"966e1d8ba6043b4f9b57ae0061ae94c177c12b48",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"314a4f7e181b978b2ff1fdbfdfc8d9484089829a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"45ac55707ce44b208adaf72e944ea3056810183a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"74ce58b36eb3a425d900d7bb0858bda18b2e341c",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:J,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"2562105aaaae00d9c46eb61d931a43927d96a8ce",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),s("div",{key:"4c7e6cba0ee1e2567dc5b608559b13ebd3fddd07",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Routing Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.routing_number)||""}):s("form-control-text",{name:"routing_number",label:"Routing Number",defaultValue:this.defaultValue.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))}},St=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n,o;return s("div",{key:"8de8f05777f72ecb1112328544e75be7cd929e8d",class:"row gy-3"},s("div",{key:"513fb78b434ba3aebe51b636f7494b54e437c65f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"37a1ef4ac58fbe1633a93020e786d546cd832867",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"fc8820e264d14ac3c5a1c6fd171b381c2b6d99e1",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"f183b1c5f6a8b0f905c916cd1715448f3e02d26f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:J,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"8366ebde2f319f6d910a34917f57ad43b3ee234f",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Transit Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.transit_number)||""}):s("form-control-text",{name:"transit_number",label:"Transit Number",defaultValue:this.defaultValue.transit_number,maxLength:5,errorText:this.errors.transit_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"5 digits"})),s("div",{key:"c91166337c2984048466014634f5d4e59ce2b40a",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Institution Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.institution_number)||""}):s("form-control-text",{name:"institution_number",label:"Institution Number",defaultValue:this.defaultValue.institution_number,maxLength:3,errorText:this.errors.institution_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"3 digits"})),s("div",{key:"ebce2f50ec265ed2fef7a0b3dae84d33036ad145",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(o=this.defaultValue)||void 0===o?void 0:o.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement. Do not include spaces or dashes."})))}},Ot=t=>t?{bank_name:ht.nullable(),nickname:lt.nullable(),account_owner_name:ot.nullable(),account_type:nt.nullable(),account_number:rt.nullable()}:{bank_name:ht.required("Enter bank name"),nickname:lt.required("Enter nickname"),account_owner_name:ot.required("Enter account owner name"),account_type:nt.required("Select account type"),account_number:rt.required("Enter account number")},jt={[D.USA]:t=>(t=>{const e=Object.assign(Object.assign({},Ot(t)),(t=>t?{routing_number:dt.nullable()}:{routing_number:dt.required("Enter routing number")})(t));return S().shape(e)})(t),[D.CAN]:t=>(t=>{const e=Object.assign(Object.assign({},Ot(t)),(t=>{const e=O().length(3,"Institution number must be 3 digits").matches(ct,"Enter valid institution number"),s=O().length(5,"Transit number must be 5 digits").matches(ct,"Enter valid transit number");return t?{institution_number:e.nullable(),transit_number:s.nullable()}:{institution_number:e.required("Enter institution number"),transit_number:s.required("Enter transit number")}})(t));return S().shape(e)})(t)},At=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.bankAccount={},this.isLoading=!1,this.viewMode="manual",this.bankAccountVerification=!1,this.platformAccountId=null,this.getSchema=()=>(0,jt[this.country])(this.allowOptionalFields),this.initializeFormController=()=>{this.formController=new x(this.getSchema()),this.formController.setInitialValues("readonly"===this.viewMode?Object.assign({},this.bankAccount):{business_id:this.businessId}),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.initializeFormController(),this.isLoading=!1}})},this.handleChangeBankAccount=()=>{this.viewMode=this.plaidAvailable?"plaid":"manual",this.initializeFormController()},this.handleCancel=()=>{this.viewMode=this.existingBankAccount?"readonly":"plaid",this.initializeFormController()},this.handleToggleToManualEntry=()=>{this.viewMode="manual"},this.handleToggleToPlaidVerification=()=>{this.viewMode="plaid"},this.handleSaveBankAccount=async()=>{this.formController.validateAndSubmit((()=>{this.sendData((()=>{}))}))}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){"readonly"===this.viewMode?this.sendData(t):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData(),this.formController=new x(this.getSchema())}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postBankAccount=u({authToken:this.authToken,service:new y})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get postPayload(){const t=this.formController.values.getValue();return new Ct(t).payload}get existingBankAccount(){var t;return!!(null===(t=this.bankAccount)||void 0===t?void 0:t.id)}get plaidAvailable(){return this.bankAccountVerification&&!!this.platformAccountId}get showCancel(){return this.bankAccountVerification||this.existingBankAccount}processBusinessResponse(t){const{bank_accounts:e,settings:s,platform_account_id:i}=t;e.length>0?this.bankAccount=new Ct(e[e.length-1]):(this.bankAccount=new Ct({}),this.bankAccount.business_id=this.businessId),this.bankAccountVerification=!0===s.bank_account_verification,this.platformAccountId=i}determineViewMode(){this.viewMode=this.existingBankAccount?"readonly":this.plaidAvailable?"plaid":"manual"}async sendData(t){try{if("manual"===this.viewMode){if(!await this.postBankAccountData())return;this.viewMode="readonly",await this.refreshBankAccountData()}t()}catch(t){this.errorEvent.emit({message:t,errorCode:r.POST_ERROR,severity:a.ERROR})}}async postBankAccountData(){let t;return this.isLoading=!0,new Promise((e=>{let s=!1;this.postBankAccount({payload:this.postPayload,onSuccess:e=>{t=e,s=!0},onError:({error:t,code:e,severity:i})=>{s=!1,this.errorEvent.emit({message:t,errorCode:e,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:t,formStep:st.bankAccount}),this.isLoading=!1,e(s)}})}))}async refreshBankAccountData(){return new Promise((t=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode(),this.initializeFormController()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1,t()}})}))}renderBankAccountInputs(t){const e=this.formController.getInitialValues();return s(this.country===D.CAN?"bank-account-form-inputs-canada":"bank-account-form-inputs",{defaultValue:e,errors:this.errors,inputHandler:this.inputHandler,formDisabled:t})}renderReadonlyView(){return s("div",null,this.renderBankAccountInputs(!0),s("div",{class:"mt-3"},s(ut,{variant:"secondary",type:"button",onClick:this.handleChangeBankAccount,disabled:this.isLoading,part:R},"Change Bank Account")))}renderPlaidView(){return s("div",{class:"mt-3"},s("plaid-verification",{authToken:this.authToken,accountId:this.platformAccountId,businessId:this.businessId,onPlaidVerificationSuccess:()=>{this.viewMode="readonly",this.refreshBankAccountData()}}),s("div",{class:"mt-3"},s(ut,{type:"button",variant:"link",className:"p-0",onClick:this.handleToggleToManualEntry,disabled:this.isLoading,part:F},"Enter bank details manually (document upload required)")))}renderManualEntryView(){return s("div",null,this.plaidAvailable&&s("div",{class:"mb-3"},s(ut,{type:"button",variant:"secondary",onClick:this.handleToggleToPlaidVerification,disabled:this.isLoading,part:R},"Link bank account with Plaid instead")),this.renderBankAccountInputs(!1),s("div",{class:"mt-3 d-flex gap-2"},this.showCancel&&s(ut,{variant:"secondary",type:"button",onClick:this.handleCancel,disabled:this.isLoading,part:R},"Cancel"),s(ut,{variant:"primary",type:"button",onClick:this.handleSaveBankAccount,disabled:this.isLoading,isLoading:this.isLoading},"Save Bank Account")))}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",{class:"mb-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Bank Account Info"),s("form-control-tooltip",{helpText:"This direct deposit account is the designated bank account where incoming funds will be deposited. The name of this account must match the registered business name exactly. We are not able to accept personal accounts unless your business is a registered sole proprietorship."})),s("hr",{class:"mt-2"}),"readonly"===this.viewMode&&this.renderReadonlyView(),"plaid"===this.viewMode&&this.renderPlaidView(),"manual"===this.viewMode&&this.renderManualEntryView()))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Dt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.coreInfo={},this.isLoading=!1,this.isEditingTaxId=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.coreInfo=new E(t.data),this.formController.setInitialValues(Object.assign({},this.coreInfo))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t(),this.isEditingTaxId=!1},onError:({error:t,code:s,severity:i,rawError:a})=>{e=t,a&&"object"==typeof a&&a.param&&this.formController.setFieldError(a.param,a.message),this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.businessInfo}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.errors[t]&&this.formController.clearFieldError(t),this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return new E(this.formController.values.getValue()).payload}componentWillLoad(){this.initializeApi();const t=this.country===D.CAN?_(this.allowOptionalFields):T(this.allowOptionalFields);this.formController=new x(t),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e;const i=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Business Information")),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"legal_name",label:"Business Name",defaultValue:i.legal_name,errorText:this.errors.legal_name,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (don't use acronyms or abbreviations unless you registered that way)."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"doing_business_as",label:"Doing Business As (DBA)",defaultValue:i.doing_business_as,errorText:this.errors.doing_business_as,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (leave blank if you don't have a registered DBA/trade name)"})),s("div",{class:"col-12 col-md-8"},s("form-control-select",{name:"classification",label:"Business Classification",options:tt,defaultValue:i.classification,errorText:this.errors.classification,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-4"},s("form-control-date",{name:"date_of_incorporation",label:"Date of Registration",defaultValue:i.date_of_incorporation,errorText:this.errors.date_of_incorporation,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"industry",label:"Industry",defaultValue:i.industry,errorText:this.errors.industry,inputHandler:this.inputHandler,helpText:"Describe what you sell"})),s("div",{class:"col-12 col-md-6"},!(null===(t=this.coreInfo)||void 0===t?void 0:t.tax_id_last4)||this.isEditingTaxId?s("form-control-number-masked",{name:"tax_id",label:mt[this.country].taxIdLabelOptional||mt[this.country].taxIdLabel,defaultValue:this.isEditingTaxId?"":i.tax_id,errorText:this.errors.tax_id,inputHandler:this.inputHandler,mask:"000000000",helpText:mt[this.country].taxIdHelpText}):s("div",null,s("label",{class:"form-label",part:W},mt[this.country].taxIdLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(e=this.coreInfo)||void 0===e?void 0:e.tax_id_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingTaxId=!0,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{tax_id:"",tax_id_last4:null}))}},"Change")))),s("div",{class:"col-12"},s("form-control-text",{name:"website_url",label:"Business Website URL",defaultValue:i.website_url,errorText:this.errors.website_url,inputHandler:this.inputHandler,helpText:"Don't have a live website? You can use your social media business page, app store link, or staging site URL."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"email",label:"Business Email Address",defaultValue:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-number-masked",{name:"phone",label:"Business Phone Number",defaultValue:i.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:B.US})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Et=class{constructor(e){t(this,e),this.documents=[],this.isLoading=!1}render(){return this.isLoading?s(vt,{height:"50px"}):this.documents.length?s(i,null,s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Documents Already on File"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Date Uploaded"))),s("tbody",null,this.documents.sort(((t,e)=>t.document_type.localeCompare(e.document_type))).map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:Y},t.file_name),s("td",{part:Y},t.file_type),s("td",{part:Y},bt(t.document_type)),s("td",{part:Y},`${pt(t.created_at)} - ${ft(t.created_at)}`))))))))),s("hr",null)):null}},It=class{constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownersPayload=[],this.refs=[],this.isLoading=!1,this.representativeIsOwner=null,this.matchRef=(t,e)=>{if(null===t)return;const s=this.ownersPayload.findIndex((t=>t.id===e));-1!==s&&(this.refs.length!==this.ownersPayload.length&&this.manageRefs(),this.refs[s]=t)},this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),t.data.owners.length?this.ownersPayload=t.data.owners.map((t=>({id:t.id}))):this.addOwnerForm()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1,this.manageRefs()}})},this.sendData=async t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:{owners:this.ownersPayload},onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.owners}),this.formLoading.emit(!1)}})},this.addOwnerForm=t=>{this.newFormOpen=!0,this.ownersPayload=[...this.ownersPayload,{id:""}],t&&this.clickEvent.emit({name:it.addOwnerForm})},this.removeOwnerForm=t=>{this.ownersPayload=this.ownersPayload.filter((e=>e.id!==t)),this.newFormOpen&&(this.newFormOpen=!1)},this.handleRepresentativeIsOwnerChange=t=>{this.representativeIsOwner=t,this.representativeIsOwner&&(this.formLoading.emit(!0),this.isLoading=!0,this.ownersPayload=this.ownersPayload.filter((t=>""!==t.id)),this.patchBusiness({payload:{representative:{is_owner:!0},owners:[{id:this.representative.id},...this.ownersPayload]},onSuccess:()=>{this.getData(),this.newFormOpen=!1},finally:()=>{this.isLoading=!1,this.formLoading.emit(!1)}}))}}propChanged(){this.initializeApi()}get showAddOwnerButton(){return this.ownersPayload.length<4&&!this.newFormOpen}manageRefs(){this.refs=this.ownersPayload.map((t=>t.id))}async validateAndSubmit({onSuccess:t}){const e=this.refs.map((t=>t.validate()));if(!(await Promise.all(e)).every((t=>t)))return;if(!this.allowOptionalFields&&100!==(await Promise.all(this.refs.map((t=>t.getOwnershipPercentage())))).reduce(((t,e)=>t+(parseFloat(e)||0)),0))return void await Promise.all(this.refs.map((t=>t.setOwnershipPercentageError("Ownership percentages must total 100%"))));const s=this.refs.map((t=>t.submit()));(await Promise.all(s)).every((t=>t))&&this.sendData(t)}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}ownersWatcher(){this.manageRefs()}handleOwnerSubmit(t){const e=t.detail,s=this.ownersPayload.map((t=>t.id===e.id?e:t));s.includes(e)||(s[this.ownersPayload.findIndex((t=>!t.id))]=e,this.newFormOpen&&(this.newFormOpen=!1)),this.ownersPayload=s}render(){if(this.isLoading)return s(i,null,s(X,null));const t=this.ownersPayload.some((t=>t.id===this.representative.id)),e=null===this.representativeIsOwner&&!t;return s(i,null,s("div",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Owners"),s("form-control-tooltip",{helpText:"For partnerships, LLCs or privately held corporations, the business is required to apply with all individuals with 25% or more ownership to the application. For charities and registered non-profits, the business is required to apply with 1 individual with substantial control over the entity, such as a board member or director."})),s("hr",{class:"mt-2"}),e&&s("div",{class:"alert alert-warning mb-3",part:$},s("div",{class:"card-body"},s("div",{class:"d-flex align-items-center mb-3"},s("strong",null,"Is the representative of this business also an owner?")),s("div",{class:"d-flex gap-2"},s(ut,{variant:"primary",onClick:()=>this.handleRepresentativeIsOwnerChange(!0)},"Yes"),s(ut,{variant:"secondary",onClick:()=>this.handleRepresentativeIsOwnerChange(!1)},"No")))),s("div",{class:"row gy-3"},this.ownersPayload.map((t=>s("owner-form",{key:t.id,authToken:this.authToken,businessId:this.businessId,ownerId:t.id,removeOwner:this.removeOwnerForm,newFormOpen:this.newFormOpen,ownersLength:this.ownersPayload.length,country:this.country,allowOptionalFields:this.allowOptionalFields,ref:e=>this.matchRef(e,t.id)})))),s("div",{class:"d-flex justify-content-start"},s("div",{class:"gap-2"},s(ut,{variant:"primary",onClick:()=>this.addOwnerForm(!0),hidden:!this.showAddOwnerButton},"Add Owner")))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],ownersPayload:["ownersWatcher"]}}},Vt=class{constructor(e){t(this,e),this.isEditingIdentification=!1,this.inputHandler=(t,e)=>{yt(this.formController,{[t]:e})},this.onAddressFormUpdate=t=>{gt(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),t))}}render(){var t,e,i,a,r,n,o,l,h;return s("form",{key:"2346f250e4e2982b5b5b2624d039f551b5b5ed4e"},s("fieldset",{key:"7b496e6157e5eec02ef0d263c68fbd1e001c75ac"},s("div",{key:"b86d993c7fbee2269e48c7d4ea51826f199fecd4",class:"d-flex align-items-center gap-2"},s("legend",{key:"2b013e6068bbbca54a0852093ab4a2fae4ce64d2",class:"mb-0",part:M},"Representative"),s("form-control-tooltip",{key:"01e0f1d6ba2d5ee852593f7015a3ba7e0d980df9",helpText:"The representative for your business needs to be someone who has significant control over managing your business's finance. You will have an opportunity to add owners later in the form."})),s("hr",{key:"4bec34756ec7081e01809175bc3d2b6af0532537",class:"mt-2"}),s("div",{key:"6965720fabb1f12c6bb3c5a81f74ae12f44037b2",class:"row gy-3"},s("div",{key:"efbb768ba1e66d5ef47f792c39a17921b40e0eba",class:"col-12 col-md-8"},s("form-control-text",{key:"28477d3798ba7d14aee9201e84b276d8e85a21df",name:"name",label:"Full Name",defaultValue:null===(t=this.representativeDefaultValue)||void 0===t?void 0:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"28f17ccbe4da476256acd9c5a4e78a6a641ba6e9",class:"col-12 col-md-4"},s("form-control-select",{key:"dae6a93a0bc057abb97024277be0f10de01514e2",name:"title",label:"Title",options:et,defaultValue:null===(e=this.representativeDefaultValue)||void 0===e?void 0:e.title,errorText:this.errors.title,inputHandler:this.inputHandler})),s("div",{key:"2f9a45774adaa0040df2da1a8000d1ee61e16bf5",class:"col-12 col-md-6"},s("form-control-text",{key:"66a2a1ea8b54c03c012d76a74654ee19a9f958a7",name:"email",label:"Email Address",defaultValue:null===(i=this.representativeDefaultValue)||void 0===i?void 0:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"3b34f0cb11d358db2220c01aac90e8b7ba3cc01b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"52c62ec653fb917a248a302f7cb5ad46dc7bcc23",name:"phone",label:"Phone Number",defaultValue:null===(a=this.representativeDefaultValue)||void 0===a?void 0:a.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:B.US})),s("div",{key:"d287ec225af1541cca227d3b8bc54466cbb86b07",class:"col-12 col-md-4"},s("form-control-date",{key:"7e1ff6cc40b01dc7f6ad0ad84d73c0e59eea0d6f",name:"dob_full",label:"Birth Date",defaultValue:null===(r=this.representativeDefaultValue)||void 0===r?void 0:r.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:t=>kt(t,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"283b09c845f1a12f4974f82a26fffbf7c5f608ba",class:"col-12 col-md-8"},!(null===(n=this.representativeDefaultValue)||void 0===n?void 0:n.ssn_last4)||this.isEditingIdentification?s("form-control-number-masked",{name:"identification_number",label:this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel,defaultValue:this.isEditingIdentification?"":null===(o=this.representativeDefaultValue)||void 0===o?void 0:o.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:N[this.country],helpText:mt[this.country].identityHelpText}):s("div",null,s("label",{class:"form-label",part:W},this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(l=this.representativeDefaultValue)||void 0===l?void 0:l.ssn_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingIdentification=!0,yt(this.formController,{identification_number:"",ssn_last4:null})}},"Change")))),s("div",{key:"0a40679570df7b85faa7530797ebc21ca8794263",class:"col-12"},s("identity-address-form",{key:"5a1590251365260413ab63ce9a417d3d71c71e84",errors:this.errors.address,defaultValues:null===(h=this.representativeDefaultValue)||void 0===h?void 0:h.address,handleFormUpdate:this.onAddressFormUpdate,country:this.country})))))}},Ht=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.representative={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&this.formController&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),this.representative.address.country=this.country,this.formController.setInitialValues(Object.assign({},this.representative))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.representative}),this.formLoading.emit(!1)}})}}propChanged(){this.initializeApi(),this.getData()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.initializeForm()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}initializeForm(){const t=C[this.country];t?(this.formController=new x(t("representative",this.allowOptionalFields)),this.getData()):this.errorEvent.emit({message:"Missing schema for selected country",errorCode:r.MISSING_PROPS,severity:a.ERROR})}componentDidLoad(){this.formController&&this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get patchPayload(){return{representative:new I(this.formController.values.getValue()).payload}}render(){return!this.formController||this.isLoading?s(X,null):s("business-representative-form-inputs",{representativeDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Pt=class{constructor(s){t(this,s),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.formCompleted=e(this,"formCompleted",7),this.errors={},this.fetchData=async()=>{this.formLoading.emit(!0);try{const t=await this.api.get({endpoint:this.businessEndpoint,authToken:this.authToken});this.acceptedTermsBefore=t.data.terms_conditions_accepted}catch(t){this.errorEvent.emit({errorCode:r.FETCH_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.sendData=async t=>{this.formLoading.emit(!0);try{const e=this.termsPayload,s=await this.api.post({endpoint:this.termsConditionsEndpoint,body:e,authToken:this.authToken});this.handleResponse(s,t)}catch(t){this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.inputHandler=(t,e)=>{this.acceptedTerms=e,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}get businessEndpoint(){return`entities/business/${this.businessId}`}get termsConditionsEndpoint(){return"entities/terms_and_conditions"}get formHelperText(){return this.acceptedTermsBefore?"You have already accepted the terms and conditions.":null}get termsPayload(){return{business_id:this.businessId,accepted:this.formController.values.getValue().accepted,user_agent:window.navigator.userAgent}}async componentWillLoad(){this.api=wt(),this.formController=new x((t=>{const e=S({accepted:j().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),s=S({accepted:j().nullable()});return t?s:e})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(t,e){t.error?this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.error.message,severity:a.ERROR,data:t.error}):e(),this.stepCompleteEvent.emit({response:t,formStep:st.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:t}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:st.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),t()):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get merchantAgreementLink(){return s("a",{href:"https://justifi.tech/merchant-agreement/",target:"_blank",rel:"noopener noreferrer"},"merchant agreement")}render(){return s("form",{key:"24b0a8ff0187894cf5e0f56e9e4b28c378e720cb"},s("fieldset",{key:"26fa9159dd6d61edd28b9443a10eeb981f150308"},s("legend",{key:"103bdecbc51f2cccd9105e2f9b271b60760618ec",part:M},"Terms and Conditions"),s("hr",{key:"dfd29fbe609a57d8160df7980ed0e63e75934a86"}),s("div",{key:"61e06597ec652c1d7c6e7e2bd8c9b653d061d076"},s("p",{key:"cd4def71580cd14d6edb5887221ebf6aa80cc2ea"},"Please read and accept the ",this.merchantAgreementLink," to submit your provisioning request.")),s("br",{key:"e3c64733f11a4f702e686e6c5ae7acd7e6bd1c34"}),s("div",{key:"71bd74de3aee69805a2aa1297356ff8b8db3c76c",class:"row-gy-3"},s("div",{key:"94a28c13e3bbc1c89cd1b5ebde2e1732b48f99ea",class:"col-12"},s("form-control-checkbox",{key:"fee95fa42192fee1bbfd544307b4e1c11c0d97f4",name:"accepted",label:"I agree to the terms and conditions",inputHandler:this.inputHandler,errorText:this.errors.accepted,disabled:this.acceptedTermsBefore,helpText:this.formHelperText,checked:this.acceptedTerms})))))}},Bt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Statement",value:"bank_statement"}],Nt=[{label:"Select a document type",value:""},{label:"Canadian Passport",value:"passport"},{label:"Canadian Driver's License",value:"driver_license"},{label:"Canadian Government Issued ID Card",value:"government_id"},{label:"Permanent Resident Card",value:"resident_card"},{label:"Certificate of Indian Status",value:"status_card"},{label:"US State Issued Driver's License",value:"driver_license"}],Mt=[{label:"Select a document type",value:""},{label:"Nexus Card (Photo ID)",value:"nexus_card"},{label:"Canadian Citizenship/Naturalization Card or Certificate",value:"citizenship_card"},{label:"Foreign Passport",value:"foreign_passport"},{label:"Canadian Birth Certificate",value:"birth_certificate"},{label:"Social Insurance Number (SIN) Card",value:"sin_card"},{label:"Social Security Number (SSN) Card",value:"ssn_card"}],Rt=[{label:"Business Document",value:"business_document",docTypeOptions:[{label:"Select a document type",value:""},{label:"Articles of Incorporation",value:"articles_of_incorporation"},{label:"Business Registration",value:"business_registration"}]},{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}];function Ft(t){const e=Nt.filter((t=>""!==t.value)),s=Mt.filter((t=>""!==t.value));return t.map((t=>({label:`${t.name} - Identity Document`,value:`personal_${t.id}`,identityId:t.id,docTypeOptions:[{label:"Select a document type",value:""},{label:"── Group 1 ──",value:"_group1_header"},...e,{label:"── Group 2 ──",value:"_group2_header"},...s]})))}const Wt=[{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}],qt=new Set(Nt.filter((t=>t.value)).map((t=>t.value))),zt=new Set(Mt.filter((t=>t.value)).map((t=>t.value))),Ut=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.owners=[],this.existingDocuments=[],this.selectedCategory="",this.selectedDocType="",this.uploadQueue=[],this.isLoading=!1,this.errors={},this.fileInputKey=0,this.categories=[],this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{const{owners:e,documents:s}=t.data;this.owners=e||[],this.existingDocuments=s||[],this.categories=function(t,e){return e===D.USA?Wt:[...Rt,...Ft(t)]}(this.owners,this.country)},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1}})},this.handleCategoryChange=(t,e)=>{this.selectedCategory=e,this.selectedDocType=""},this.handleDocTypeChange=(t,e)=>{e.startsWith("_")&&e.endsWith("_header")||(this.selectedDocType=e)},this.handleFileSelected=async t=>{const e=Array.from(t.detail.fileList),s=this.categories.find((t=>t.value===this.selectedCategory));if(!s)return;const i=s.docTypeOptions.find((t=>t.value===this.selectedDocType)),a=(null==i?void 0:i.label)||this.selectedDocType,r=e.map((t=>({categoryLabel:s.label,categoryValue:s.value,docTypeLabel:a,docTypeValue:this.selectedDocType,fileName:t.name,file:t,identityId:s.identityId,status:"uploading"}))),o=this.uploadQueue.length;this.uploadQueue=[...this.uploadQueue,...r],this.selectedCategory="",this.selectedDocType="",this.fileInputKey++,await Promise.all(r.map((async(t,e)=>{const s=o+e;try{const e=new n({file:t.file,document_type:t.docTypeValue},this.businessId,t.identityId);if(!await this.postDocumentRecordData(e))return void(this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t)));const i=await this.uploadDocument(e);this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:i?"uploaded":"error"}):t))}catch(t){this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t))}})))},this.postDocumentRecordData=async t=>{const e=t.record_data;return new Promise((s=>{this.postDocumentRecord({payload:e,onSuccess:e=>{s(this.handleDocRecordResponse(t,e))},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i}),s(!1)}})}))},this.handleDocRecordResponse=(t,e)=>e.error?(this.errorEvent.emit({errorCode:r.POST_ERROR,message:e.error.message,severity:a.ERROR,data:e.error}),!1):(t.setPresignedUrl(e.data.presigned_url),!0),this.uploadDocument=async t=>{if(!t.presigned_url)throw new Error("Presigned URL is not set");const e=await t.getFileData();return!!(await fetch(t.presigned_url,{method:"PUT",body:e})).ok||(this.errorEvent.emit({errorCode:r.POST_ERROR,message:"Failed to upload document",severity:a.ERROR}),!1)}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){const e=this.validate();Object.keys(e).length>0?this.errors=e:(this.errors={},this.stepCompleteEvent.emit({response:null,formStep:st.documentUpload}),t())}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postDocumentRecord=m({authToken:this.authToken,service:new g})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get categoryOptions(){return[{label:"Select a category",value:""},...this.categories.map((t=>({label:t.label,value:t.value})))]}get docTypeOptions(){if(!this.selectedCategory)return[{label:"Select a category first",value:""}];const t=this.categories.find((t=>t.value===this.selectedCategory));return(null==t?void 0:t.docTypeOptions)||[{label:"Select a category first",value:""}]}validate(){if(this.allowOptionalFields)return{};const t={},e=t=>this.existingDocuments.some((e=>t.includes(e.document_type))),s=t=>this.uploadQueue.some((e=>e.categoryValue===t&&"uploaded"===e.status));if(s("financial_document")||e(["voided_check","bank_statement"])||(t.financial_document="Please upload a financial document"),this.country===D.CAN){const i=["articles_of_incorporation","business_registration"];s("business_document")||e(i)||(t.business_document="Please upload a business document");for(const e of this.owners){const s=`personal_${e.id}`,i=this.uploadQueue.filter((t=>t.categoryValue===s&&"uploaded"===t.status)),a=i.some((t=>qt.has(t.docTypeValue))),r=i.some((t=>zt.has(t.docTypeValue)));a||(t[`personal_group1_${e.id}`]=`Please upload a Group 1 identity document for ${e.name}`),r||(t[`personal_group2_${e.id}`]=`Please upload a Group 2 identity document for ${e.name}`)}}return t}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("legend",{class:"mb-0",part:M},"Document Uploads"),s("hr",{class:"mt-2"}),s("business-documents-on-file",{documents:this.existingDocuments,isLoading:this.isLoading})),s("fieldset",{class:"mt-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Add Document"),s("form-control-tooltip",{helpText:"Upload documents one at a time. Select the category and type, then choose a file. For identity documents, two documents from different groups are required per owner."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_category",label:"Document Category",options:this.categoryOptions,defaultValue:this.selectedCategory,inputHandler:this.handleCategoryChange})),s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_type",label:"Document Type",options:this.docTypeOptions,defaultValue:this.selectedDocType,inputHandler:this.handleDocTypeChange,disabled:!this.selectedCategory})),s("div",{class:"col-12"},s("form-control-file",{key:this.fileInputKey,name:"document_file",label:"Upload Document",documentType:this.selectedDocType,onFileSelected:this.handleFileSelected,disabled:!this.selectedDocType,multiple:!1})))),s("document-upload-list",{documents:this.uploadQueue}),Object.keys(this.errors).length>0&&s("div",{class:"alert alert-danger mt-3"},s("ul",{class:"mb-0"},Object.values(this.errors).map((t=>s("li",null,t))))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Zt=class{constructor(e){t(this,e),this.documents=[]}renderStatus(t){switch(t){case"uploading":return s("span",{class:"badge bg-info"},"Uploading...");case"uploaded":return s("span",{class:"badge bg-success"},"Uploaded");case"error":return s("span",{class:"badge bg-danger"},"Error")}}render(){return this.documents.length?s("div",{class:"mt-4"},s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Uploaded Documents"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"Category"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"30%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"20%"},part:Z,scope:"col"},"Status"))),s("tbody",null,this.documents.map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:Y},t.categoryLabel),s("td",{part:Y},t.docTypeLabel),s("td",{part:Y},t.fileName),s("td",{part:Y},this.renderStatus(t.status))))))))))):null}},Yt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.legal_address={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{const e=new V((t.data||{}).legal_address||{});this.legal_address=Object.assign(Object.assign({},e),{country:this.country}),this.formController.setInitialValues(Object.assign({},this.legal_address))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.legalAddress}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{legal_address:new V(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new x((0,L[this.country])(this.allowOptionalFields)),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t;const e=null===(t=this.formController)||void 0===t?void 0:t.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Legal Address of your Business"),s("form-control-tooltip",{helpText:"No PO Boxes."})),s("hr",{class:"mt-2"}),s("form-address-fields",{country:this.country,errors:this.errors,defaultValues:e,inputHandler:this.inputHandler})))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},$t=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownerSubmitted=e(this,"ownerSubmitted",7),this.isLoading=!1,this.errors={},this.owner={},this.getData=()=>{this.getOwner&&(this.isLoading=!0,this.getOwner({onSuccess:t=>{this.instantiateOwner(t.data)},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>this.isLoading=!1}))},this.sendData=()=>(this.isLoading=!0,new Promise((t=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async t=>{this.owner=Object.assign({},new H(t)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?it.updateOwner:it.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:it.removeOwner})},this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async getOwnershipPercentage(){var t;return(null===(t=this.formController.values.getValue())||void 0===t?void 0:t.ownership_percentage)||null}async setOwnershipPercentageError(t){this.formController.setFieldError("ownership_percentage",t)}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(t){t.preventDefault(),await this.validate()&&this.submit()}get payload(){const t=new H(this.formController.values.getValue()).payload;return this.ownerId?t:Object.assign(Object.assign({},t),{business_id:this.businessId})}get formTitle(){return this.ownerId?"Edit Business Owner":"Add Business Owner"}get submitButtonText(){return this.ownerId?"Update":"Add"}get showRemoveButton(){return!(this.ownersLength<=1)&&(!(this.ownerId||!this.newFormOpen)||!(!this.ownerId||this.newFormOpen)||void 0)}componentWillLoad(){this.formController=new x((0,C[this.country])("owner",this.allowOptionalFields)),this.initializeApi(),this.ownerId&&this.getOwner?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((t=>this.errors=Object.assign({},t)))}initializeApi(){this.authToken&&(this.getOwner=b({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.patchOwner=p({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.postOwner=f({authToken:this.authToken,service:new k}))}render(){return s(i,{key:"b168e9f5a52416984e6a04ab5f0771b63ee28b2e",style:{display:"block"}},s("form",{key:"d22a6aae3f5debd30d87b3bd37c67390a46c4590",onSubmit:this.validateAndSubmit},s("fieldset",{key:"30597bc1f4983bddbdc0ed45e6be7e715d0b9b8e"},s("legend",{key:"055ca2b6bbfa4e86591411668eaead3bd0d95ea8",class:"fw-semibold fs-5 w-100",part:G},this.formTitle),s("br",{key:"f0d2d9624611ee888ff318ec1525281bf007e346"}),s("div",{key:"2c38a166f681404c2ab303630217e54c15f1e5f2",class:"row gy-3"},s("owner-form-inputs",{key:"05253624d3d79f0ba7a4ec49b387e252e796e5b6",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country}),s("div",{key:"8e0e67966f047c3f9a4b30f28983f67db2372c0c",class:"d-flex gap-2 justify-content-start"},s(ut,{key:"e33368a968efe5faf52a08e36bb2bef215625c4a",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(ut,{key:"7bb79b0624dfb3a8645182432c484f288cc73692",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"ef4f86dd1b1878e92c98e4a826f9fbad808e15b7"}))))}static get watchers(){return{isLoading:["loadingWatcher"]}}},Gt=class{constructor(s){t(this,s),this.plaidVerificationSuccess=e(this,"plaidVerificationSuccess",7),this.plaidVerificationError=e(this,"plaidVerificationError",7),this.linkToken=null,this.linkTokenId=null,this.plaidLink=null,this.isAuthenticating=!1,this.isSuccess=!1,this.error=null,this.isLoading=!1,this.plaidService=new Tt,this.abortController=null,this.timeoutId=null,this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:l[h.PLAID_LINK_TOKEN_FAILED],severity:o[h.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:h.PLAID_LINK_INIT_FAILED,message:l[h.PLAID_LINK_INIT_FAILED],severity:o[h.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,s,i;try{if(!this.authToken||!this.accountId)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please provide authToken and accountId.",severity:a.ERROR,retryable:!1,userAction:"Provide required props"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const t=await this.plaidService.getLinkTokenForVerification(this.authToken,this.businessId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),t.error)throw new Error("string"==typeof t.error?t.error:t.error.message||"Failed to get link token");this.linkToken=t.data.link_token,this.linkTokenId=t.data.id}catch(a){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let r=h.PLAID_LINK_TOKEN_FAILED,n=l[r],c=!0;"AbortError"===a.name?(r=h.PLAID_TIMEOUT,n=l[r],c=!0):(null===(t=a.message)||void 0===t?void 0:t.includes("network"))||(null===(e=a.message)||void 0===e?void 0:e.includes("fetch"))?(r=h.PLAID_NETWORK_ERROR,n=l[r],c=!0):((null===(s=a.message)||void 0===s?void 0:s.includes("401"))||(null===(i=a.message)||void 0===i?void 0:i.includes("unauthorized")))&&(r=h.PLAID_INVALID_CREDENTIALS,n="Authentication failed. Please check your credentials.",c=!1),this.handleError({code:r,message:n,severity:o[r],originalError:a,retryable:c,userAction:c?"Click to try again":"Check your credentials"})}},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=async t=>{var e;this.isAuthenticating=!1,this.isLoading=!0,this.clearError();try{const s=await this.plaidService.postPlaidVerifiedBankAccountData(this.authToken,this.businessId,{public_token:t,link_token_id:this.linkTokenId},null===(e=this.abortController)||void 0===e?void 0:e.signal);if(s.error)throw new Error("string"==typeof s.error?s.error:s.error.message||"Failed to verify bank account");this.isSuccess=!0,this.isLoading=!1,this.plaidVerificationSuccess.emit({publicToken:t,bankAccount:s.data})}catch(t){this.isLoading=!1,this.handleError({code:h.PLAID_AUTHENTICATION_FAILED,message:(null==t?void 0:t.message)||"Failed to verify bank account",severity:o[h.PLAID_AUTHENTICATION_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=h.PLAID_AUTHENTICATION_FAILED,s=l[e],i=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=h.PLAID_INVALID_CREDENTIALS,s=l[e],i=!0;break;case"ITEM_LOGIN_REQUIRED":e=h.PLAID_INVALID_CREDENTIALS,s="Your bank requires re-authentication. Please try again.",i=!0;break;case"ITEM_LOCKED":e=h.PLAID_ACCOUNT_LOCKED,s=l[e],i=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=h.PLAID_MAINTENANCE,s=l[e],i=!0;break;case"RATE_LIMIT_EXCEEDED":e=h.PLAID_RATE_LIMITED,s=l[e],i=!0;break;default:t.error_message&&(s=t.error_message)}this.handleError({code:e,message:s,severity:o[e],originalError:t,retryable:i,userAction:a}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.isLoading=!1,this.plaidVerificationError.emit(t),console.error("Plaid verification error:",t)},this.clearError=()=>{this.error&&(this.error=null)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.initializePlaidLink()},this.scriptRef.onerror=()=>{this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}disconnectedCallback(){this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){const t=s("svg",{class:"plaid-logo-img",height:"20",width:"20",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"5px",marginRight:"5px",marginTop:"-2px"}},s("g",{fill:"#fff","fill-rule":"evenodd"},s("path",{d:"M25.7629 26.2628L28 17.5309L24.9691 14.5001L27.9999 11.4691L25.7628 2.73706L17.0309 0.5L14.0001 3.531L10.969 0.50014L2.23706 2.73734L0 11.4691L3.03128 14.4999L0.00014 17.531L2.2372 26.2629L10.9691 28.5L14.0001 25.469L17.031 28.4999L25.7629 26.2628ZM15.7321 23.7371L18.6186 20.8505L22.2912 24.5233L17.6956 25.7007L15.7321 23.7371ZM11.1136 9.88154L14.0003 6.99502L16.8868 9.8814L14.0001 12.7679L11.1136 9.88154ZM12.2682 14.5L9.38154 17.3865L6.49502 14.5L9.38154 11.6135L12.2682 14.5ZM18.6187 11.6133L21.5053 14.5L18.6186 17.3865L15.7321 14.5L18.6187 11.6133ZM16.8867 19.1186L14.0001 22.0051L11.1135 19.1185L14.0001 16.2319L16.8867 19.1186ZM10.3044 25.7007L5.70864 24.5233L9.38154 20.8504L12.2682 23.7371L10.3044 25.7007ZM4.76308 16.2319L7.6496 19.1185L3.9767 22.7914L2.7993 18.1957L4.76308 16.2319ZM3.9767 6.20836L7.64974 9.8814L4.76308 12.7681L2.7993 10.8041L3.9767 6.20836ZM12.2683 5.26294L9.38168 8.1496L5.70892 4.4767L10.3047 3.2993L12.2683 5.26294ZM17.6959 3.2993L22.2915 4.4767L18.6186 8.14946L15.7321 5.26294L17.6959 3.2993ZM23.2372 12.7681L20.3505 9.8814L24.0233 6.20878L25.2007 10.8046L23.2372 12.7681ZM24.0233 22.7914L20.3505 19.1186L23.2372 16.2321L25.2007 18.1957L24.0233 22.7914Z"})));return s(_t,null,s("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),s("div",null,s("div",{class:"mb-3"},s(ut,{variant:"primary",type:"button",onClick:t=>{t.preventDefault(),this.openPlaidLink()},disabled:this.isLoading,part:Q},"Connect with Plaid ",t," (instant verification)")),(()=>this.error?s("div",{class:(this.error.severity===a.ERROR?"text-danger":this.error.severity===a.WARNING?"text-warning":"text-info")+" mt-2"},s("small",null,this.error.message),s("br",null),this.error.userAction&&s("small",{class:"text-muted"},this.error.userAction)):null)(),(()=>this.error?null:this.isLoading?s("div",{class:"text-info mt-2"},s("small",null,"Verifying bank account...")):this.isSuccess?s("div",{class:"text-success mt-2"},s("small",null,"✓ Bank account verified successfully")):this.isAuthenticating?s("div",{class:"text-info mt-2"},s("small",null,"Connecting to your bank...")):null)()))}};export{Lt as additional_questions_form_step,xt as bank_account_form_inputs,St as bank_account_form_inputs_canada,At as business_bank_account_form_step,Dt as business_core_info_form_step,Et as business_documents_on_file,It as business_owners_form_step,Vt as business_representative_form_inputs,Ht as business_representative_form_step,Pt as business_terms_conditions_form_step,Ut as document_upload_form_step,Zt as document_upload_list,Yt as legal_address_form_step,$t as owner_form,Gt as plaid_verification}
|
|
1
|
+
import{r as t,c as e,h as s,H as i}from"./p-CV0Pyo1O.js";import{C as a,e as r,z as n,w as o,x as l,y as h}from"./p-DGbFOjOo.js";import{m as c,a as d,c as u,d as m,e as b,f as p,g as f}from"./p-BtPSM2n_.js";import{B as v,a as y,D as g,I as k}from"./p-DlHomiZY.js";import{a as w,d as _,b as T,g as C,h as L}from"./p-B1yVkh15.js";import{F as x,c as O,a as S,b as j}from"./p-D9sqTVmd.js";import{A,C as D,e as E,R as I,f as V,O as H}from"./p-BcNb9bVO.js";import{C as P,P as B,I as N}from"./p-CVaOFfrI.js";import{b as M,a0 as R,C as F,x as W,u as q,D as z,aa as U,a6 as Z,aj as Y,am as G,A as $,a1 as Q}from"./p-CPKMvyV_.js";import{P as X}from"./p-DSclFZ32.js";import{a as J,c as K,d as tt,b as et}from"./p-BBSnDYJw.js";import{a as st,B as it}from"./p-XYgDHrVL.js";import{n as at}from"./p-BnjCmwMr.js";import"./p-DVJaoI_m.js";import"./p-HXpYMWUU.js";import"./p-CLHwhyvu.js";import{B as rt,C as nt,v as ot,D as lt,E as ht,F as ct,G as dt}from"./p-DV4n8kZd.js";import{B as ut}from"./p-CHo7TfsM.js";import"./p-CZfYo5-1.js";import{c as mt}from"./p-BzXQDB0t.js";import{s as bt,b as pt,d as ft}from"./p-BRnBHsdq.js";import{S as vt}from"./p-uZ5KAseb.js";import{u as yt,a as gt,b as kt}from"./p-C6o0liMT.js";import{A as wt}from"./p-CYQvLgSs.js";import{S as _t}from"./p-DzEdYT8R.js";import{P as Tt}from"./p-DfMQsL55.js";import"./p-rISpbtJR.js";import"./p-BFTU3MAI.js";import"./p-D8GTwl9v.js";class Ct{constructor(t){this.id=t.id,this.account_owner_name=t.account_owner_name,this.full_name=t.full_name,this.account_type=t.account_type,this.account_number=t.account_number,this.acct_last_four=t.acct_last_four,this.account_number_last4=t.account_number_last4,this.routing_number=t.routing_number,this.institution_number=t.institution_number,this.transit_number=t.transit_number,this.bank_name=t.bank_name,this.country=t.country,this.currency=t.currency,this.nickname=t.nickname,this.metadata=t.metadata,this.business_id=t.business_id,this.platform_account_id=t.platform_account_id,this.created_at=t.created_at,this.updated_at=t.updated_at}get payload(){return{account_owner_name:this.account_owner_name||"",account_type:this.account_type||"",account_number:this.account_number||"",routing_number:this.routing_number||"",institution_number:this.institution_number||"",transit_number:this.transit_number||"",bank_name:this.bank_name||"",nickname:this.nickname||"",business_id:this.business_id||""}}}const Lt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.additional_questions={},this.recurringPayments=!1,this.isLoading=!1,this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.additional_questions=new A(t.data.additional_questions||{}),this.formController.setInitialValues(Object.assign({},this.additional_questions))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}})},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.additionalQuestions}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e})),this.additional_questions=new A(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}recurringPaymentsWatcher(t){this.recurringPayments="Yes"===(null==t?void 0:t.business_recurring_payments)}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{additional_questions:new A(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new x(w(this.allowOptionalFields))}componentDidLoad(){this.getBusiness&&this.getData(),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e,i,a,r;const n=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Additional Questions"),s("form-control-tooltip",{helpText:"This information helps us understand the business and identify and monitor trends to safeguard you and your customers."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_revenue",label:"What is your business' estimated annual revenue from its primary business activities?",inputHandler:this.inputHandler,errorText:null===(t=this.errors)||void 0===t?void 0:t.business_revenue,defaultValue:null==n?void 0:n.business_revenue,maskOptions:P.WHOLE})),s("div",{class:"col-12 col-md-6"},s("form-control-monetary-provisioning",{name:"business_payment_volume",label:"What is your business' annual credit card & ACH volume anticipated to process?",inputHandler:this.inputHandler,errorText:null===(e=this.errors)||void 0===e?void 0:e.business_payment_volume,defaultValue:null==n?void 0:n.business_payment_volume,maskOptions:P.WHOLE})),s("div",{class:"col-12"},s("form-control-number",{name:"business_average_transaction_amount",label:"What is your average transaction size?",inputHandler:this.inputHandler,errorText:null===(i=this.errors)||void 0===i?void 0:i.business_average_transaction_amount,defaultValue:null==n?void 0:n.business_average_transaction_amount})),s("div",{class:"col-12"},s("form-control-select",{name:"business_when_service_received",label:"On average, how long after paying will your customers typically receive their goods or services?",inputHandler:this.inputHandler,errorText:null===(a=this.errors)||void 0===a?void 0:a.business_when_service_received,options:J,defaultValue:null==n?void 0:n.business_when_service_received})),s("div",{class:"col-12"},s("form-control-text",{name:"business_other_payment_details",label:"Is there anything else you would like us to know about how your customers pay the business? (optional)",inputHandler:this.inputHandler,errorText:null===(r=this.errors)||void 0===r?void 0:r.business_other_payment_details,defaultValue:null==n?void 0:n.business_other_payment_details})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],additional_questions:["recurringPaymentsWatcher"]}}},xt=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n;return s("div",{key:"d3445ce89732e19baea2e8f224c42011d5a03998",class:"row gy-3"},s("div",{key:"966e1d8ba6043b4f9b57ae0061ae94c177c12b48",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"314a4f7e181b978b2ff1fdbfdfc8d9484089829a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"45ac55707ce44b208adaf72e944ea3056810183a",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"74ce58b36eb3a425d900d7bb0858bda18b2e341c",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:K,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"2562105aaaae00d9c46eb61d931a43927d96a8ce",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement/check. Do not include spaces or dashes."})),s("div",{key:"4c7e6cba0ee1e2567dc5b608559b13ebd3fddd07",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Routing Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.routing_number)||""}):s("form-control-text",{name:"routing_number",label:"Routing Number",defaultValue:this.defaultValue.routing_number,maxLength:9,errorText:this.errors.routing_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"A valid routing number is nine digits. Please include any leading or trailing zeroes."})))}},Ot=class{constructor(e){t(this,e)}render(){var t,e,i,a,r,n,o;return s("div",{key:"8de8f05777f72ecb1112328544e75be7cd929e8d",class:"row gy-3"},s("div",{key:"513fb78b434ba3aebe51b636f7494b54e437c65f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Bank Name",value:null===(t=this.defaultValue)||void 0===t?void 0:t.bank_name}):s("form-control-text",{name:"bank_name",label:"Bank Name",defaultValue:this.defaultValue.bank_name,errorText:this.errors.bank_name,inputHandler:this.inputHandler})),s("div",{key:"37a1ef4ac58fbe1633a93020e786d546cd832867",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Nickname",value:null===(e=this.defaultValue)||void 0===e?void 0:e.nickname}):s("form-control-text",{name:"nickname",label:"Nickname",defaultValue:this.defaultValue.nickname,errorText:this.errors.nickname,inputHandler:this.inputHandler})),s("div",{key:"fc8820e264d14ac3c5a1c6fd171b381c2b6d99e1",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Owner Name",value:null===(i=this.defaultValue)||void 0===i?void 0:i.account_owner_name}):s("form-control-text",{name:"account_owner_name",label:"Account Owner Name",defaultValue:this.defaultValue.account_owner_name,errorText:this.errors.account_owner_name,inputHandler:this.inputHandler})),s("div",{key:"f183b1c5f6a8b0f905c916cd1715448f3e02d26f",class:"col-12"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Type",value:null===(a=this.defaultValue)||void 0===a?void 0:a.account_type}):s("form-control-select",{name:"account_type",label:"Account Type",options:K,defaultValue:this.defaultValue.account_type,errorText:this.errors.account_type,inputHandler:this.inputHandler})),s("div",{key:"8366ebde2f319f6d910a34917f57ad43b3ee234f",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Transit Number",value:(null===(r=this.defaultValue)||void 0===r?void 0:r.transit_number)||""}):s("form-control-text",{name:"transit_number",label:"Transit Number",defaultValue:this.defaultValue.transit_number,maxLength:5,errorText:this.errors.transit_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"5 digits"})),s("div",{key:"c91166337c2984048466014634f5d4e59ce2b40a",class:"col-3"},this.formDisabled?s("bank-account-read-only-value",{label:"Institution Number",value:(null===(n=this.defaultValue)||void 0===n?void 0:n.institution_number)||""}):s("form-control-text",{name:"institution_number",label:"Institution Number",defaultValue:this.defaultValue.institution_number,maxLength:3,errorText:this.errors.institution_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"3 digits"})),s("div",{key:"ebce2f50ec265ed2fef7a0b3dae84d33036ad145",class:"col-6"},this.formDisabled?s("bank-account-read-only-value",{label:"Account Number",value:(null===(o=this.defaultValue)||void 0===o?void 0:o.account_number_last4)?`**** ${this.defaultValue.account_number_last4}`:""}):s("form-control-text",{name:"account_number",label:"Account Number",defaultValue:this.defaultValue.account_number,maxLength:17,errorText:this.errors.account_number,inputHandler:this.inputHandler,keyDownHandler:at,helpText:"Please copy the account number as shown on your statement. Do not include spaces or dashes."})))}},St=t=>t?{bank_name:ht.nullable(),nickname:lt.nullable(),account_owner_name:ot.nullable(),account_type:nt.nullable(),account_number:rt.nullable()}:{bank_name:ht.required("Enter bank name"),nickname:lt.required("Enter nickname"),account_owner_name:ot.required("Enter account owner name"),account_type:nt.required("Select account type"),account_number:rt.required("Enter account number")},jt={[D.USA]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>t?{routing_number:dt.nullable()}:{routing_number:dt.required("Enter routing number")})(t));return O().shape(e)})(t),[D.CAN]:t=>(t=>{const e=Object.assign(Object.assign({},St(t)),(t=>{const e=S().length(3,"Institution number must be 3 digits").matches(ct,"Enter valid institution number"),s=S().length(5,"Transit number must be 5 digits").matches(ct,"Enter valid transit number");return t?{institution_number:e.nullable(),transit_number:s.nullable()}:{institution_number:e.required("Enter institution number"),transit_number:s.required("Enter transit number")}})(t));return O().shape(e)})(t)},At=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.bankAccount={},this.isLoading=!1,this.viewMode="manual",this.bankAccountVerification=!1,this.platformAccountId=null,this.getSchema=()=>(0,jt[this.country])(this.allowOptionalFields),this.initializeFormController=()=>{this.formController=new x(this.getSchema()),this.formController.setInitialValues("readonly"===this.viewMode?Object.assign({},this.bankAccount):{business_id:this.businessId}),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))},this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.initializeFormController(),this.isLoading=!1}})},this.handleChangeBankAccount=()=>{this.viewMode=this.plaidAvailable?"plaid":"manual",this.initializeFormController()},this.handleCancel=()=>{this.viewMode=this.existingBankAccount?"readonly":"plaid",this.initializeFormController()},this.handleToggleToManualEntry=()=>{this.viewMode="manual"},this.handleToggleToPlaidVerification=()=>{this.viewMode="plaid"},this.handleSaveBankAccount=async()=>{this.formController.validateAndSubmit((()=>{this.sendData((()=>{}))}))}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){"readonly"===this.viewMode?this.sendData(t):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData(),this.formController=new x(this.getSchema())}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postBankAccount=u({authToken:this.authToken,service:new y})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get postPayload(){const t=this.formController.values.getValue();return new Ct(t).payload}get existingBankAccount(){var t;return!!(null===(t=this.bankAccount)||void 0===t?void 0:t.id)}get plaidAvailable(){return this.bankAccountVerification&&!!this.platformAccountId}get showCancel(){return this.bankAccountVerification||this.existingBankAccount}processBusinessResponse(t){const{bank_accounts:e,settings:s,platform_account_id:i}=t;e.length>0?this.bankAccount=new Ct(e[e.length-1]):(this.bankAccount=new Ct({}),this.bankAccount.business_id=this.businessId),this.bankAccountVerification=!0===s.bank_account_verification,this.platformAccountId=i}determineViewMode(){this.viewMode=this.existingBankAccount?"readonly":this.plaidAvailable?"plaid":"manual"}async sendData(t){try{if("manual"===this.viewMode){if(!await this.postBankAccountData())return;this.viewMode="readonly",await this.refreshBankAccountData()}t()}catch(t){this.errorEvent.emit({message:t,errorCode:r.POST_ERROR,severity:a.ERROR})}}async postBankAccountData(){let t;return this.isLoading=!0,new Promise((e=>{let s=!1;this.postBankAccount({payload:this.postPayload,onSuccess:e=>{t=e,s=!0},onError:({error:t,code:e,severity:i})=>{s=!1,this.errorEvent.emit({message:t,errorCode:e,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:t,formStep:st.bankAccount}),this.isLoading=!1,e(s)}})}))}async refreshBankAccountData(){return new Promise((t=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.processBusinessResponse(t.data),this.determineViewMode(),this.initializeFormController()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1,t()}})}))}renderBankAccountInputs(t){const e=this.formController.getInitialValues();return s(this.country===D.CAN?"bank-account-form-inputs-canada":"bank-account-form-inputs",{defaultValue:e,errors:this.errors,inputHandler:this.inputHandler,formDisabled:t})}renderReadonlyView(){return s("div",null,this.renderBankAccountInputs(!0),s("div",{class:"mt-3"},s(ut,{variant:"secondary",type:"button",onClick:this.handleChangeBankAccount,disabled:this.isLoading,part:R},"Change Bank Account")))}renderPlaidView(){return s("div",{class:"mt-3"},s("plaid-verification",{authToken:this.authToken,accountId:this.platformAccountId,businessId:this.businessId,onPlaidVerificationSuccess:()=>{this.viewMode="readonly",this.refreshBankAccountData()}}),s("div",{class:"mt-3"},s(ut,{type:"button",variant:"link",className:"p-0",onClick:this.handleToggleToManualEntry,disabled:this.isLoading,part:F},"Enter bank details manually (document upload required)")))}renderManualEntryView(){return s("div",null,this.plaidAvailable&&s("div",{class:"mb-3"},s(ut,{type:"button",variant:"secondary",onClick:this.handleToggleToPlaidVerification,disabled:this.isLoading,part:R},"Link bank account with Plaid instead")),this.renderBankAccountInputs(!1),s("div",{class:"mt-3 d-flex gap-2"},this.showCancel&&s(ut,{variant:"secondary",type:"button",onClick:this.handleCancel,disabled:this.isLoading,part:R},"Cancel"),s(ut,{variant:"primary",type:"button",onClick:this.handleSaveBankAccount,disabled:this.isLoading,isLoading:this.isLoading},"Save Bank Account")))}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",{class:"mb-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Bank Account Info"),s("form-control-tooltip",{helpText:"This direct deposit account is the designated bank account where incoming funds will be deposited. The name of this account must match the registered business name exactly. We are not able to accept personal accounts unless your business is a registered sole proprietorship."})),s("hr",{class:"mt-2"}),"readonly"===this.viewMode&&this.renderReadonlyView(),"plaid"===this.viewMode&&this.renderPlaidView(),"manual"===this.viewMode&&this.renderManualEntryView()))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Dt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.coreInfo={},this.isLoading=!1,this.isEditingTaxId=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.coreInfo=new E(t.data),this.formController.setInitialValues(Object.assign({},this.coreInfo))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t(),this.isEditingTaxId=!1},onError:({error:t,code:s,severity:i,rawError:a})=>{e=t,a&&"object"==typeof a&&a.param&&this.formController.setFieldError(a.param,a.message),this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.businessInfo}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.errors[t]&&this.formController.clearFieldError(t),this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return new E(this.formController.values.getValue()).payload}componentWillLoad(){this.initializeApi();const t=this.country===D.CAN?_(this.allowOptionalFields):T(this.allowOptionalFields);this.formController=new x(t),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t,e;const i=this.formController.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Business Information")),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"legal_name",label:"Business Name",defaultValue:i.legal_name,errorText:this.errors.legal_name,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (don't use acronyms or abbreviations unless you registered that way)."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"doing_business_as",label:"Doing Business As (DBA)",defaultValue:i.doing_business_as,errorText:this.errors.doing_business_as,inputHandler:this.inputHandler,helpText:"Enter this exactly as it appears on your tax records (leave blank if you don't have a registered DBA/trade name)"})),s("div",{class:"col-12 col-md-8"},s("form-control-select",{name:"classification",label:"Business Classification",options:tt,defaultValue:i.classification,errorText:this.errors.classification,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-4"},s("form-control-date",{name:"date_of_incorporation",label:"Date of Registration",defaultValue:i.date_of_incorporation,errorText:this.errors.date_of_incorporation,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"industry",label:"Industry",defaultValue:i.industry,errorText:this.errors.industry,inputHandler:this.inputHandler,helpText:"Describe what you sell"})),s("div",{class:"col-12 col-md-6"},!(null===(t=this.coreInfo)||void 0===t?void 0:t.tax_id_last4)||this.isEditingTaxId?s("form-control-number-masked",{name:"tax_id",label:mt[this.country].taxIdLabelOptional||mt[this.country].taxIdLabel,defaultValue:this.isEditingTaxId?"":i.tax_id,errorText:this.errors.tax_id,inputHandler:this.inputHandler,mask:"000000000",helpText:mt[this.country].taxIdHelpText}):s("div",null,s("label",{class:"form-label",part:W},mt[this.country].taxIdLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(e=this.coreInfo)||void 0===e?void 0:e.tax_id_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingTaxId=!0,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{tax_id:"",tax_id_last4:null}))}},"Change")))),s("div",{class:"col-12"},s("form-control-text",{name:"website_url",label:"Business Website URL",defaultValue:i.website_url,errorText:this.errors.website_url,inputHandler:this.inputHandler,helpText:"Don't have a live website? You can use your social media business page, app store link, or staging site URL."})),s("div",{class:"col-12 col-md-6"},s("form-control-text",{name:"email",label:"Business Email Address",defaultValue:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{class:"col-12 col-md-6"},s("form-control-number-masked",{name:"phone",label:"Business Phone Number",defaultValue:i.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:B.US})))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Et=class{constructor(e){t(this,e),this.documents=[],this.isLoading=!1}render(){return this.isLoading?s(vt,{height:"50px"}):this.documents.length?s(i,null,s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Documents Already on File"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"File Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Date Uploaded"))),s("tbody",null,this.documents.sort(((t,e)=>t.document_type.localeCompare(e.document_type))).map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:Y},t.file_name),s("td",{part:Y},t.file_type),s("td",{part:Y},bt(t.document_type)),s("td",{part:Y},`${pt(t.created_at)} - ${ft(t.created_at)}`))))))))),s("hr",null)):null}},It=class{constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownersPayload=[],this.refs=[],this.isLoading=!1,this.representativeIsOwner=null,this.matchRef=(t,e)=>{if(null===t)return;const s=this.ownersPayload.findIndex((t=>t.id===e));-1!==s&&(this.refs.length!==this.ownersPayload.length&&this.manageRefs(),this.refs[s]=t)},this.getData=()=>{this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),t.data.owners.length?this.ownersPayload=t.data.owners.map((t=>({id:t.id}))):this.addOwnerForm()},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1,this.manageRefs()}})},this.sendData=async t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:{owners:this.ownersPayload},onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.owners}),this.formLoading.emit(!1)}})},this.addOwnerForm=t=>{this.newFormOpen=!0,this.ownersPayload=[...this.ownersPayload,{id:""}],t&&this.clickEvent.emit({name:it.addOwnerForm})},this.removeOwnerForm=t=>{this.ownersPayload=this.ownersPayload.filter((e=>e.id!==t)),this.newFormOpen&&(this.newFormOpen=!1)},this.handleRepresentativeIsOwnerChange=t=>{this.representativeIsOwner=t,this.representativeIsOwner&&(this.formLoading.emit(!0),this.isLoading=!0,this.ownersPayload=this.ownersPayload.filter((t=>""!==t.id)),this.patchBusiness({payload:{representative:{is_owner:!0},owners:[{id:this.representative.id},...this.ownersPayload]},onSuccess:()=>{this.getData(),this.newFormOpen=!1},finally:()=>{this.isLoading=!1,this.formLoading.emit(!1)}}))}}propChanged(){this.initializeApi()}get showAddOwnerButton(){return this.ownersPayload.length<4&&!this.newFormOpen}manageRefs(){this.refs=this.ownersPayload.map((t=>t.id))}async validateAndSubmit({onSuccess:t}){const e=this.refs.map((t=>t.validate()));if(!(await Promise.all(e)).every((t=>t)))return;if(!this.allowOptionalFields&&100!==(await Promise.all(this.refs.map((t=>t.getOwnershipPercentage())))).reduce(((t,e)=>t+(parseFloat(e)||0)),0))return void await Promise.all(this.refs.map((t=>t.setOwnershipPercentageError("Ownership percentages must total 100%"))));const s=this.refs.map((t=>t.submit()));(await Promise.all(s)).every((t=>t))&&this.sendData(t)}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}ownersWatcher(){this.manageRefs()}handleOwnerSubmit(t){const e=t.detail,s=this.ownersPayload.map((t=>t.id===e.id?e:t));s.includes(e)||(s[this.ownersPayload.findIndex((t=>!t.id))]=e,this.newFormOpen&&(this.newFormOpen=!1)),this.ownersPayload=s}render(){if(this.isLoading)return s(i,null,s(X,null));const t=this.ownersPayload.some((t=>t.id===this.representative.id)),e=null===this.representativeIsOwner&&!t;return s(i,null,s("div",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Owners"),s("form-control-tooltip",{helpText:"For partnerships, LLCs or privately held corporations, the business is required to apply with all individuals with 25% or more ownership to the application. For charities and registered non-profits, the business is required to apply with 1 individual with substantial control over the entity, such as a board member or director."})),s("hr",{class:"mt-2"}),e&&s("div",{class:"alert alert-warning mb-3",part:G},s("div",{class:"card-body"},s("div",{class:"d-flex align-items-center mb-3"},s("strong",null,"Is the representative of this business also an owner?")),s("div",{class:"d-flex gap-2"},s(ut,{variant:"primary",onClick:()=>this.handleRepresentativeIsOwnerChange(!0)},"Yes"),s(ut,{variant:"secondary",onClick:()=>this.handleRepresentativeIsOwnerChange(!1)},"No")))),s("div",{class:"row gy-3"},this.ownersPayload.map((t=>s("owner-form",{key:t.id,authToken:this.authToken,businessId:this.businessId,ownerId:t.id,removeOwner:this.removeOwnerForm,newFormOpen:this.newFormOpen,ownersLength:this.ownersPayload.length,country:this.country,allowOptionalFields:this.allowOptionalFields,ref:e=>this.matchRef(e,t.id)})))),s("div",{class:"d-flex justify-content-start"},s("div",{class:"gap-2"},s(ut,{variant:"primary",onClick:()=>this.addOwnerForm(!0),hidden:!this.showAddOwnerButton},"Add Owner")))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],ownersPayload:["ownersWatcher"]}}},Vt=class{constructor(e){t(this,e),this.isEditingIdentification=!1,this.inputHandler=(t,e)=>{yt(this.formController,{[t]:e})},this.onAddressFormUpdate=t=>{gt(this.formController,Object.assign(Object.assign({},this.formController.values.getValue().address),t))}}render(){var t,e,i,a,r,n,o,l,h;return s("form",{key:"2346f250e4e2982b5b5b2624d039f551b5b5ed4e"},s("fieldset",{key:"7b496e6157e5eec02ef0d263c68fbd1e001c75ac"},s("div",{key:"b86d993c7fbee2269e48c7d4ea51826f199fecd4",class:"d-flex align-items-center gap-2"},s("legend",{key:"2b013e6068bbbca54a0852093ab4a2fae4ce64d2",class:"mb-0",part:M},"Representative"),s("form-control-tooltip",{key:"01e0f1d6ba2d5ee852593f7015a3ba7e0d980df9",helpText:"The representative for your business needs to be someone who has significant control over managing your business's finance. You will have an opportunity to add owners later in the form."})),s("hr",{key:"4bec34756ec7081e01809175bc3d2b6af0532537",class:"mt-2"}),s("div",{key:"6965720fabb1f12c6bb3c5a81f74ae12f44037b2",class:"row gy-3"},s("div",{key:"efbb768ba1e66d5ef47f792c39a17921b40e0eba",class:"col-12 col-md-8"},s("form-control-text",{key:"28477d3798ba7d14aee9201e84b276d8e85a21df",name:"name",label:"Full Name",defaultValue:null===(t=this.representativeDefaultValue)||void 0===t?void 0:t.name,errorText:this.errors.name,inputHandler:this.inputHandler})),s("div",{key:"28f17ccbe4da476256acd9c5a4e78a6a641ba6e9",class:"col-12 col-md-4"},s("form-control-select",{key:"dae6a93a0bc057abb97024277be0f10de01514e2",name:"title",label:"Title",options:et,defaultValue:null===(e=this.representativeDefaultValue)||void 0===e?void 0:e.title,errorText:this.errors.title,inputHandler:this.inputHandler})),s("div",{key:"2f9a45774adaa0040df2da1a8000d1ee61e16bf5",class:"col-12 col-md-6"},s("form-control-text",{key:"66a2a1ea8b54c03c012d76a74654ee19a9f958a7",name:"email",label:"Email Address",defaultValue:null===(i=this.representativeDefaultValue)||void 0===i?void 0:i.email,errorText:this.errors.email,inputHandler:this.inputHandler})),s("div",{key:"3b34f0cb11d358db2220c01aac90e8b7ba3cc01b",class:"col-12 col-md-6"},s("form-control-number-masked",{key:"52c62ec653fb917a248a302f7cb5ad46dc7bcc23",name:"phone",label:"Phone Number",defaultValue:null===(a=this.representativeDefaultValue)||void 0===a?void 0:a.phone,errorText:this.errors.phone,inputHandler:this.inputHandler,mask:B.US})),s("div",{key:"d287ec225af1541cca227d3b8bc54466cbb86b07",class:"col-12 col-md-4"},s("form-control-date",{key:"7e1ff6cc40b01dc7f6ad0ad84d73c0e59eea0d6f",name:"dob_full",label:"Birth Date",defaultValue:null===(r=this.representativeDefaultValue)||void 0===r?void 0:r.dob_full,errorText:this.errors.dob_full,inputHandler:this.inputHandler,onFormControlInput:t=>kt(t,this.formController),helpText:"Must be 18 or older."})),s("div",{key:"283b09c845f1a12f4974f82a26fffbf7c5f608ba",class:"col-12 col-md-8"},!(null===(n=this.representativeDefaultValue)||void 0===n?void 0:n.ssn_last4)||this.isEditingIdentification?s("form-control-number-masked",{name:"identification_number",label:this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel,defaultValue:this.isEditingIdentification?"":null===(o=this.representativeDefaultValue)||void 0===o?void 0:o.identification_number,errorText:this.errors.identification_number,inputHandler:this.inputHandler,mask:N[this.country],helpText:mt[this.country].identityHelpText}):s("div",null,s("label",{class:"form-label",part:W},this.country===D.CAN?mt[this.country].idNumberLabelOptional:mt[this.country].idNumberLabel),s("div",{class:"input-group mb-3"},s("input",{type:"text",class:"form-control",part:q,value:`****${null===(l=this.representativeDefaultValue)||void 0===l?void 0:l.ssn_last4}`,disabled:!0}),s("button",{class:"btn btn-secondary",type:"button",part:R,onClick:()=>{this.isEditingIdentification=!0,yt(this.formController,{identification_number:"",ssn_last4:null})}},"Change")))),s("div",{key:"0a40679570df7b85faa7530797ebc21ca8794263",class:"col-12"},s("identity-address-form",{key:"5a1590251365260413ab63ce9a417d3d71c71e84",errors:this.errors.address,defaultValues:null===(h=this.representativeDefaultValue)||void 0===h?void 0:h.address,handleFormUpdate:this.onAddressFormUpdate,country:this.country})))))}},Ht=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.representative={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&this.formController&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{this.representative=new I(t.data.representative||{}),this.representative.address.country=this.country,this.formController.setInitialValues(Object.assign({},this.representative))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.representative}),this.formLoading.emit(!1)}})}}propChanged(){this.initializeApi(),this.getData()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}componentWillLoad(){this.initializeApi(),this.initializeForm()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}initializeForm(){const t=C[this.country];t?(this.formController=new x(t("representative",this.allowOptionalFields)),this.getData()):this.errorEvent.emit({message:"Missing schema for selected country",errorCode:r.MISSING_PROPS,severity:a.ERROR})}componentDidLoad(){this.formController&&this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get patchPayload(){return{representative:new I(this.formController.values.getValue()).payload}}render(){return!this.formController||this.isLoading?s(X,null):s("business-representative-form-inputs",{representativeDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Pt=class{constructor(s){t(this,s),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.formCompleted=e(this,"formCompleted",7),this.errors={},this.fetchData=async()=>{this.formLoading.emit(!0);try{const t=await this.api.get({endpoint:this.businessEndpoint,authToken:this.authToken});this.acceptedTermsBefore=t.data.terms_conditions_accepted}catch(t){this.errorEvent.emit({errorCode:r.FETCH_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.sendData=async t=>{this.formLoading.emit(!0);try{const e=this.termsPayload,s=await this.api.post({endpoint:this.termsConditionsEndpoint,body:e,authToken:this.authToken});this.handleResponse(s,t)}catch(t){this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.message,severity:a.ERROR,data:t})}finally{this.formLoading.emit(!1)}},this.inputHandler=(t,e)=>{this.acceptedTerms=e,this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}get businessEndpoint(){return`entities/business/${this.businessId}`}get termsConditionsEndpoint(){return"entities/terms_and_conditions"}get formHelperText(){return this.acceptedTermsBefore?"You have already accepted the terms and conditions.":null}get termsPayload(){return{business_id:this.businessId,accepted:this.formController.values.getValue().accepted,user_agent:window.navigator.userAgent}}async componentWillLoad(){this.api=wt(),this.formController=new x((t=>{const e=O({accepted:j().oneOf([!0],"You must agree to the terms and conditions to continue").required("You must agree to the terms and conditions to continue")}),s=O({accepted:j().nullable()});return t?s:e})(this.allowOptionalFields)),this.businessId&&this.authToken&&this.fetchData()}handleResponse(t,e){t.error?this.errorEvent.emit({errorCode:r.POST_ERROR,message:t.error.message,severity:a.ERROR,data:t.error}):e(),this.stepCompleteEvent.emit({response:t,formStep:st.termsAndConditions}),this.formCompleted.emit()}async validateAndSubmit({onSuccess:t}){this.acceptedTermsBefore?(this.stepCompleteEvent.emit({response:null,formStep:st.termsAndConditions,metadata:"no data submitted"}),this.formCompleted.emit(),t()):this.formController.validateAndSubmit((()=>this.sendData(t)))}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}get merchantAgreementLink(){return s("a",{href:"https://justifi.tech/merchant-agreement/",target:"_blank",rel:"noopener noreferrer"},"merchant agreement")}render(){return s("form",{key:"24b0a8ff0187894cf5e0f56e9e4b28c378e720cb"},s("fieldset",{key:"26fa9159dd6d61edd28b9443a10eeb981f150308"},s("legend",{key:"103bdecbc51f2cccd9105e2f9b271b60760618ec",part:M},"Terms and Conditions"),s("hr",{key:"dfd29fbe609a57d8160df7980ed0e63e75934a86"}),s("div",{key:"61e06597ec652c1d7c6e7e2bd8c9b653d061d076"},s("p",{key:"cd4def71580cd14d6edb5887221ebf6aa80cc2ea"},"Please read and accept the ",this.merchantAgreementLink," to submit your provisioning request.")),s("br",{key:"e3c64733f11a4f702e686e6c5ae7acd7e6bd1c34"}),s("div",{key:"71bd74de3aee69805a2aa1297356ff8b8db3c76c",class:"row-gy-3"},s("div",{key:"94a28c13e3bbc1c89cd1b5ebde2e1732b48f99ea",class:"col-12"},s("form-control-checkbox",{key:"fee95fa42192fee1bbfd544307b4e1c11c0d97f4",name:"accepted",label:"I agree to the terms and conditions",inputHandler:this.inputHandler,errorText:this.errors.accepted,disabled:this.acceptedTermsBefore,helpText:this.formHelperText,checked:this.acceptedTerms})))))}},Bt=[{label:"Select a document type",value:""},{label:"Voided Check",value:"voided_check"},{label:"Bank Statement",value:"bank_statement"}],Nt=[{label:"Select a document type",value:""},{label:"Canadian Passport",value:"passport"},{label:"Canadian Driver's License",value:"driver_license"},{label:"Canadian Government Issued ID Card",value:"government_id"},{label:"Permanent Resident Card",value:"resident_card"},{label:"Certificate of Indian Status",value:"status_card"},{label:"US State Issued Driver's License",value:"driver_license"}],Mt=[{label:"Select a document type",value:""},{label:"Nexus Card (Photo ID)",value:"nexus_card"},{label:"Canadian Citizenship/Naturalization Card or Certificate",value:"citizenship_card"},{label:"Foreign Passport",value:"foreign_passport"},{label:"Canadian Birth Certificate",value:"birth_certificate"},{label:"Social Insurance Number (SIN) Card",value:"sin_card"},{label:"Social Security Number (SSN) Card",value:"ssn_card"}],Rt=[{label:"Business Document",value:"business_document",docTypeOptions:[{label:"Select a document type",value:""},{label:"Articles of Incorporation",value:"articles_of_incorporation"},{label:"Business Registration",value:"business_registration"}]},{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}],Ft=[{label:"Financial Document",value:"financial_document",docTypeOptions:Bt}],Wt=new Set(Nt.filter((t=>t.value)).map((t=>t.value))),qt=new Set(Mt.filter((t=>t.value)).map((t=>t.value))),zt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.owners=[],this.existingDocuments=[],this.selectedCategory="",this.selectedDocType="",this.uploadQueue=[],this.isLoading=!1,this.errors={},this.fileInputKey=0,this.categories=[],this.getData=()=>{this.isLoading=!0,this.getBusiness({onSuccess:t=>{const{owners:e,documents:s}=t.data;this.owners=e||[],this.existingDocuments=s||[],this.categories=this.country===D.USA?Ft:[...Rt,{label:"Identity Document - Group 1",value:"personal_group1",docTypeOptions:Nt},{label:"Identity Document - Group 2",value:"personal_group2",docTypeOptions:Mt}]},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.isLoading=!1}})},this.handleCategoryChange=(t,e)=>{this.selectedCategory=e,this.selectedDocType=""},this.handleDocTypeChange=(t,e)=>{e.startsWith("_")&&e.endsWith("_header")||(this.selectedDocType=e)},this.handleFileSelected=async t=>{const e=Array.from(t.detail.fileList),s=this.categories.find((t=>t.value===this.selectedCategory));if(!s)return;const i=s.docTypeOptions.find((t=>t.value===this.selectedDocType)),a=(null==i?void 0:i.label)||this.selectedDocType,r=e.map((t=>({categoryLabel:s.label,categoryValue:s.value,docTypeLabel:a,docTypeValue:this.selectedDocType,fileName:t.name,file:t,status:"uploading"}))),o=this.uploadQueue.length;this.uploadQueue=[...this.uploadQueue,...r],this.selectedCategory="",this.selectedDocType="",this.fileInputKey++,await Promise.all(r.map((async(t,e)=>{const s=o+e;try{const e=new n({file:t.file,document_type:t.docTypeValue},this.businessId);if(!await this.postDocumentRecordData(e))return void(this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t)));const i=await this.uploadDocument(e);this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:i?"uploaded":"error"}):t))}catch(t){this.uploadQueue=this.uploadQueue.map(((t,e)=>e===s?Object.assign(Object.assign({},t),{status:"error"}):t))}})))},this.postDocumentRecordData=async t=>{const e=t.record_data;return new Promise((s=>{this.postDocumentRecord({payload:e,onSuccess:e=>{s(this.handleDocRecordResponse(t,e))},onError:({error:t,code:e,severity:i})=>{this.errorEvent.emit({message:t,errorCode:e,severity:i}),s(!1)}})}))},this.handleDocRecordResponse=(t,e)=>e.error?(this.errorEvent.emit({errorCode:r.POST_ERROR,message:e.error.message,severity:a.ERROR,data:e.error}),!1):(t.setPresignedUrl(e.data.presigned_url),!0),this.uploadDocument=async t=>{if(!t.presigned_url)throw new Error("Presigned URL is not set");const e=await t.getFileData();return!!(await fetch(t.presigned_url,{method:"PUT",body:e})).ok||(this.errorEvent.emit({errorCode:r.POST_ERROR,message:"Failed to upload document",severity:a.ERROR}),!1)}}propChanged(){this.initializeApi()}watchHandler(t){this.formLoading.emit(t)}async validateAndSubmit({onSuccess:t}){const e=this.validate();Object.keys(e).length>0?this.errors=e:(this.errors={},this.stepCompleteEvent.emit({response:null,formStep:st.documentUpload}),t())}componentWillLoad(){this.initializeApi(),this.getBusiness&&this.getData()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.postDocumentRecord=m({authToken:this.authToken,service:new g})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}get categoryOptions(){return[{label:"Select a category",value:""},...this.categories.map((t=>({label:t.label,value:t.value})))]}get docTypeOptions(){if(!this.selectedCategory)return[{label:"Select a category first",value:""}];const t=this.categories.find((t=>t.value===this.selectedCategory));return(null==t?void 0:t.docTypeOptions)||[{label:"Select a category first",value:""}]}validate(){if(this.allowOptionalFields)return{};const t={},e=t=>this.existingDocuments.some((e=>t.includes(e.document_type))),s=t=>this.uploadQueue.some((e=>e.categoryValue===t&&"uploaded"===e.status));if(s("financial_document")||e(["voided_check","bank_statement"])||(t.financial_document="Please upload a financial document"),this.country===D.CAN){const i=["articles_of_incorporation","business_registration"];s("business_document")||e(i)||(t.business_document="Please upload a business document");const a=this.owners.length,r=this.uploadQueue.filter((t=>"personal_group1"===t.categoryValue&&"uploaded"===t.status)).length,n=this.existingDocuments.filter((t=>Wt.has(t.document_type))).length;r+n<a&&(t.personal_group1=`Please upload ${a} Group 1 identity document(s) (${r+n} of ${a} provided)`);const o=this.uploadQueue.filter((t=>"personal_group2"===t.categoryValue&&"uploaded"===t.status)).length,l=this.existingDocuments.filter((t=>qt.has(t.document_type))).length;o+l<a&&(t.personal_group2=`Please upload ${a} Group 2 identity document(s) (${o+l} of ${a} provided)`)}return t}render(){return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("legend",{class:"mb-0",part:M},"Document Uploads"),s("hr",{class:"mt-2"}),s("business-documents-on-file",{documents:this.existingDocuments,isLoading:this.isLoading})),this.country===D.CAN&&this.owners.length>0&&s("div",{class:"alert alert-info mt-3"},"One document from each group (Group 1 and Group 2) is required for each owner (",this.owners.length," owner(s))."),s("fieldset",{class:"mt-4"},s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Add Document"),s("form-control-tooltip",{helpText:"Upload documents one at a time. Select the category and type, then choose a file. For Canadian businesses, one Group 1 and one Group 2 identity document is required for each owner."})),s("hr",{class:"mt-2"}),s("div",{class:"row gy-3"},s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_category",label:"Document Category",options:this.categoryOptions,defaultValue:this.selectedCategory,inputHandler:this.handleCategoryChange})),s("div",{class:"col-12 col-md-6"},s("form-control-select",{name:"document_type",label:"Document Type",options:this.docTypeOptions,defaultValue:this.selectedDocType,inputHandler:this.handleDocTypeChange,disabled:!this.selectedCategory})),s("div",{class:"col-12"},s("form-control-file",{key:this.fileInputKey,name:"document_file",label:"Upload Document",documentType:this.selectedDocType,onFileSelected:this.handleFileSelected,disabled:!this.selectedDocType,multiple:!1})))),s("document-upload-list",{documents:this.uploadQueue}),Object.keys(this.errors).length>0&&s("div",{class:"alert alert-danger mt-3"},s("ul",{class:"mb-0"},Object.values(this.errors).map((t=>s("li",null,t))))))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"],isLoading:["watchHandler"]}}},Ut=class{constructor(e){t(this,e),this.documents=[]}renderStatus(t){switch(t){case"uploading":return s("span",{class:"badge bg-info"},"Uploading...");case"uploaded":return s("span",{class:"badge bg-success"},"Uploaded");case"error":return s("span",{class:"badge bg-danger"},"Error")}}render(){return this.documents.length?s("div",{class:"mt-4"},s("div",{class:"card",part:z},s("div",{class:"card-body"},s("h5",{class:"card-title",part:M},"Uploaded Documents"),s("div",{class:"table-responsive"},s("table",{class:"table table-sm table-borderless",part:U},s("thead",null,s("tr",null,s("th",{style:{width:"25%"},part:Z,scope:"col"},"Category"),s("th",{style:{width:"25%"},part:Z,scope:"col"},"Document Type"),s("th",{style:{width:"30%"},part:Z,scope:"col"},"File Name"),s("th",{style:{width:"20%"},part:Z,scope:"col"},"Status"))),s("tbody",null,this.documents.map(((t,e)=>s("tr",{class:0===e?"border-bottom border-top":"border-bottom"},s("td",{part:Y},t.categoryLabel),s("td",{part:Y},t.docTypeLabel),s("td",{part:Y},t.fileName),s("td",{part:Y},this.renderStatus(t.status))))))))))):null}},Zt=class{constructor(s){t(this,s),this.errorEvent=e(this,"error-event",7),this.stepCompleteEvent=e(this,"complete-form-step-event",7),this.formLoading=e(this,"formLoading",7),this.errors={},this.legal_address={},this.isLoading=!1,this.getData=()=>{this.getBusiness&&(this.formLoading.emit(!0),this.isLoading=!0,this.getBusiness({onSuccess:t=>{const e=new V((t.data||{}).legal_address||{});this.legal_address=Object.assign(Object.assign({},e),{country:this.country}),this.formController.setInitialValues(Object.assign({},this.legal_address))},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>{this.formLoading.emit(!1),this.isLoading=!1}}))},this.sendData=t=>{let e;this.formLoading.emit(!0),this.patchBusiness({payload:this.patchPayload,onSuccess:s=>{e=s,t()},onError:({error:t,code:s,severity:i})=>{e=t,this.errorEvent.emit({message:t,errorCode:s,severity:i})},final:()=>{this.stepCompleteEvent.emit({response:e,formStep:st.legalAddress}),this.formLoading.emit(!1)}})},this.inputHandler=(t,e)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:e}))}}propChanged(){this.initializeApi()}async validateAndSubmit({onSuccess:t}){this.formController.validateAndSubmit((()=>this.sendData(t)))}get patchPayload(){return{legal_address:new V(this.formController.values.getValue()).payload}}componentWillLoad(){this.initializeApi(),this.formController=new x((0,L[this.country])(this.allowOptionalFields)),this.getData()}componentDidLoad(){this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=c({authToken:this.authToken,businessId:this.businessId,service:new v}),this.patchBusiness=d({authToken:this.authToken,businessId:this.businessId,service:new v})):this.errorEvent.emit({message:"Missing required props",errorCode:r.MISSING_PROPS,severity:a.ERROR})}render(){var t;const e=null===(t=this.formController)||void 0===t?void 0:t.getInitialValues();return this.isLoading?s(X,null):s("form",null,s("fieldset",null,s("div",{class:"d-flex align-items-center gap-2"},s("legend",{class:"mb-0",part:M},"Legal Address of your Business"),s("form-control-tooltip",{helpText:"No PO Boxes."})),s("hr",{class:"mt-2"}),s("form-address-fields",{country:this.country,errors:this.errors,defaultValues:e,inputHandler:this.inputHandler})))}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}},Yt=class{loadingWatcher(){this.formLoading.emit(this.isLoading)}constructor(s){t(this,s),this.clickEvent=e(this,"click-event",7),this.errorEvent=e(this,"error-event",7),this.formLoading=e(this,"formLoading",7),this.ownerSubmitted=e(this,"ownerSubmitted",7),this.isLoading=!1,this.errors={},this.owner={},this.getData=()=>{this.getOwner&&(this.isLoading=!0,this.getOwner({onSuccess:t=>{this.instantiateOwner(t.data)},onError:({error:t,code:e,severity:s})=>{this.errorEvent.emit({message:t,errorCode:e,severity:s})},final:()=>this.isLoading=!1}))},this.sendData=()=>(this.isLoading=!0,new Promise((t=>{this.ownerId?this.patchOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1}):this.postOwner({payload:this.payload,onSuccess:e=>{this.ownerSubmitted.emit({id:e.data.id}),this.instantiateOwner(e.data),t(!0)},onError:({error:e,code:s,severity:i})=>{this.errorEvent.emit({message:e,errorCode:s,severity:i}),t(!1)},final:()=>this.isLoading=!1})}))),this.instantiateOwner=async t=>{this.owner=Object.assign({},new H(t)),await this.formController.setInitialValues(this.owner)},this.handleAddOwner=()=>{this.clickEvent.emit({name:this.ownerId?it.updateOwner:it.addOwner})},this.handleRemoveOwner=()=>{this.removeOwner(this.ownerId),this.clickEvent.emit({name:it.removeOwner})},this.validate=this.validate.bind(this),this.submit=this.submit.bind(this),this.validateAndSubmit=this.validateAndSubmit.bind(this)}async returnOwnerData(){return this.ownerId}async getOwnershipPercentage(){var t;return(null===(t=this.formController.values.getValue())||void 0===t?void 0:t.ownership_percentage)||null}async setOwnershipPercentageError(t){this.formController.setFieldError("ownership_percentage",t)}async validate(){return this.formController.validate()}async submit(){if(await this.validate())return this.sendData()}async validateAndSubmit(t){t.preventDefault(),await this.validate()&&this.submit()}get payload(){const t=new H(this.formController.values.getValue()).payload;return this.ownerId?t:Object.assign(Object.assign({},t),{business_id:this.businessId})}get formTitle(){return this.ownerId?"Edit Business Owner":"Add Business Owner"}get submitButtonText(){return this.ownerId?"Update":"Add"}get showRemoveButton(){return!(this.ownersLength<=1)&&(!(this.ownerId||!this.newFormOpen)||!(!this.ownerId||this.newFormOpen)||void 0)}componentWillLoad(){this.formController=new x((0,C[this.country])("owner",this.allowOptionalFields)),this.initializeApi(),this.ownerId&&this.getOwner?this.getData():this.instantiateOwner({})}componentDidLoad(){this.formController.errors.subscribe((t=>this.errors=Object.assign({},t)))}initializeApi(){this.authToken&&(this.getOwner=b({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.patchOwner=p({authToken:this.authToken,identityId:this.ownerId,service:new k}),this.postOwner=f({authToken:this.authToken,service:new k}))}render(){return s(i,{key:"b168e9f5a52416984e6a04ab5f0771b63ee28b2e",style:{display:"block"}},s("form",{key:"d22a6aae3f5debd30d87b3bd37c67390a46c4590",onSubmit:this.validateAndSubmit},s("fieldset",{key:"30597bc1f4983bddbdc0ed45e6be7e715d0b9b8e"},s("legend",{key:"055ca2b6bbfa4e86591411668eaead3bd0d95ea8",class:"fw-semibold fs-5 w-100",part:$},this.formTitle),s("br",{key:"f0d2d9624611ee888ff318ec1525281bf007e346"}),s("div",{key:"2c38a166f681404c2ab303630217e54c15f1e5f2",class:"row gy-3"},s("owner-form-inputs",{key:"05253624d3d79f0ba7a4ec49b387e252e796e5b6",ownerDefaultValue:this.formController.getInitialValues(),errors:this.errors,formController:this.formController,country:this.country}),s("div",{key:"8e0e67966f047c3f9a4b30f28983f67db2372c0c",class:"d-flex gap-2 justify-content-start"},s(ut,{key:"e33368a968efe5faf52a08e36bb2bef215625c4a",variant:"secondary",type:"button",onClick:this.handleRemoveOwner,hidden:!this.showRemoveButton},"Remove"),s(ut,{key:"7bb79b0624dfb3a8645182432c484f288cc73692",variant:"primary",type:"submit",onClick:this.handleAddOwner,disabled:this.isLoading},this.submitButtonText))),s("hr",{key:"ef4f86dd1b1878e92c98e4a826f9fbad808e15b7"}))))}static get watchers(){return{isLoading:["loadingWatcher"]}}},Gt=class{constructor(s){t(this,s),this.plaidVerificationSuccess=e(this,"plaidVerificationSuccess",7),this.plaidVerificationError=e(this,"plaidVerificationError",7),this.linkToken=null,this.linkTokenId=null,this.plaidLink=null,this.isAuthenticating=!1,this.isSuccess=!1,this.error=null,this.isLoading=!1,this.plaidService=new Tt,this.abortController=null,this.timeoutId=null,this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:l[h.PLAID_LINK_TOKEN_FAILED],severity:o[h.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:h.PLAID_LINK_INIT_FAILED,message:l[h.PLAID_LINK_INIT_FAILED],severity:o[h.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,s,i;try{if(!this.authToken||!this.accountId)return void this.handleError({code:h.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please provide authToken and accountId.",severity:a.ERROR,retryable:!1,userAction:"Provide required props"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const t=await this.plaidService.getLinkTokenForVerification(this.authToken,this.businessId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),t.error)throw new Error("string"==typeof t.error?t.error:t.error.message||"Failed to get link token");this.linkToken=t.data.link_token,this.linkTokenId=t.data.id}catch(a){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let r=h.PLAID_LINK_TOKEN_FAILED,n=l[r],c=!0;"AbortError"===a.name?(r=h.PLAID_TIMEOUT,n=l[r],c=!0):(null===(t=a.message)||void 0===t?void 0:t.includes("network"))||(null===(e=a.message)||void 0===e?void 0:e.includes("fetch"))?(r=h.PLAID_NETWORK_ERROR,n=l[r],c=!0):((null===(s=a.message)||void 0===s?void 0:s.includes("401"))||(null===(i=a.message)||void 0===i?void 0:i.includes("unauthorized")))&&(r=h.PLAID_INVALID_CREDENTIALS,n="Authentication failed. Please check your credentials.",c=!1),this.handleError({code:r,message:n,severity:o[r],originalError:a,retryable:c,userAction:c?"Click to try again":"Check your credentials"})}},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=async t=>{var e;this.isAuthenticating=!1,this.isLoading=!0,this.clearError();try{const s=await this.plaidService.postPlaidVerifiedBankAccountData(this.authToken,this.businessId,{public_token:t,link_token_id:this.linkTokenId},null===(e=this.abortController)||void 0===e?void 0:e.signal);if(s.error)throw new Error("string"==typeof s.error?s.error:s.error.message||"Failed to verify bank account");this.isSuccess=!0,this.isLoading=!1,this.plaidVerificationSuccess.emit({publicToken:t,bankAccount:s.data})}catch(t){this.isLoading=!1,this.handleError({code:h.PLAID_AUTHENTICATION_FAILED,message:(null==t?void 0:t.message)||"Failed to verify bank account",severity:o[h.PLAID_AUTHENTICATION_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=h.PLAID_AUTHENTICATION_FAILED,s=l[e],i=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=h.PLAID_INVALID_CREDENTIALS,s=l[e],i=!0;break;case"ITEM_LOGIN_REQUIRED":e=h.PLAID_INVALID_CREDENTIALS,s="Your bank requires re-authentication. Please try again.",i=!0;break;case"ITEM_LOCKED":e=h.PLAID_ACCOUNT_LOCKED,s=l[e],i=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=h.PLAID_MAINTENANCE,s=l[e],i=!0;break;case"RATE_LIMIT_EXCEEDED":e=h.PLAID_RATE_LIMITED,s=l[e],i=!0;break;default:t.error_message&&(s=t.error_message)}this.handleError({code:e,message:s,severity:o[e],originalError:t,retryable:i,userAction:a}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.isLoading=!1,this.plaidVerificationError.emit(t),console.error("Plaid verification error:",t)},this.clearError=()=>{this.error&&(this.error=null)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.initializePlaidLink()},this.scriptRef.onerror=()=>{this.handleError({code:h.PLAID_SDK_LOAD_FAILED,message:l[h.PLAID_SDK_LOAD_FAILED],severity:o[h.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}disconnectedCallback(){this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){const t=s("svg",{class:"plaid-logo-img",height:"20",width:"20",viewBox:"0 0 28 29",xmlns:"http://www.w3.org/2000/svg",style:{display:"inline",marginLeft:"5px",marginRight:"5px",marginTop:"-2px"}},s("g",{fill:"#fff","fill-rule":"evenodd"},s("path",{d:"M25.7629 26.2628L28 17.5309L24.9691 14.5001L27.9999 11.4691L25.7628 2.73706L17.0309 0.5L14.0001 3.531L10.969 0.50014L2.23706 2.73734L0 11.4691L3.03128 14.4999L0.00014 17.531L2.2372 26.2629L10.9691 28.5L14.0001 25.469L17.031 28.4999L25.7629 26.2628ZM15.7321 23.7371L18.6186 20.8505L22.2912 24.5233L17.6956 25.7007L15.7321 23.7371ZM11.1136 9.88154L14.0003 6.99502L16.8868 9.8814L14.0001 12.7679L11.1136 9.88154ZM12.2682 14.5L9.38154 17.3865L6.49502 14.5L9.38154 11.6135L12.2682 14.5ZM18.6187 11.6133L21.5053 14.5L18.6186 17.3865L15.7321 14.5L18.6187 11.6133ZM16.8867 19.1186L14.0001 22.0051L11.1135 19.1185L14.0001 16.2319L16.8867 19.1186ZM10.3044 25.7007L5.70864 24.5233L9.38154 20.8504L12.2682 23.7371L10.3044 25.7007ZM4.76308 16.2319L7.6496 19.1185L3.9767 22.7914L2.7993 18.1957L4.76308 16.2319ZM3.9767 6.20836L7.64974 9.8814L4.76308 12.7681L2.7993 10.8041L3.9767 6.20836ZM12.2683 5.26294L9.38168 8.1496L5.70892 4.4767L10.3047 3.2993L12.2683 5.26294ZM17.6959 3.2993L22.2915 4.4767L18.6186 8.14946L15.7321 5.26294L17.6959 3.2993ZM23.2372 12.7681L20.3505 9.8814L24.0233 6.20878L25.2007 10.8046L23.2372 12.7681ZM24.0233 22.7914L20.3505 19.1186L23.2372 16.2321L25.2007 18.1957L24.0233 22.7914Z"})));return s(_t,null,s("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),s("div",null,s("div",{class:"mb-3"},s(ut,{variant:"primary",type:"button",onClick:t=>{t.preventDefault(),this.openPlaidLink()},disabled:this.isLoading,part:Q},"Connect with Plaid ",t," (instant verification)")),(()=>this.error?s("div",{class:(this.error.severity===a.ERROR?"text-danger":this.error.severity===a.WARNING?"text-warning":"text-info")+" mt-2"},s("small",null,this.error.message),s("br",null),this.error.userAction&&s("small",{class:"text-muted"},this.error.userAction)):null)(),(()=>this.error?null:this.isLoading?s("div",{class:"text-info mt-2"},s("small",null,"Verifying bank account...")):this.isSuccess?s("div",{class:"text-success mt-2"},s("small",null,"✓ Bank account verified successfully")):this.isAuthenticating?s("div",{class:"text-info mt-2"},s("small",null,"Connecting to your bank...")):null)()))}};export{Lt as additional_questions_form_step,xt as bank_account_form_inputs,Ot as bank_account_form_inputs_canada,At as business_bank_account_form_step,Dt as business_core_info_form_step,Et as business_documents_on_file,It as business_owners_form_step,Vt as business_representative_form_inputs,Ht as business_representative_form_step,Pt as business_terms_conditions_form_step,zt as document_upload_form_step,Ut as document_upload_list,Zt as legal_address_form_step,Yt as owner_form,Gt as plaid_verification}
|