@justifi/webcomponents 4.19.0 → 4.19.1-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-ff013cbc.js → Analytics-1ca4e47e.js} +2 -3
- package/dist/cjs/{business.service-f63650f5.js → business.service-6bb7ac82.js} +5 -6
- package/dist/cjs/{get-payout-csv-f3aee6d0.js → get-payout-csv-1391ff3e.js} +3 -4
- package/dist/cjs/justifi-additional-questions-form-step_10.cjs.entry.js +7 -8
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +4 -5
- package/dist/cjs/justifi-business-details.cjs.entry.js +3 -4
- package/dist/cjs/justifi-business-form.cjs.entry.js +4 -5
- package/dist/cjs/justifi-card-form.cjs.entry.js +4 -5
- package/dist/cjs/justifi-checkout-core.cjs.entry.js +3 -3
- package/dist/cjs/justifi-checkout.cjs.entry.js +4 -5
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +3 -4
- package/dist/cjs/justifi-new-payment-method_4.cjs.entry.js +11 -9
- package/dist/cjs/justifi-owner-form_3.cjs.entry.js +1 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +3 -4
- package/dist/cjs/justifi-payment-form.cjs.entry.js +5 -6
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +5 -6
- package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -4
- package/dist/cjs/justifi-payout-details.cjs.entry.js +3 -4
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -4
- package/dist/cjs/justifi-refund-form.cjs.entry.js +2 -3
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +4 -5
- package/dist/cjs/{package-cb0f8cb1.js → package-bc2632e4.js} +2 -4
- package/dist/cjs/{payment.service-0a64f9cd.js → payment.service-dfcfa19b.js} +2 -3
- package/dist/collection/api/services/analytics.service.js +1 -2
- package/dist/collection/api/services/business.service.js +5 -6
- package/dist/collection/api/services/checkout.service.js +2 -3
- package/dist/collection/api/services/insurance.service.js +2 -3
- package/dist/collection/api/services/payment.service.js +2 -3
- package/dist/collection/api/services/payout.service.js +3 -4
- package/dist/collection/api/services/provision.service.js +2 -4
- package/dist/collection/api/services/reports.service.js +1 -2
- package/dist/collection/components/bank-account-form/bank-account-form.js +3 -4
- package/dist/collection/components/business-forms/business-form/business-form.js +2 -3
- package/dist/collection/components/business-forms/payment-provisioning/bank-account/business-bank-account-form-step.js +2 -3
- package/dist/collection/components/business-forms/payment-provisioning/document-uploads/business-document-upload-form-step.js +2 -3
- package/dist/collection/components/business-forms/payment-provisioning/terms-and-conditions/business-terms-conditions-form-step.js +2 -3
- package/dist/collection/components/card-form/card-form.js +3 -4
- package/dist/collection/components/checkout/checkout-core.js +4 -4
- package/dist/collection/components/checkout/new-payment-method.js +6 -4
- package/dist/collection/components/checkout/payment-method-options.js +3 -4
- package/dist/collection/components/checkout/saved-payment-method.js +3 -4
- package/dist/collection/components/checkout/sezzle-payment-method.js +3 -4
- package/dist/collection/components/payment-form/payment-form.js +3 -4
- package/dist/collection/components/refund-form/refund-form.js +2 -3
- package/dist/docs.json +8 -8
- package/dist/esm/{Analytics-33b8fa8d.js → Analytics-c51439be.js} +2 -3
- package/dist/esm/{business.service-74bd1212.js → business.service-f45decfc.js} +5 -6
- package/dist/esm/{get-payout-csv-b494abfe.js → get-payout-csv-e784a2ab.js} +3 -4
- package/dist/esm/justifi-additional-questions-form-step_10.entry.js +7 -8
- package/dist/esm/justifi-bank-account-form.entry.js +4 -5
- package/dist/esm/justifi-business-details.entry.js +3 -4
- package/dist/esm/justifi-business-form.entry.js +4 -5
- package/dist/esm/justifi-card-form.entry.js +4 -5
- package/dist/esm/justifi-checkout-core.entry.js +3 -3
- package/dist/esm/justifi-checkout.entry.js +4 -5
- package/dist/esm/justifi-gross-payment-chart.entry.js +3 -4
- package/dist/esm/justifi-new-payment-method_4.entry.js +11 -9
- package/dist/esm/justifi-owner-form_3.entry.js +1 -2
- package/dist/esm/justifi-payment-details.entry.js +3 -4
- package/dist/esm/justifi-payment-form.entry.js +5 -6
- package/dist/esm/justifi-payment-method-form.entry.js +1 -1
- package/dist/esm/justifi-payment-provisioning.entry.js +5 -6
- package/dist/esm/justifi-payments-list.entry.js +3 -4
- package/dist/esm/justifi-payout-details.entry.js +3 -4
- package/dist/esm/justifi-payouts-list.entry.js +3 -4
- package/dist/esm/justifi-refund-form.entry.js +2 -3
- package/dist/esm/justifi-season-interruption-insurance.entry.js +4 -5
- package/dist/esm/{package-3e407c6d.js → package-09a354e0.js} +2 -4
- package/dist/esm/{payment.service-3ca4a492.js → payment.service-dad5153b.js} +2 -3
- package/dist/globals.d.ts +2 -0
- package/dist/module/Analytics.js +1 -2
- package/dist/module/business-bank-account-form-step.js +2 -3
- package/dist/module/business-document-upload-form-step.js +2 -3
- package/dist/module/business-terms-conditions-form-step.js +2 -3
- package/dist/module/business.service.js +5 -6
- package/dist/module/checkout-core.js +3 -3
- package/dist/module/get-payout-csv.js +3 -4
- package/dist/module/justifi-bank-account-form.js +2 -3
- package/dist/module/justifi-business-form.js +2 -3
- package/dist/module/justifi-card-form.js +2 -3
- package/dist/module/justifi-checkout.js +2 -3
- package/dist/module/justifi-gross-payment-chart.js +1 -2
- package/dist/module/justifi-payment-form.js +3 -4
- package/dist/module/justifi-payment-provisioning.js +2 -3
- package/dist/module/justifi-refund-form.js +2 -3
- package/dist/module/justifi-season-interruption-insurance.js +2 -3
- package/dist/module/new-payment-method.js +5 -3
- package/dist/module/package.js +2 -4
- package/dist/module/payment-method-options.js +2 -3
- package/dist/module/payment.service.js +2 -3
- package/dist/module/saved-payment-method.js +2 -3
- package/dist/module/sezzle-payment-method.js +2 -3
- package/dist/types/components/checkout/new-payment-method.d.ts +1 -0
- package/dist/webcomponents/index.esm.js +1 -0
- package/dist/webcomponents/p-01a404ca.entry.js +44 -0
- package/dist/webcomponents/p-03d35880.entry.js +130 -0
- package/dist/webcomponents/p-06ff0429.entry.js +65 -0
- package/dist/webcomponents/p-08b0fb31.js +41 -1
- package/dist/webcomponents/p-14c91ffd.js +20 -1
- package/dist/webcomponents/p-1a17ea7d.entry.js +1684 -0
- package/dist/webcomponents/p-1ad5995e.js +3599 -1
- package/dist/webcomponents/p-1ff8810b.js +29 -1
- package/dist/webcomponents/p-21aeb013.entry.js +80 -0
- package/dist/webcomponents/p-2338affa.js +213 -1
- package/dist/webcomponents/p-258b1ee2.entry.js +149 -0
- package/dist/webcomponents/p-25d8cd65.entry.js +102 -0
- package/dist/webcomponents/p-29c0b182.js +114 -1
- package/dist/webcomponents/p-2b6c9c4f.js +7 -1
- package/dist/webcomponents/p-2dabeb5a.js +79 -0
- package/dist/webcomponents/p-2eab3c90.js +3052 -1
- package/dist/webcomponents/p-33272d05.entry.js +94 -0
- package/dist/webcomponents/p-3642ad71.entry.js +145 -0
- package/dist/webcomponents/p-387450f6.js +77 -0
- package/dist/webcomponents/p-3e9ef4a8.js +28 -0
- package/dist/webcomponents/p-3fd13ca3.js +52 -1
- package/dist/webcomponents/p-41bc7c5c.entry.js +97 -0
- package/dist/webcomponents/p-4d8b45c6.entry.js +98 -0
- package/dist/webcomponents/p-525db3e8.js +22 -1
- package/dist/webcomponents/p-5482d030.entry.js +21 -0
- package/dist/webcomponents/p-56f6ce4c.js +10 -1
- package/dist/webcomponents/p-576826b1.entry.js +43 -0
- package/dist/webcomponents/p-5968ff8a.js +178 -1
- package/dist/webcomponents/p-5bd7b204.entry.js +75 -0
- package/dist/webcomponents/p-5cb3f0b2.entry.js +261 -0
- package/dist/webcomponents/p-5e70442b.entry.js +74 -0
- package/dist/webcomponents/p-5f835b89.entry.js +606 -0
- package/dist/webcomponents/p-6078a370.js +244 -1
- package/dist/webcomponents/p-68843186.entry.js +73 -0
- package/dist/webcomponents/p-70a2aa74.entry.js +76 -0
- package/dist/webcomponents/p-7582b554.entry.js +18 -0
- package/dist/webcomponents/p-79646550.entry.js +61 -0
- package/dist/webcomponents/p-7c76e67c.entry.js +117 -0
- package/dist/webcomponents/p-7d85af5c.js +16 -1
- package/dist/webcomponents/p-800d31fe.entry.js +162 -0
- package/dist/webcomponents/p-8115b2f4.js +28 -1
- package/dist/webcomponents/p-83125497.js +4027 -1
- package/dist/webcomponents/p-85fc69e5.js +90 -1
- package/dist/webcomponents/p-890088fc.entry.js +298 -0
- package/dist/webcomponents/p-89887332.js +301 -1
- package/dist/webcomponents/p-8df7bde8.js +27 -1
- package/dist/webcomponents/p-8eb774df.entry.js +54 -0
- package/dist/webcomponents/p-9c9c7dac.js +24 -1
- package/dist/webcomponents/p-9f94bbb6.entry.js +118 -0
- package/dist/webcomponents/p-a5a225d9.entry.js +125 -0
- package/dist/webcomponents/p-a5c5821e.entry.js +101 -0
- package/dist/webcomponents/p-a5fb51dc.entry.js +131 -0
- package/dist/webcomponents/p-a6d04afc.js +44 -0
- package/dist/webcomponents/p-ac086069.entry.js +58 -0
- package/dist/webcomponents/p-af244664.js +126 -1
- package/dist/webcomponents/p-b82c146f.entry.js +111 -0
- package/dist/webcomponents/p-b8a03a4b.entry.js +131 -0
- package/dist/webcomponents/p-ba4bae6f.js +12 -1
- package/dist/webcomponents/p-ba5fae28.js +90 -1
- package/dist/webcomponents/p-c636f563.entry.js +791 -0
- package/dist/webcomponents/p-c86c24d2.entry.js +94 -0
- package/dist/webcomponents/p-cb26f708.js +18 -0
- package/dist/webcomponents/p-ce733539.entry.js +99 -0
- package/dist/webcomponents/p-d17aee2b.entry.js +26 -0
- package/dist/webcomponents/p-d5095f6c.entry.js +133 -0
- package/dist/webcomponents/p-d89bad72.js +39 -1
- package/dist/webcomponents/p-dce846bf.js +27 -1
- package/dist/webcomponents/p-df21aaad.js +120 -1
- package/dist/webcomponents/p-e1255160.js +3 -1
- package/dist/webcomponents/p-e333620e.js +34 -1
- package/dist/webcomponents/p-e356f280.entry.js +29 -0
- package/dist/webcomponents/p-e3fab0e2.js +43 -1
- package/dist/webcomponents/p-ec854a3e.entry.js +11053 -0
- package/dist/webcomponents/p-f02b75dc.entry.js +96 -0
- package/dist/webcomponents/p-fad19d75.js +1638 -2
- package/dist/webcomponents/webcomponents.css +362 -4
- package/dist/webcomponents/webcomponents.esm.js +20 -1
- package/package.json +2 -4
- package/dist/cjs/config-ff2dda66.js +0 -15
- package/dist/config.js +0 -11
- package/dist/esm/config-476c7241.js +0 -13
- package/dist/module/config.js +0 -13
- package/dist/types/home/runner/work/web-component-library/web-component-library/packages/webcomponents/.stencil/packages/webcomponents/config.d.ts +0 -11
- package/dist/webcomponents/p-07109641.entry.js +0 -1
- package/dist/webcomponents/p-0f7b9555.entry.js +0 -1
- package/dist/webcomponents/p-17e4246f.entry.js +0 -1
- package/dist/webcomponents/p-195f92e9.entry.js +0 -1
- package/dist/webcomponents/p-1a43e355.entry.js +0 -19
- package/dist/webcomponents/p-23014988.entry.js +0 -1
- package/dist/webcomponents/p-25dba252.entry.js +0 -1
- package/dist/webcomponents/p-27981600.entry.js +0 -1
- package/dist/webcomponents/p-301e0493.entry.js +0 -1
- package/dist/webcomponents/p-304dd644.entry.js +0 -1
- package/dist/webcomponents/p-30a493cd.entry.js +0 -1
- package/dist/webcomponents/p-462dc522.entry.js +0 -1
- package/dist/webcomponents/p-487b72a8.entry.js +0 -1
- package/dist/webcomponents/p-4abc17f0.entry.js +0 -1
- package/dist/webcomponents/p-4b4580dd.js +0 -1
- package/dist/webcomponents/p-52021fa1.entry.js +0 -1
- package/dist/webcomponents/p-53e64f15.entry.js +0 -1
- package/dist/webcomponents/p-60a370fc.entry.js +0 -1
- package/dist/webcomponents/p-623a4479.entry.js +0 -1
- package/dist/webcomponents/p-62b32c4c.entry.js +0 -1
- package/dist/webcomponents/p-63acf322.js +0 -1
- package/dist/webcomponents/p-6f03b35a.entry.js +0 -1
- package/dist/webcomponents/p-75b4daef.js +0 -1
- package/dist/webcomponents/p-8603348a.js +0 -1
- package/dist/webcomponents/p-8c1e981b.entry.js +0 -1
- package/dist/webcomponents/p-8e541a32.entry.js +0 -1
- package/dist/webcomponents/p-9279aa49.entry.js +0 -1
- package/dist/webcomponents/p-96b42e7d.entry.js +0 -1
- package/dist/webcomponents/p-99022846.entry.js +0 -1
- package/dist/webcomponents/p-ae263544.js +0 -1
- package/dist/webcomponents/p-b16dfd5d.entry.js +0 -1
- package/dist/webcomponents/p-bbed6107.entry.js +0 -1
- package/dist/webcomponents/p-bc92235c.entry.js +0 -1
- package/dist/webcomponents/p-be39c802.entry.js +0 -1
- package/dist/webcomponents/p-c4b87db2.entry.js +0 -1
- package/dist/webcomponents/p-c9f8f7ec.entry.js +0 -1
- package/dist/webcomponents/p-cd7105dd.entry.js +0 -1
- package/dist/webcomponents/p-d101c5db.js +0 -1
- package/dist/webcomponents/p-d1fbeae5.entry.js +0 -1
- package/dist/webcomponents/p-d8355f91.entry.js +0 -1
- package/dist/webcomponents/p-e2c88817.entry.js +0 -1
- package/dist/webcomponents/p-e31f0f3e.entry.js +0 -1
- package/dist/webcomponents/p-e7067ef2.entry.js +0 -1
- package/dist/webcomponents/p-f0866375.entry.js +0 -1
- package/dist/webcomponents/p-fb58feb5.entry.js +0 -1
- package/dist/webcomponents/p-fe33151d.entry.js +0 -1
|
@@ -0,0 +1,791 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './p-fad19d75.js';
|
|
2
|
+
import { a as ComponentErrorCodes, C as ComponentErrorSeverity } from './p-14c91ffd.js';
|
|
3
|
+
import { m as makeGetBusiness, b as makePatchBusiness } from './p-5968ff8a.js';
|
|
4
|
+
import { B as BusinessService } from './p-3e9ef4a8.js';
|
|
5
|
+
import { c as create$3, F as FormController, e as create$7 } from './p-2eab3c90.js';
|
|
6
|
+
import { b as BusinessFormStep, a as BusinessFormClickActions } from './p-d89bad72.js';
|
|
7
|
+
import { z as bankNameValidation, A as nicknameValidation, i as identityNameValidation, B as accountTypeValidation, C as accountNumberValidation, D as routingNumberValidation, E as voidedCheckValidation, F as governmentIdValidation, G as ss4Validation, H as otherDocumentValidation, I as balanceSheetValidation, J as bankStatementValidation, K as profitAndLossStatementValidation, L as EntityDocument, M as EntityDocumentStorage } from './p-89887332.js';
|
|
8
|
+
import { c as bankAccountTypeOptions } from './p-ba5fae28.js';
|
|
9
|
+
import { A as Api } from './p-29c0b182.js';
|
|
10
|
+
import './p-56f6ce4c.js';
|
|
11
|
+
import './p-df21aaad.js';
|
|
12
|
+
import './p-e3fab0e2.js';
|
|
13
|
+
import { n as numberOnlyHandler } from './p-8df7bde8.js';
|
|
14
|
+
import { B as Business } from './p-af244664.js';
|
|
15
|
+
import { S as Skeleton } from './p-08b0fb31.js';
|
|
16
|
+
import { B as Button } from './p-9c9c7dac.js';
|
|
17
|
+
import './p-8115b2f4.js';
|
|
18
|
+
import './p-6078a370.js';
|
|
19
|
+
import './p-1ff8810b.js';
|
|
20
|
+
|
|
21
|
+
const AdditionalQuestionsFormStep = class {
|
|
22
|
+
constructor(hostRef) {
|
|
23
|
+
registerInstance(this, hostRef);
|
|
24
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
25
|
+
this.getBusiness = undefined;
|
|
26
|
+
this.patchBusiness = undefined;
|
|
27
|
+
this.authToken = undefined;
|
|
28
|
+
this.businessId = undefined;
|
|
29
|
+
this.allowOptionalFields = undefined;
|
|
30
|
+
}
|
|
31
|
+
propChanged() {
|
|
32
|
+
this.initializeApi();
|
|
33
|
+
}
|
|
34
|
+
async validateAndSubmit({ onSuccess }) {
|
|
35
|
+
this.coreComponent.validateAndSubmit({ onSuccess });
|
|
36
|
+
}
|
|
37
|
+
componentWillLoad() {
|
|
38
|
+
this.initializeApi();
|
|
39
|
+
}
|
|
40
|
+
initializeApi() {
|
|
41
|
+
if (this.authToken && this.businessId) {
|
|
42
|
+
this.getBusiness = makeGetBusiness({
|
|
43
|
+
authToken: this.authToken,
|
|
44
|
+
businessId: this.businessId,
|
|
45
|
+
service: new BusinessService()
|
|
46
|
+
});
|
|
47
|
+
this.patchBusiness = makePatchBusiness({
|
|
48
|
+
authToken: this.authToken,
|
|
49
|
+
businessId: this.businessId,
|
|
50
|
+
service: new BusinessService()
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.errorEvent.emit({
|
|
55
|
+
message: 'Missing required props',
|
|
56
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
57
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
render() {
|
|
62
|
+
return (h("justifi-additional-questions-form-step-core", { key: 'ede8f1336c69d47c651a5b4b95ee2746aae3aa52', getBusiness: this.getBusiness, patchBusiness: this.patchBusiness, allowOptionalFields: this.allowOptionalFields, ref: el => this.coreComponent = el }));
|
|
63
|
+
}
|
|
64
|
+
static get watchers() { return {
|
|
65
|
+
"authToken": ["propChanged"],
|
|
66
|
+
"businessId": ["propChanged"]
|
|
67
|
+
}; }
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const businessBankAccountSchema = (allowOptionalFields) => {
|
|
71
|
+
const schema = create$3({
|
|
72
|
+
bank_name: bankNameValidation.required('Enter bank name'),
|
|
73
|
+
nickname: nicknameValidation.required('Enter nickname'),
|
|
74
|
+
account_owner_name: identityNameValidation.required('Enter account owner name'),
|
|
75
|
+
account_type: accountTypeValidation.required('Select account type'),
|
|
76
|
+
account_number: accountNumberValidation.required('Enter account number'),
|
|
77
|
+
routing_number: routingNumberValidation.required('Enter routing number')
|
|
78
|
+
});
|
|
79
|
+
const easySchema = create$3({
|
|
80
|
+
bank_name: bankNameValidation.nullable(),
|
|
81
|
+
nickname: nicknameValidation.nullable(),
|
|
82
|
+
account_owner_name: identityNameValidation.nullable(),
|
|
83
|
+
account_type: accountTypeValidation.nullable(),
|
|
84
|
+
account_number: accountNumberValidation.nullable(),
|
|
85
|
+
routing_number: routingNumberValidation.nullable()
|
|
86
|
+
});
|
|
87
|
+
return allowOptionalFields ? easySchema : schema;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
class BankAccount {
|
|
91
|
+
constructor(data) {
|
|
92
|
+
this.id = data.id;
|
|
93
|
+
this.account_owner_name = data.account_owner_name;
|
|
94
|
+
this.full_name = data.full_name;
|
|
95
|
+
this.account_type = data.account_type;
|
|
96
|
+
this.acct_last_four = data.acct_last_four;
|
|
97
|
+
this.account_number_last4 = data.account_number_last4;
|
|
98
|
+
this.routing_number = data.routing_number;
|
|
99
|
+
this.bank_name = data.bank_name;
|
|
100
|
+
this.country = data.country;
|
|
101
|
+
this.currency = data.currency;
|
|
102
|
+
this.nickname = data.nickname;
|
|
103
|
+
this.metadata = data.metadata;
|
|
104
|
+
this.business_id = data.business_id;
|
|
105
|
+
this.platform_account_id = data.platform_account_id;
|
|
106
|
+
this.created_at = data.created_at;
|
|
107
|
+
this.updated_at = data.updated_at;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const BusinessBankAccountFormStep = class {
|
|
112
|
+
constructor(hostRef) {
|
|
113
|
+
registerInstance(this, hostRef);
|
|
114
|
+
this.submitted = createEvent(this, "submitted", 7);
|
|
115
|
+
this.formLoading = createEvent(this, "formLoading", 7);
|
|
116
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
117
|
+
this.fetchData = async () => {
|
|
118
|
+
this.formLoading.emit(true);
|
|
119
|
+
try {
|
|
120
|
+
const response = await this.api.get(this.businessEndpoint);
|
|
121
|
+
if (response.data.bank_accounts.length > 0) {
|
|
122
|
+
this.bankAccount = Object.assign({}, new BankAccount(response.data.bank_accounts[0]));
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
this.bankAccount = Object.assign({}, new BankAccount({}));
|
|
126
|
+
}
|
|
127
|
+
this.formController.setInitialValues(Object.assign({}, this.bankAccount));
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
this.errorEvent.emit({
|
|
131
|
+
errorCode: ComponentErrorCodes.FETCH_ERROR,
|
|
132
|
+
message: error.message,
|
|
133
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
134
|
+
data: error,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
this.formLoading.emit(false);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
this.sendData = async (onSuccess) => {
|
|
142
|
+
this.formLoading.emit(true);
|
|
143
|
+
try {
|
|
144
|
+
const formValues = this.formController.values.getValue();
|
|
145
|
+
const payload = Object.assign(Object.assign({}, formValues), { business_id: this.businessId });
|
|
146
|
+
const response = await this.api.post(this.bankAccountEndpoint, JSON.stringify(payload));
|
|
147
|
+
this.handleResponse(response, onSuccess);
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
this.errorEvent.emit({
|
|
151
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
152
|
+
message: error.message,
|
|
153
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
154
|
+
data: error,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
this.formLoading.emit(false);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
this.inputHandler = (name, value) => {
|
|
162
|
+
this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { [name]: value }));
|
|
163
|
+
};
|
|
164
|
+
this.formController = undefined;
|
|
165
|
+
this.errors = {};
|
|
166
|
+
this.bankAccount = undefined;
|
|
167
|
+
this.authToken = undefined;
|
|
168
|
+
this.businessId = undefined;
|
|
169
|
+
this.allowOptionalFields = undefined;
|
|
170
|
+
}
|
|
171
|
+
get businessEndpoint() {
|
|
172
|
+
return `entities/business/${this.businessId}`;
|
|
173
|
+
}
|
|
174
|
+
get bankAccountEndpoint() {
|
|
175
|
+
return `entities/bank_accounts`;
|
|
176
|
+
}
|
|
177
|
+
get formDisabled() {
|
|
178
|
+
var _a;
|
|
179
|
+
return !!((_a = this.bankAccount) === null || _a === void 0 ? void 0 : _a.id);
|
|
180
|
+
}
|
|
181
|
+
handleResponse(response, onSuccess) {
|
|
182
|
+
if (response.error) {
|
|
183
|
+
this.errorEvent.emit({
|
|
184
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
185
|
+
message: response.error.message,
|
|
186
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
187
|
+
data: response.error,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
onSuccess();
|
|
192
|
+
}
|
|
193
|
+
this.submitted.emit({ data: response, metadata: { completedStep: BusinessFormStep.bankAccount } });
|
|
194
|
+
}
|
|
195
|
+
async validateAndSubmit({ onSuccess }) {
|
|
196
|
+
this.formDisabled ? onSuccess() :
|
|
197
|
+
this.formController.validateAndSubmit(() => this.sendData(onSuccess));
|
|
198
|
+
}
|
|
199
|
+
;
|
|
200
|
+
componentWillLoad() {
|
|
201
|
+
this.formController = new FormController(businessBankAccountSchema(this.allowOptionalFields));
|
|
202
|
+
this.api = Api({ authToken: this.authToken, apiOrigin: undefined });
|
|
203
|
+
if (this.businessId && this.authToken) {
|
|
204
|
+
this.fetchData();
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
componentDidLoad() {
|
|
208
|
+
this.formController.values.subscribe(values => this.bankAccount = Object.assign({}, values));
|
|
209
|
+
this.formController.errors.subscribe(errors => {
|
|
210
|
+
this.errors = Object.assign({}, errors);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
render() {
|
|
214
|
+
const bankAccountDefaultValue = this.formController.getInitialValues();
|
|
215
|
+
return (h("form", { key: 'bc16efe8af48103ce07d8f5c6ecb040bbb957868' }, h("fieldset", { key: 'aaada7411cd43e678be3fe14bd60462e39f54527' }, h("legend", { key: '165b78cff91b553a37e7f070a40c4941db2929df' }, "Bank Account Info"), h("hr", { key: '006315c63bd21554dfa30d763122b9c9f259aba9' }), h("div", { key: 'f080fa734567a23c43ee7123bf2718aad5f1efa1', class: "row gy-3" }, h("div", { key: '674fab37279d21761f6e588338ebdcdb9e5520aa', class: "col-12" }, h("form-control-text", { key: '68f1a9aa2200e204c4db2a36eb5f4f168ab18bab', name: "bank_name", label: "Bank Name", defaultValue: bankAccountDefaultValue.bank_name, errorText: this.errors.bank_name, inputHandler: this.inputHandler, disabled: this.formDisabled })), h("div", { key: '085f33f93096bd9ecba304715ea1c3ec879396b4', class: "col-12" }, h("form-control-text", { key: 'c684ee2722f992ed61c51f87fd2c234c7278eb21', name: "nickname", label: "Nickname", defaultValue: bankAccountDefaultValue.nickname, errorText: this.errors.nickname, inputHandler: this.inputHandler, disabled: this.formDisabled })), h("div", { key: 'c0afbdb31f2faa8f73158e659b232230099e8b9f', class: "col-12" }, h("form-control-text", { key: '3d0e3ca9794beed0c542b6ca18a01eebec48366f', name: "account_owner_name", label: "Account Owner Name", defaultValue: bankAccountDefaultValue.account_owner_name, errorText: this.errors.account_owner_name, inputHandler: this.inputHandler, disabled: this.formDisabled })), h("div", { key: '40fd8191645312efaadc633061451bd744f2a31a', class: "col-12" }, h("form-control-select", { key: '40e40cc75dcaf8ef9ba47bdf109eb14798f28436', name: "account_type", label: "Account Type", options: bankAccountTypeOptions, defaultValue: bankAccountDefaultValue.account_type, errorText: this.errors.account_type, inputHandler: this.inputHandler, disabled: this.formDisabled })), h("div", { key: '2af9c012bca9d413a5eb5b3b27f685f88137888b', class: "col-12" }, h("form-control-text", { key: '6386c601520152cb758dfe30ea7c6a8cdb1b249a', name: "account_number", label: "Account Number", defaultValue: bankAccountDefaultValue.account_number, maxLength: 17, errorText: this.errors.account_number, inputHandler: this.inputHandler, keyDownHandler: numberOnlyHandler, disabled: this.formDisabled })), h("div", { key: '8dac645db4cb8f18f4cdd138a02bc2467d2fcdd4', class: "col-12" }, h("form-control-text", { key: 'b8abe9231edd0fd07c21c9b3874e8f4f792a1eda', name: "routing_number", label: "Routing Number", defaultValue: bankAccountDefaultValue.routing_number, maxLength: 9, errorText: this.errors.routing_number, inputHandler: this.inputHandler, keyDownHandler: numberOnlyHandler, disabled: this.formDisabled }))))));
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
const BusinessCoreInfoFormStep = class {
|
|
220
|
+
constructor(hostRef) {
|
|
221
|
+
registerInstance(this, hostRef);
|
|
222
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
223
|
+
this.getBusiness = undefined;
|
|
224
|
+
this.patchBusiness = undefined;
|
|
225
|
+
this.authToken = undefined;
|
|
226
|
+
this.businessId = undefined;
|
|
227
|
+
this.allowOptionalFields = undefined;
|
|
228
|
+
}
|
|
229
|
+
propChanged() {
|
|
230
|
+
this.initializeApi();
|
|
231
|
+
}
|
|
232
|
+
async validateAndSubmit({ onSuccess }) {
|
|
233
|
+
this.coreComponent.validateAndSubmit({ onSuccess });
|
|
234
|
+
}
|
|
235
|
+
componentWillLoad() {
|
|
236
|
+
this.initializeApi();
|
|
237
|
+
}
|
|
238
|
+
initializeApi() {
|
|
239
|
+
if (this.authToken && this.businessId) {
|
|
240
|
+
this.getBusiness = makeGetBusiness({
|
|
241
|
+
authToken: this.authToken,
|
|
242
|
+
businessId: this.businessId,
|
|
243
|
+
service: new BusinessService()
|
|
244
|
+
});
|
|
245
|
+
this.patchBusiness = makePatchBusiness({
|
|
246
|
+
authToken: this.authToken,
|
|
247
|
+
businessId: this.businessId,
|
|
248
|
+
service: new BusinessService()
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
this.errorEvent.emit({
|
|
253
|
+
message: 'Missing required props',
|
|
254
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
255
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
render() {
|
|
260
|
+
return (h("justifi-business-core-info-form-step-core", { key: '4ee53046d16fd42df4e09b10c338a740c22184ef', businessId: this.businessId, getBusiness: this.getBusiness, patchBusiness: this.patchBusiness, allowOptionalFields: this.allowOptionalFields, ref: el => this.coreComponent = el }));
|
|
261
|
+
}
|
|
262
|
+
static get watchers() { return {
|
|
263
|
+
"authToken": ["propChanged"],
|
|
264
|
+
"businessId": ["propChanged"]
|
|
265
|
+
}; }
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
const businessDocumentSchema = (volume, documents, allowOptionalFields) => {
|
|
269
|
+
const schema = create$3({
|
|
270
|
+
voided_check: voidedCheckValidation(documents, allowOptionalFields),
|
|
271
|
+
government_id: governmentIdValidation.nullable(),
|
|
272
|
+
ss4: ss4Validation.nullable(),
|
|
273
|
+
other: otherDocumentValidation.nullable(),
|
|
274
|
+
balance_sheet: balanceSheetValidation(volume, documents, allowOptionalFields),
|
|
275
|
+
bank_statement: bankStatementValidation(volume, documents, allowOptionalFields),
|
|
276
|
+
profit_and_loss_statement: profitAndLossStatementValidation(volume, documents, allowOptionalFields),
|
|
277
|
+
});
|
|
278
|
+
const easySchema = create$3({
|
|
279
|
+
voided_check: voidedCheckValidation(documents, allowOptionalFields),
|
|
280
|
+
government_id: governmentIdValidation.nullable(),
|
|
281
|
+
ss4: ss4Validation.nullable(),
|
|
282
|
+
other: otherDocumentValidation.nullable(),
|
|
283
|
+
balance_sheet: balanceSheetValidation(volume, documents, allowOptionalFields),
|
|
284
|
+
bank_statement: bankStatementValidation(volume, documents, allowOptionalFields),
|
|
285
|
+
profit_and_loss_statement: profitAndLossStatementValidation(volume, documents, allowOptionalFields)
|
|
286
|
+
});
|
|
287
|
+
return allowOptionalFields ? easySchema : schema;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const BusinessDocumentFormStep = class {
|
|
291
|
+
constructor(hostRef) {
|
|
292
|
+
registerInstance(this, hostRef);
|
|
293
|
+
this.submitted = createEvent(this, "submitted", 7);
|
|
294
|
+
this.formLoading = createEvent(this, "formLoading", 7);
|
|
295
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
296
|
+
this.inputHandler = (name, value) => {
|
|
297
|
+
this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { [name]: value }));
|
|
298
|
+
};
|
|
299
|
+
this.fetchData = async () => {
|
|
300
|
+
this.renderState = 'loading';
|
|
301
|
+
this.formLoading.emit(true);
|
|
302
|
+
try {
|
|
303
|
+
const response = await this.api.get(this.businessEndpoint);
|
|
304
|
+
this.business = Object.assign({}, new Business(response.data));
|
|
305
|
+
this.existingDocuments = response.data.documents;
|
|
306
|
+
this.paymentVolume = response.data.additional_questions.business_payment_volume;
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
this.errorEvent.emit({
|
|
310
|
+
errorCode: ComponentErrorCodes.FETCH_ERROR,
|
|
311
|
+
message: error.message,
|
|
312
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
313
|
+
data: error,
|
|
314
|
+
});
|
|
315
|
+
this.renderState = 'error';
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
this.initializeFormController();
|
|
319
|
+
this.formLoading.emit(false);
|
|
320
|
+
this.renderState = 'success';
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
this.initializeFormController = () => {
|
|
324
|
+
this.formController = new FormController(businessDocumentSchema(this.paymentVolume, this.existingDocuments, this.allowOptionalFields));
|
|
325
|
+
this.formController.errors.subscribe(errors => {
|
|
326
|
+
this.errors = Object.assign({}, errors);
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
this.createDocumentRecord = async (docData) => {
|
|
330
|
+
this.formLoading.emit(true);
|
|
331
|
+
const payload = docData.record_data;
|
|
332
|
+
try {
|
|
333
|
+
const response = await this.api.post(this.documentEndpoint, JSON.stringify(payload));
|
|
334
|
+
return this.handleDocRecordResponse(docData, response);
|
|
335
|
+
}
|
|
336
|
+
catch (error) {
|
|
337
|
+
this.errorEvent.emit({
|
|
338
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
339
|
+
message: error.message,
|
|
340
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
341
|
+
data: error,
|
|
342
|
+
});
|
|
343
|
+
return false;
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
this.handleDocRecordResponse = (docData, response) => {
|
|
347
|
+
if (response.error) {
|
|
348
|
+
this.errorEvent.emit({
|
|
349
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
350
|
+
message: response.error.message,
|
|
351
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
352
|
+
data: response.error,
|
|
353
|
+
});
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
docData.setPresignedUrl(response.data.presigned_url);
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
this.uploadDocument = async (docData) => {
|
|
362
|
+
if (!docData.presigned_url) {
|
|
363
|
+
throw new Error('Presigned URL is not set');
|
|
364
|
+
}
|
|
365
|
+
const response = await fetch(docData.presigned_url, {
|
|
366
|
+
method: 'PUT',
|
|
367
|
+
body: docData.fileString,
|
|
368
|
+
});
|
|
369
|
+
return this.handleUploadResponse(response);
|
|
370
|
+
};
|
|
371
|
+
this.handleUploadResponse = (response) => {
|
|
372
|
+
if (response.error) {
|
|
373
|
+
this.errorEvent.emit({
|
|
374
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
375
|
+
message: response.error.message,
|
|
376
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
377
|
+
data: response.error,
|
|
378
|
+
});
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
this.submitted.emit({ data: response, metadata: { completedStep: BusinessFormStep.documentUpload } });
|
|
383
|
+
return true;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
this.storeFiles = (e) => {
|
|
387
|
+
const fileList = Array.from(e.detail.fileList);
|
|
388
|
+
const docType = e.detail.document_type;
|
|
389
|
+
const documentList = fileList.map(file => new EntityDocument({ file, document_type: docType }, this.businessId));
|
|
390
|
+
this.documentData[docType] = documentList;
|
|
391
|
+
};
|
|
392
|
+
this.sendData = async (onSuccess) => {
|
|
393
|
+
try {
|
|
394
|
+
const docArray = Object.values(this.documentData).flat();
|
|
395
|
+
if (!docArray.length) {
|
|
396
|
+
return onSuccess();
|
|
397
|
+
}
|
|
398
|
+
const documentRecords = docArray.map(docData => this.createDocumentRecord(docData));
|
|
399
|
+
const recordsCreated = await Promise.all(documentRecords);
|
|
400
|
+
if (!recordsCreated) {
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
const uploads = docArray.map(docData => this.uploadDocument(docData));
|
|
404
|
+
const uploadsCompleted = await Promise.all(uploads);
|
|
405
|
+
if (!uploadsCompleted) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
await onSuccess();
|
|
409
|
+
}
|
|
410
|
+
finally {
|
|
411
|
+
this.formLoading.emit(false);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
this.formController = undefined;
|
|
415
|
+
this.errors = {};
|
|
416
|
+
this.existingDocuments = [];
|
|
417
|
+
this.paymentVolume = undefined;
|
|
418
|
+
this.business = undefined;
|
|
419
|
+
this.documentData = new EntityDocumentStorage();
|
|
420
|
+
this.renderState = 'loading';
|
|
421
|
+
this.authToken = undefined;
|
|
422
|
+
this.businessId = undefined;
|
|
423
|
+
this.allowOptionalFields = undefined;
|
|
424
|
+
}
|
|
425
|
+
get businessEndpoint() {
|
|
426
|
+
return `entities/business/${this.businessId}`;
|
|
427
|
+
}
|
|
428
|
+
get documentEndpoint() {
|
|
429
|
+
return 'entities/document';
|
|
430
|
+
}
|
|
431
|
+
componentWillLoad() {
|
|
432
|
+
this.api = Api({ authToken: this.authToken, apiOrigin: undefined });
|
|
433
|
+
if (this.businessId && this.authToken) {
|
|
434
|
+
this.fetchData();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
async validateAndSubmit({ onSuccess }) {
|
|
438
|
+
this.formController.validateAndSubmit(() => this.sendData(onSuccess));
|
|
439
|
+
}
|
|
440
|
+
get isLoading() {
|
|
441
|
+
return this.renderState === 'loading';
|
|
442
|
+
}
|
|
443
|
+
get isError() {
|
|
444
|
+
return this.renderState === 'error';
|
|
445
|
+
}
|
|
446
|
+
get documentsOnFile() {
|
|
447
|
+
if (this.isError) {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
if (this.isLoading) {
|
|
451
|
+
return h(Skeleton, { variant: 'rounded', height: '50px' });
|
|
452
|
+
}
|
|
453
|
+
return h("justifi-business-documents-on-file", { documents: this.existingDocuments });
|
|
454
|
+
}
|
|
455
|
+
get formInputs() {
|
|
456
|
+
if (this.isError) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
if (this.isLoading) {
|
|
460
|
+
return h(Skeleton, { variant: 'rounded', height: '350px' });
|
|
461
|
+
}
|
|
462
|
+
return (h("justifi-business-document-upload-input-group", { paymentVolume: this.paymentVolume, inputHandler: this.inputHandler, storeFiles: this.storeFiles, errors: this.errors }));
|
|
463
|
+
}
|
|
464
|
+
render() {
|
|
465
|
+
return (h("form", { key: '4905c2dacbca9b1390fd7e316993be5d33117ee5' }, h("fieldset", { key: '22dc71452b1917be0d9dc237b1ac27739b922e65' }, h("legend", { key: '7c705b2b00a13f7fe690b2e5169dd1809934f892' }, "Document Uploads"), h("p", { key: 'e0ad37456d88496a589c1c79e8e3e9a0fc101577' }, "Various file formats such as PDF, DOC, DOCX, JPEG, and others are accepted. Multiple files can be uploaded for each document category."), h("hr", { key: '4ac6afc1c6ce6c6e81d4fcf05ee1c5c58b66f520' }), this.documentsOnFile, h("div", { key: 'bf8aa49a47a2d53f5c0a1179474d8dd885a5a363', class: "d-flex flex-column" }, this.formInputs))));
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
const BusinessOwnersFormStep = class {
|
|
470
|
+
constructor(hostRef) {
|
|
471
|
+
registerInstance(this, hostRef);
|
|
472
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
473
|
+
this.getBusiness = undefined;
|
|
474
|
+
this.patchBusiness = undefined;
|
|
475
|
+
this.authToken = undefined;
|
|
476
|
+
this.businessId = undefined;
|
|
477
|
+
this.allowOptionalFields = undefined;
|
|
478
|
+
}
|
|
479
|
+
propChanged() {
|
|
480
|
+
this.initializeApi();
|
|
481
|
+
}
|
|
482
|
+
async validateAndSubmit({ onSuccess }) {
|
|
483
|
+
this.coreComponent.validateAndSubmit({ onSuccess });
|
|
484
|
+
}
|
|
485
|
+
componentWillLoad() {
|
|
486
|
+
this.initializeApi();
|
|
487
|
+
}
|
|
488
|
+
initializeApi() {
|
|
489
|
+
if (this.authToken && this.businessId) {
|
|
490
|
+
this.getBusiness = makeGetBusiness({
|
|
491
|
+
authToken: this.authToken,
|
|
492
|
+
businessId: this.businessId,
|
|
493
|
+
service: new BusinessService()
|
|
494
|
+
});
|
|
495
|
+
this.patchBusiness = makePatchBusiness({
|
|
496
|
+
authToken: this.authToken,
|
|
497
|
+
businessId: this.businessId,
|
|
498
|
+
service: new BusinessService()
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
else {
|
|
502
|
+
this.errorEvent.emit({
|
|
503
|
+
message: 'Missing required props',
|
|
504
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
505
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
render() {
|
|
510
|
+
return (h(Host, { key: '213a68fd3543eb912c6fed376128ba877ba75871' }, h("justifi-business-owners-form-step-core", { key: '5acee797bd35f5b60cadc5ddd50f560532dfe8b1', authToken: this.authToken, businessId: this.businessId, getBusiness: this.getBusiness, patchBusiness: this.patchBusiness, allowOptionalFields: this.allowOptionalFields, ref: (el) => this.coreComponent = el })));
|
|
511
|
+
}
|
|
512
|
+
static get watchers() { return {
|
|
513
|
+
"authToken": ["propChanged"],
|
|
514
|
+
"businessId": ["propChanged"]
|
|
515
|
+
}; }
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
const BusinessRepresentativeFormStep = class {
|
|
519
|
+
constructor(hostRef) {
|
|
520
|
+
registerInstance(this, hostRef);
|
|
521
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
522
|
+
this.getBusiness = undefined;
|
|
523
|
+
this.patchBusiness = undefined;
|
|
524
|
+
this.authToken = undefined;
|
|
525
|
+
this.businessId = undefined;
|
|
526
|
+
this.allowOptionalFields = undefined;
|
|
527
|
+
}
|
|
528
|
+
propChanged() {
|
|
529
|
+
this.initializeApi();
|
|
530
|
+
}
|
|
531
|
+
async validateAndSubmit({ onSuccess }) {
|
|
532
|
+
this.coreComponent.validateAndSubmit({ onSuccess });
|
|
533
|
+
}
|
|
534
|
+
componentWillLoad() {
|
|
535
|
+
this.initializeApi();
|
|
536
|
+
}
|
|
537
|
+
initializeApi() {
|
|
538
|
+
if (this.authToken && this.businessId) {
|
|
539
|
+
this.getBusiness = makeGetBusiness({
|
|
540
|
+
authToken: this.authToken,
|
|
541
|
+
businessId: this.businessId,
|
|
542
|
+
service: new BusinessService()
|
|
543
|
+
});
|
|
544
|
+
this.patchBusiness = makePatchBusiness({
|
|
545
|
+
authToken: this.authToken,
|
|
546
|
+
businessId: this.businessId,
|
|
547
|
+
service: new BusinessService()
|
|
548
|
+
});
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
this.errorEvent.emit({
|
|
552
|
+
message: 'Missing required props',
|
|
553
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
554
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
render() {
|
|
559
|
+
return (h("justifi-business-representative-form-step-core", { key: '866d8cf33d53eff562dac1d36898b4c5695bf39b', getBusiness: this.getBusiness, patchBusiness: this.patchBusiness, allowOptionalFields: this.allowOptionalFields, ref: el => this.coreComponent = el }));
|
|
560
|
+
}
|
|
561
|
+
static get watchers() { return {
|
|
562
|
+
"authToken": ["propChanged"],
|
|
563
|
+
"businessId": ["propChanged"]
|
|
564
|
+
}; }
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
const businessTermsConditionsSchema = (allowOptionalFields) => {
|
|
568
|
+
const schema = create$3({
|
|
569
|
+
accepted: create$7()
|
|
570
|
+
.oneOf([true], 'You must agree to the terms and conditions to continue')
|
|
571
|
+
.required('You must agree to the terms and conditions to continue')
|
|
572
|
+
});
|
|
573
|
+
const easySchema = create$3({
|
|
574
|
+
accepted: create$7().nullable()
|
|
575
|
+
});
|
|
576
|
+
return allowOptionalFields ? easySchema : schema;
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
const BusinessTermsConditionsFormStep = class {
|
|
580
|
+
constructor(hostRef) {
|
|
581
|
+
registerInstance(this, hostRef);
|
|
582
|
+
this.submitted = createEvent(this, "submitted", 7);
|
|
583
|
+
this.formLoading = createEvent(this, "formLoading", 7);
|
|
584
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
585
|
+
this.fetchData = async () => {
|
|
586
|
+
this.formLoading.emit(true);
|
|
587
|
+
try {
|
|
588
|
+
const response = await this.api.get(this.businessEndpoint);
|
|
589
|
+
this.acceptedTermsBefore = response.data.terms_conditions_accepted;
|
|
590
|
+
}
|
|
591
|
+
catch (error) {
|
|
592
|
+
this.errorEvent.emit({
|
|
593
|
+
errorCode: ComponentErrorCodes.FETCH_ERROR,
|
|
594
|
+
message: error.message,
|
|
595
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
596
|
+
data: error,
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
finally {
|
|
600
|
+
this.formLoading.emit(false);
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
this.sendData = async (onSuccess) => {
|
|
604
|
+
this.formLoading.emit(true);
|
|
605
|
+
try {
|
|
606
|
+
const payload = JSON.stringify(this.termsPayload);
|
|
607
|
+
const response = await this.api.post(this.termsConditionsEndpoint, payload);
|
|
608
|
+
this.handleResponse(response, onSuccess);
|
|
609
|
+
}
|
|
610
|
+
catch (error) {
|
|
611
|
+
this.errorEvent.emit({
|
|
612
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
613
|
+
message: error.message,
|
|
614
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
615
|
+
data: error,
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
finally {
|
|
619
|
+
this.formLoading.emit(false);
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
this.inputHandler = (name, value) => {
|
|
623
|
+
this.formController.setValues(Object.assign(Object.assign({}, this.formController.values.getValue()), { [name]: value }));
|
|
624
|
+
};
|
|
625
|
+
this.formController = undefined;
|
|
626
|
+
this.errors = {};
|
|
627
|
+
this.acceptedTermsBefore = undefined;
|
|
628
|
+
this.authToken = undefined;
|
|
629
|
+
this.businessId = undefined;
|
|
630
|
+
this.allowOptionalFields = undefined;
|
|
631
|
+
}
|
|
632
|
+
get businessEndpoint() {
|
|
633
|
+
return `entities/business/${this.businessId}`;
|
|
634
|
+
}
|
|
635
|
+
get termsConditionsEndpoint() {
|
|
636
|
+
return 'entities/terms_and_conditions';
|
|
637
|
+
}
|
|
638
|
+
get formHelperText() {
|
|
639
|
+
return this.acceptedTermsBefore ? 'You have already accepted the terms and conditions.' : null;
|
|
640
|
+
}
|
|
641
|
+
get termsPayload() {
|
|
642
|
+
return {
|
|
643
|
+
business_id: this.businessId,
|
|
644
|
+
accepted: this.formController.values.getValue().accepted,
|
|
645
|
+
user_agent: window.navigator.userAgent
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
async componentWillLoad() {
|
|
649
|
+
this.api = Api({ authToken: this.authToken, apiOrigin: undefined });
|
|
650
|
+
this.formController = new FormController(businessTermsConditionsSchema(this.allowOptionalFields));
|
|
651
|
+
if (this.businessId && this.authToken) {
|
|
652
|
+
this.fetchData();
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
handleResponse(response, onSuccess) {
|
|
656
|
+
if (response.error) {
|
|
657
|
+
this.errorEvent.emit({
|
|
658
|
+
errorCode: ComponentErrorCodes.POST_ERROR,
|
|
659
|
+
message: response.error.message,
|
|
660
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
661
|
+
data: response.error,
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
onSuccess();
|
|
666
|
+
}
|
|
667
|
+
this.submitted.emit({ data: response, metadata: { completedStep: BusinessFormStep.termsAndConditions } });
|
|
668
|
+
}
|
|
669
|
+
async validateAndSubmit({ onSuccess }) {
|
|
670
|
+
if (this.acceptedTermsBefore) {
|
|
671
|
+
this.submitted.emit({ metadata: { completedStep: BusinessFormStep.termsAndConditions } });
|
|
672
|
+
onSuccess();
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
this.formController.validateAndSubmit(() => this.sendData(onSuccess));
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
;
|
|
679
|
+
componentDidLoad() {
|
|
680
|
+
this.formController.errors.subscribe(errors => {
|
|
681
|
+
this.errors = Object.assign({}, errors);
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
render() {
|
|
685
|
+
return (h("form", { key: 'e7eb6730d5b975ae91057a5218ed062a23d3f0ef' }, h("fieldset", { key: '9dc69375e2c988dc11c4e76f757bde1fe18febea' }, h("legend", { key: '0202cf805071e011f0c087f244c0a43191632b7c' }, "Terms and Conditions"), h("hr", { key: 'a38e7b058d4269406c929abf4f57ddcdc16aa4fd' }), h("justifi-business-terms-conditions-text", { key: '8b87b016198c87c3c52c3e280353489573aff90c' }), h("br", { key: '6c7107e3975a40e44ba4375025ebea0e811630fe' }), h("div", { key: '3667f0455c95bc0d22472598eb2ca3cd7093b9d5', class: "row-gy-3" }, h("div", { key: '1169946dc47b48cd2f8f1a2adfa9ff9b149447f1', class: "col-12" }, h("form-control-checkbox", { key: '66942238443b1e27bb3902ddeba0f6fce973b319', name: "accepted", label: "I agree to the terms and conditions", inputHandler: this.inputHandler, errorText: this.errors.accepted, disabled: this.acceptedTermsBefore, helpText: this.formHelperText }))))));
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
const LegalAddressFormStep = class {
|
|
690
|
+
constructor(hostRef) {
|
|
691
|
+
registerInstance(this, hostRef);
|
|
692
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
693
|
+
this.getBusiness = undefined;
|
|
694
|
+
this.patchBusiness = undefined;
|
|
695
|
+
this.authToken = undefined;
|
|
696
|
+
this.businessId = undefined;
|
|
697
|
+
this.allowOptionalFields = undefined;
|
|
698
|
+
}
|
|
699
|
+
propChanged() {
|
|
700
|
+
this.initializeApi();
|
|
701
|
+
}
|
|
702
|
+
async validateAndSubmit({ onSuccess }) {
|
|
703
|
+
this.coreComponent.validateAndSubmit({ onSuccess });
|
|
704
|
+
}
|
|
705
|
+
componentWillLoad() {
|
|
706
|
+
this.initializeApi();
|
|
707
|
+
}
|
|
708
|
+
initializeApi() {
|
|
709
|
+
if (this.authToken && this.businessId) {
|
|
710
|
+
this.getBusiness = makeGetBusiness({
|
|
711
|
+
authToken: this.authToken,
|
|
712
|
+
businessId: this.businessId,
|
|
713
|
+
service: new BusinessService()
|
|
714
|
+
});
|
|
715
|
+
this.patchBusiness = makePatchBusiness({
|
|
716
|
+
authToken: this.authToken,
|
|
717
|
+
businessId: this.businessId,
|
|
718
|
+
service: new BusinessService()
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
else {
|
|
722
|
+
this.errorEvent.emit({
|
|
723
|
+
message: 'Missing required props',
|
|
724
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
725
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
render() {
|
|
730
|
+
return (h("justifi-legal-address-form-step-core", { key: '7455b4950e2ca1121004943ad81537c583438738', getBusiness: this.getBusiness, patchBusiness: this.patchBusiness, allowOptionalFields: this.allowOptionalFields, ref: el => this.coreComponent = el }));
|
|
731
|
+
}
|
|
732
|
+
static get watchers() { return {
|
|
733
|
+
"authToken": ["propChanged"],
|
|
734
|
+
"businessId": ["propChanged"]
|
|
735
|
+
}; }
|
|
736
|
+
};
|
|
737
|
+
|
|
738
|
+
const PaymentProvisioningFormButtons = class {
|
|
739
|
+
constructor(hostRef) {
|
|
740
|
+
registerInstance(this, hostRef);
|
|
741
|
+
this.currentStep = undefined;
|
|
742
|
+
this.totalSteps = undefined;
|
|
743
|
+
this.formLoading = undefined;
|
|
744
|
+
this.formDisabled = undefined;
|
|
745
|
+
this.previousStepButtonOnClick = undefined;
|
|
746
|
+
this.nextStepButtonOnClick = undefined;
|
|
747
|
+
}
|
|
748
|
+
get showPreviousStepButton() {
|
|
749
|
+
return this.currentStep > 0;
|
|
750
|
+
}
|
|
751
|
+
get showNextStepButton() {
|
|
752
|
+
return this.currentStep < this.totalSteps;
|
|
753
|
+
}
|
|
754
|
+
get showSubmitButton() {
|
|
755
|
+
return this.currentStep === this.totalSteps;
|
|
756
|
+
}
|
|
757
|
+
render() {
|
|
758
|
+
return (h("div", { key: '3df3796f2bb35819373564c0002e35d14c85e360', class: 'd-flex gap-2' }, h(Button, { key: '3f8fd4e288b2eed6776c77b44dda816e8a0580cd', variant: "secondary", type: "button", onClick: () => this.previousStepButtonOnClick(), disabled: this.formDisabled, hidden: !this.showPreviousStepButton }, "Previous"), h(Button, { key: '83c7d2405d6e4f88f721a95250aa847a6999a211', variant: "primary", type: "button", onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.nextStep), disabled: this.formDisabled, isLoading: this.formLoading, hidden: !this.showNextStepButton }, "Next"), h(Button, { key: 'd87bcdc9bea52b11307e31bd1d99636be05d7156', variant: "primary", type: "submit", onClick: (e) => this.nextStepButtonOnClick(e, BusinessFormClickActions.submit), disabled: this.formDisabled, isLoading: this.formLoading, hidden: !this.showSubmitButton }, "Submit")));
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
const PaymentProvisioningFormSteps = class {
|
|
763
|
+
constructor(hostRef) {
|
|
764
|
+
registerInstance(this, hostRef);
|
|
765
|
+
this.formCompleted = createEvent(this, "formCompleted", 7);
|
|
766
|
+
this.componentStepMapping = {
|
|
767
|
+
0: () => h("justifi-business-core-info-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[0] = el, allowOptionalFields: this.allowOptionalFields }),
|
|
768
|
+
1: () => h("justifi-legal-address-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[1] = el, allowOptionalFields: this.allowOptionalFields }),
|
|
769
|
+
2: () => h("justifi-additional-questions-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[2] = el, allowOptionalFields: this.allowOptionalFields }),
|
|
770
|
+
3: () => h("justifi-business-representative-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[3] = el, allowOptionalFields: this.allowOptionalFields }),
|
|
771
|
+
4: () => h("justifi-business-owners-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[4] = el, allowOptionalFields: this.allowOptionalFields }),
|
|
772
|
+
5: () => h("justifi-business-bank-account-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[5] = el, onFormLoading: this.handleFormLoading, allowOptionalFields: this.allowOptionalFields }),
|
|
773
|
+
6: () => h("justifi-business-document-upload-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[6] = el, onFormLoading: this.handleFormLoading, allowOptionalFields: this.allowOptionalFields }),
|
|
774
|
+
7: () => h("justifi-business-terms-conditions-form-step", { businessId: this.businessId, authToken: this.authToken, ref: (el) => this.refs[7] = el, onFormLoading: this.handleFormLoading, allowOptionalFields: this.allowOptionalFields, onSubmitted: () => this.formCompleted.emit() }),
|
|
775
|
+
};
|
|
776
|
+
this.businessId = undefined;
|
|
777
|
+
this.authToken = undefined;
|
|
778
|
+
this.refs = undefined;
|
|
779
|
+
this.currentStep = undefined;
|
|
780
|
+
this.allowOptionalFields = false;
|
|
781
|
+
this.handleFormLoading = undefined;
|
|
782
|
+
}
|
|
783
|
+
get currentStepComponent() {
|
|
784
|
+
return this.componentStepMapping[this.currentStep]();
|
|
785
|
+
}
|
|
786
|
+
render() {
|
|
787
|
+
return (h("div", { key: '8f02aa3223e38cda70319c127f60e5d2f3c5abe5', class: 'col-12 mb-4' }, this.currentStepComponent));
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
|
|
791
|
+
export { AdditionalQuestionsFormStep as justifi_additional_questions_form_step, BusinessBankAccountFormStep as justifi_business_bank_account_form_step, BusinessCoreInfoFormStep as justifi_business_core_info_form_step, BusinessDocumentFormStep as justifi_business_document_upload_form_step, BusinessOwnersFormStep as justifi_business_owners_form_step, BusinessRepresentativeFormStep as justifi_business_representative_form_step, BusinessTermsConditionsFormStep as justifi_business_terms_conditions_form_step, LegalAddressFormStep as justifi_legal_address_form_step, PaymentProvisioningFormButtons as justifi_payment_provisioning_form_buttons, PaymentProvisioningFormSteps as justifi_payment_provisioning_form_steps };
|