@justifi/webcomponents 4.19.1-rc → 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-0b3db49d.js → Analytics-1ca4e47e.js} +2 -3
- package/dist/cjs/{business.service-c384784d.js → business.service-6bb7ac82.js} +5 -6
- package/dist/cjs/{get-payout-csv-51a02be7.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-39dc73ed.js → package-bc2632e4.js} +2 -4
- package/dist/cjs/{payment.service-2dbfb83d.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-37556050.js → Analytics-c51439be.js} +2 -3
- package/dist/esm/{business.service-eee46ab1.js → business.service-f45decfc.js} +5 -6
- package/dist/esm/{get-payout-csv-4d6b29d8.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-e2a7aa3f.js → package-09a354e0.js} +2 -4
- package/dist/esm/{payment.service-9005a501.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-037e67d0.js +0 -15
- package/dist/config.js +0 -11
- package/dist/esm/config-58e393e2.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-023779ee.entry.js +0 -1
- package/dist/webcomponents/p-037763f4.entry.js +0 -1
- 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-1a43e355.entry.js +0 -19
- package/dist/webcomponents/p-1f6afff9.entry.js +0 -1
- package/dist/webcomponents/p-246a6c6a.entry.js +0 -1
- package/dist/webcomponents/p-2d3b1692.entry.js +0 -1
- package/dist/webcomponents/p-30a493cd.entry.js +0 -1
- package/dist/webcomponents/p-32286934.js +0 -1
- package/dist/webcomponents/p-3f5e7e86.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-52021fa1.entry.js +0 -1
- package/dist/webcomponents/p-53e64f15.entry.js +0 -1
- package/dist/webcomponents/p-57e1f2fd.js +0 -1
- package/dist/webcomponents/p-5f095525.entry.js +0 -1
- package/dist/webcomponents/p-62b32c4c.entry.js +0 -1
- package/dist/webcomponents/p-69faef3f.entry.js +0 -1
- package/dist/webcomponents/p-6c078cd1.js +0 -1
- package/dist/webcomponents/p-8e541a32.entry.js +0 -1
- package/dist/webcomponents/p-8f325782.entry.js +0 -1
- package/dist/webcomponents/p-987b5de2.entry.js +0 -1
- package/dist/webcomponents/p-a63fc384.entry.js +0 -1
- package/dist/webcomponents/p-a8220709.entry.js +0 -1
- package/dist/webcomponents/p-ae530971.entry.js +0 -1
- package/dist/webcomponents/p-b7cf49f4.entry.js +0 -1
- package/dist/webcomponents/p-b87b27ba.js +0 -1
- package/dist/webcomponents/p-bbed6107.entry.js +0 -1
- package/dist/webcomponents/p-be39c802.entry.js +0 -1
- package/dist/webcomponents/p-c28db166.js +0 -1
- package/dist/webcomponents/p-c9f8f7ec.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-edac2b43.entry.js +0 -1
- package/dist/webcomponents/p-ef23c091.entry.js +0 -1
- package/dist/webcomponents/p-f06910aa.entry.js +0 -1
- package/dist/webcomponents/p-f0866375.entry.js +0 -1
- package/dist/webcomponents/p-f0a06884.entry.js +0 -1
- package/dist/webcomponents/p-f2f94d9f.entry.js +0 -1
- package/dist/webcomponents/p-f49b7170.entry.js +0 -1
- package/dist/webcomponents/p-fb58feb5.entry.js +0 -1
- package/dist/webcomponents/p-fe33151d.entry.js +0 -1
|
@@ -1 +1,29 @@
|
|
|
1
|
-
import{S as
|
|
1
|
+
import { S as StateOptions } from './p-6078a370.js';
|
|
2
|
+
|
|
3
|
+
function getStateAbbreviation(stateName) {
|
|
4
|
+
const state = StateOptions.find(s => s.label === stateName);
|
|
5
|
+
return state ? state.value : stateName;
|
|
6
|
+
}
|
|
7
|
+
// filterNumber is intended to be used to format a string that contains a single digit to a two digit string.
|
|
8
|
+
function filterNumber(num) {
|
|
9
|
+
if (/^\d$/.test(num)) {
|
|
10
|
+
return '0' + num;
|
|
11
|
+
}
|
|
12
|
+
return num;
|
|
13
|
+
}
|
|
14
|
+
function constructDate(year, month, day) {
|
|
15
|
+
if (!year || !month || !day) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
return `${year}-${filterNumber(month)}-${filterNumber(day)}`;
|
|
19
|
+
}
|
|
20
|
+
function deconstructDate(formInput) {
|
|
21
|
+
const dateString = formInput.value;
|
|
22
|
+
const [dob_year, dob_month, dob_day] = dateString.split('-');
|
|
23
|
+
return { dob_year, dob_month, dob_day };
|
|
24
|
+
}
|
|
25
|
+
function checkProvisioningStatus(business) {
|
|
26
|
+
return business.associated_accounts.length > 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { checkProvisioningStatus as a, constructDate as c, deconstructDate as d, filterNumber as f, getStateAbbreviation as g };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host } from './p-fad19d75.js';
|
|
2
|
+
import { E as ErrorState } from './p-dce846bf.js';
|
|
3
|
+
import { B as BusinessService } from './p-3e9ef4a8.js';
|
|
4
|
+
import { B as Business } from './p-af244664.js';
|
|
5
|
+
import { C as ComponentErrorSeverity, a as ComponentErrorCodes } from './p-14c91ffd.js';
|
|
6
|
+
import { g as getErrorMessage, a as getErrorCode } from './p-8115b2f4.js';
|
|
7
|
+
import { J as JustifiAnalytics } from './p-387450f6.js';
|
|
8
|
+
import './p-29c0b182.js';
|
|
9
|
+
import './p-1ff8810b.js';
|
|
10
|
+
import './p-6078a370.js';
|
|
11
|
+
import './p-2dabeb5a.js';
|
|
12
|
+
|
|
13
|
+
const makeGetBusiness = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
try {
|
|
16
|
+
const response = await service.fetchBusiness(id, authToken);
|
|
17
|
+
if (!response.error) {
|
|
18
|
+
onSuccess({ business: new Business(response.data) });
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
const responseError = getErrorMessage(response.error);
|
|
22
|
+
const code = getErrorCode((_a = response.error) === null || _a === void 0 ? void 0 : _a.code);
|
|
23
|
+
return onError({
|
|
24
|
+
error: responseError,
|
|
25
|
+
code,
|
|
26
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
const code = getErrorCode(error === null || error === void 0 ? void 0 : error.code);
|
|
32
|
+
return onError({
|
|
33
|
+
error: error.message || error,
|
|
34
|
+
code,
|
|
35
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const BusinessDetails = class {
|
|
41
|
+
constructor(hostRef) {
|
|
42
|
+
registerInstance(this, hostRef);
|
|
43
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
44
|
+
this.businessId = undefined;
|
|
45
|
+
this.authToken = undefined;
|
|
46
|
+
this.errorMessage = undefined;
|
|
47
|
+
this.getBusiness = undefined;
|
|
48
|
+
}
|
|
49
|
+
componentWillLoad() {
|
|
50
|
+
this.analytics = new JustifiAnalytics(this);
|
|
51
|
+
this.initializeGetBusiness();
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
this.analytics.cleanup();
|
|
55
|
+
}
|
|
56
|
+
initializeGetBusiness() {
|
|
57
|
+
if (!this.businessId || !this.authToken) {
|
|
58
|
+
this.errorMessage = 'Invalid business id or auth token';
|
|
59
|
+
this.errorEvent.emit({
|
|
60
|
+
errorCode: ComponentErrorCodes.MISSING_PROPS,
|
|
61
|
+
message: this.errorMessage,
|
|
62
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
this.getBusiness = makeGetBusiness({
|
|
67
|
+
id: this.businessId,
|
|
68
|
+
authToken: this.authToken,
|
|
69
|
+
service: new BusinessService(),
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
if (this.errorMessage) {
|
|
74
|
+
return h(Host, null, ErrorState(this.errorMessage));
|
|
75
|
+
}
|
|
76
|
+
return (h(Host, null, h("business-details-core", { getBusiness: this.getBusiness })));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export { BusinessDetails as justifi_business_details };
|
|
@@ -1 +1,213 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import { a as getRenderingRef, f as forceUpdate } from './p-fad19d75.js';
|
|
2
|
+
|
|
3
|
+
const appendToMap = (map, propName, value) => {
|
|
4
|
+
const items = map.get(propName);
|
|
5
|
+
if (!items) {
|
|
6
|
+
map.set(propName, [value]);
|
|
7
|
+
}
|
|
8
|
+
else if (!items.includes(value)) {
|
|
9
|
+
items.push(value);
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const debounce = (fn, ms) => {
|
|
13
|
+
let timeoutId;
|
|
14
|
+
return (...args) => {
|
|
15
|
+
if (timeoutId) {
|
|
16
|
+
clearTimeout(timeoutId);
|
|
17
|
+
}
|
|
18
|
+
timeoutId = setTimeout(() => {
|
|
19
|
+
timeoutId = 0;
|
|
20
|
+
fn(...args);
|
|
21
|
+
}, ms);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Check if a possible element isConnected.
|
|
27
|
+
* The property might not be there, so we check for it.
|
|
28
|
+
*
|
|
29
|
+
* We want it to return true if isConnected is not a property,
|
|
30
|
+
* otherwise we would remove these elements and would not update.
|
|
31
|
+
*
|
|
32
|
+
* Better leak in Edge than to be useless.
|
|
33
|
+
*/
|
|
34
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
35
|
+
const cleanupElements = debounce((map) => {
|
|
36
|
+
for (let key of map.keys()) {
|
|
37
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
38
|
+
}
|
|
39
|
+
}, 2000);
|
|
40
|
+
const stencilSubscription = () => {
|
|
41
|
+
if (typeof getRenderingRef !== 'function') {
|
|
42
|
+
// If we are not in a stencil project, we do nothing.
|
|
43
|
+
// This function is not really exported by @stencil/core.
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
const elmsToUpdate = new Map();
|
|
47
|
+
return {
|
|
48
|
+
dispose: () => elmsToUpdate.clear(),
|
|
49
|
+
get: (propName) => {
|
|
50
|
+
const elm = getRenderingRef();
|
|
51
|
+
if (elm) {
|
|
52
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
set: (propName) => {
|
|
56
|
+
const elements = elmsToUpdate.get(propName);
|
|
57
|
+
if (elements) {
|
|
58
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
59
|
+
}
|
|
60
|
+
cleanupElements(elmsToUpdate);
|
|
61
|
+
},
|
|
62
|
+
reset: () => {
|
|
63
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
64
|
+
cleanupElements(elmsToUpdate);
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
70
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
71
|
+
const unwrappedState = unwrap(defaultState);
|
|
72
|
+
let states = new Map(Object.entries(unwrappedState !== null && unwrappedState !== void 0 ? unwrappedState : {}));
|
|
73
|
+
const handlers = {
|
|
74
|
+
dispose: [],
|
|
75
|
+
get: [],
|
|
76
|
+
set: [],
|
|
77
|
+
reset: [],
|
|
78
|
+
};
|
|
79
|
+
const reset = () => {
|
|
80
|
+
var _a;
|
|
81
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
82
|
+
// otherwise, the state won't be properly reset
|
|
83
|
+
states = new Map(Object.entries((_a = unwrap(defaultState)) !== null && _a !== void 0 ? _a : {}));
|
|
84
|
+
handlers.reset.forEach((cb) => cb());
|
|
85
|
+
};
|
|
86
|
+
const dispose = () => {
|
|
87
|
+
// Call first dispose as resetting the state would
|
|
88
|
+
// cause less updates ;)
|
|
89
|
+
handlers.dispose.forEach((cb) => cb());
|
|
90
|
+
reset();
|
|
91
|
+
};
|
|
92
|
+
const get = (propName) => {
|
|
93
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
94
|
+
return states.get(propName);
|
|
95
|
+
};
|
|
96
|
+
const set = (propName, value) => {
|
|
97
|
+
const oldValue = states.get(propName);
|
|
98
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
99
|
+
states.set(propName, value);
|
|
100
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const state = (typeof Proxy === 'undefined'
|
|
104
|
+
? {}
|
|
105
|
+
: new Proxy(unwrappedState, {
|
|
106
|
+
get(_, propName) {
|
|
107
|
+
return get(propName);
|
|
108
|
+
},
|
|
109
|
+
ownKeys(_) {
|
|
110
|
+
return Array.from(states.keys());
|
|
111
|
+
},
|
|
112
|
+
getOwnPropertyDescriptor() {
|
|
113
|
+
return {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
has(_, propName) {
|
|
119
|
+
return states.has(propName);
|
|
120
|
+
},
|
|
121
|
+
set(_, propName, value) {
|
|
122
|
+
set(propName, value);
|
|
123
|
+
return true;
|
|
124
|
+
},
|
|
125
|
+
}));
|
|
126
|
+
const on = (eventName, callback) => {
|
|
127
|
+
handlers[eventName].push(callback);
|
|
128
|
+
return () => {
|
|
129
|
+
removeFromArray(handlers[eventName], callback);
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
const onChange = (propName, cb) => {
|
|
133
|
+
const unSet = on('set', (key, newValue) => {
|
|
134
|
+
if (key === propName) {
|
|
135
|
+
cb(newValue);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
// We need to unwrap the defaultState because it might be a function.
|
|
139
|
+
// Otherwise we might not be sending the right reset value.
|
|
140
|
+
const unReset = on('reset', () => cb(unwrap(defaultState)[propName]));
|
|
141
|
+
return () => {
|
|
142
|
+
unSet();
|
|
143
|
+
unReset();
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const use = (...subscriptions) => {
|
|
147
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
148
|
+
if (subscription.set) {
|
|
149
|
+
unsubs.push(on('set', subscription.set));
|
|
150
|
+
}
|
|
151
|
+
if (subscription.get) {
|
|
152
|
+
unsubs.push(on('get', subscription.get));
|
|
153
|
+
}
|
|
154
|
+
if (subscription.reset) {
|
|
155
|
+
unsubs.push(on('reset', subscription.reset));
|
|
156
|
+
}
|
|
157
|
+
if (subscription.dispose) {
|
|
158
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
159
|
+
}
|
|
160
|
+
return unsubs;
|
|
161
|
+
}, []);
|
|
162
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
163
|
+
};
|
|
164
|
+
const forceUpdate = (key) => {
|
|
165
|
+
const oldValue = states.get(key);
|
|
166
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
state,
|
|
170
|
+
get,
|
|
171
|
+
set,
|
|
172
|
+
on,
|
|
173
|
+
onChange,
|
|
174
|
+
use,
|
|
175
|
+
dispose,
|
|
176
|
+
reset,
|
|
177
|
+
forceUpdate,
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
const removeFromArray = (array, item) => {
|
|
181
|
+
const index = array.indexOf(item);
|
|
182
|
+
if (index >= 0) {
|
|
183
|
+
array[index] = array[array.length - 1];
|
|
184
|
+
array.length--;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
189
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
190
|
+
map.use(stencilSubscription());
|
|
191
|
+
return map;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const insuranceValuesStore = createStore({});
|
|
195
|
+
const { state: insuranceValues, on: insuranceValuesOn } = insuranceValuesStore;
|
|
196
|
+
const insuranceErrorsStore = createStore({});
|
|
197
|
+
const { state: insuranceErrors } = insuranceErrorsStore;
|
|
198
|
+
const validateInsuranceValues = () => {
|
|
199
|
+
let valid = true;
|
|
200
|
+
Object.keys(insuranceValues).forEach((key) => {
|
|
201
|
+
const noSelection = insuranceValues[key] === null;
|
|
202
|
+
if (noSelection) {
|
|
203
|
+
insuranceErrors[key] = true;
|
|
204
|
+
valid = false;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
insuranceErrors[key] = false;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
return { isValid: valid };
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export { insuranceValues as a, insuranceErrors as b, insuranceValuesOn as i, validateInsuranceValues as v };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './p-fad19d75.js';
|
|
2
|
+
import { f as formatCurrency } from './p-83125497.js';
|
|
3
|
+
import { C as ComponentErrorSeverity } from './p-14c91ffd.js';
|
|
4
|
+
import { i as insuranceValuesOn, v as validateInsuranceValues, a as insuranceValues } from './p-2338affa.js';
|
|
5
|
+
import { B as Button } from './p-9c9c7dac.js';
|
|
6
|
+
import { S as StyledHost } from './p-ba4bae6f.js';
|
|
7
|
+
import { S as Skeleton } from './p-08b0fb31.js';
|
|
8
|
+
|
|
9
|
+
class Checkout {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
Object.assign(this, data);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const checkoutCoreCss = ":host{display:block}justifi-payment-method-form{display:block;margin-left:calc(var(--jfi-layout-padding) * -1);margin-right:calc(var(--jfi-layout-padding) * -1)}.jfi-checkout-core{color:var(--jfi-body-color)}*::part(label){color:var(--jfi-form-label-color);font-family:var(--jfi-form-label-font-family);font-weight:var(--jfi-form-label-font-weight);font-size:var(--jfi-form-label-font-size);margin:var(--jfi-form-label-margin)}*::part(input){font-family:var(--jfi-layout-font-family);background-color:var(--jfi-form-control-background-color);border-color:var(--jfi-form-control-border-color);border-width:var(--jfi-form-control-border-width);border-bottom-width:var(--jfi-form-control-border-bottom-width);border-left-width:var(--jfi-form-control-border-left-width);border-right-width:var(--jfi-form-control-border-right-width);border-top-width:var(--jfi-form-control-border-top-width);border-radius:var(--jfi-form-control-border-radius);border-style:var(--jfi-form-control-border-style);box-shadow:var(--jfi-form-control-box-shadow);color:var(--jfi-form-control-color);font-size:var(--jfi-form-control-font-size);font-weight:var(--jfi-form-control-font-weight);line-height:var(--jfi-form-control-line-height);margin:var(--jfi-form-control-margin);padding:var(--jfi-form-control-padding)}*::part(input):focus{color:var(--jfi-form-control-color-focus);border-color:var(--jfi-form-control-border-color-focus);box-shadow:var(--jfi-form-control-box-shadow-focus)}*::part(input-invalid){border-color:var(--jfi-form-control-border-color-error);box-shadow:var(--jfi-form-control-box-shadow-error)}*::part(input-invalid):focus{border-color:var(--jfi-form-control-border-color-error);box-shadow:var(--jfi-form-control-box-shadow-error-focus)}*::part(invalid-feedback){color:var(--jfi-error-message-color);font-size:var(--jfi-error-message-font-size);margin:var(--jfi-error-message-margin);line-height:normal}.jfi-submit-button{font-family:var(--jfi-layout-font-family);color:var(--jfi-submit-button-color);background-color:var(--jfi-submit-button-background-color);border-color:var(--jfi-submit-button-border-color);padding:var(--jfi-submit-button-padding);font-size:var(--jfi-submit-button-font-size);border-radius:var(--jfi-submit-button-border-radius);width:var(--jfi-submit-button-width);box-shadow:var(--jfi-submit-button-box-shadow);line-height:var(--jfi-submit-button-line-height);text-transform:var(--jfi-submit-button-text-transform)}.jfi-submit-button:hover{color:var(--jfi-submit-button-color-hover);background-color:var(--jfi-submit-button-background-color-hover);border-color:var(--jfi-submit-button-border-color-hover)}.jfi-submit-button:focus{color:var(--jfi-submit-button-color-focus);background-color:var(--jfi-submit-button-background-color-focus);border-color:var(--jfi-submit-button-border-color-focus)}.btn.jfi-submit-button:active{color:var(--jfi-submit-button-color-active);background-color:var(--jfi-submit-button-background-color-active);border-color:var(--jfi-submit-button-border-color-active)}.btn.jfi-submit-button-loading{min-width:75px;color:var(--jfi-submit-button-color-loading);background-color:var(--jfi-submit-button-background-color-loading);border-color:var(--jfi-submit-button-border-color-loading)}.btn.jfi-submit-button-loading .spinner-border{border-top-color:var(--jfi-submit-button-color-loading);border-bottom-color:var(--jfi-submit-button-color-loading);border-left-color:var(--jfi-submit-button-color-loading)}";
|
|
16
|
+
const JustifiCheckoutCoreStyle0 = checkoutCoreCss;
|
|
17
|
+
|
|
18
|
+
const headerCss = ".jfi-header{color:var(--jfi-header-color);border-bottom:var(--jfi-header-border)}";
|
|
19
|
+
const JustifiCheckoutCoreStyle1 = headerCss;
|
|
20
|
+
|
|
21
|
+
const CheckoutCore = class {
|
|
22
|
+
constructor(hostRef) {
|
|
23
|
+
registerInstance(this, hostRef);
|
|
24
|
+
this.submitted = createEvent(this, "submitted", 7);
|
|
25
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
26
|
+
this.loaded = createEvent(this, "loaded", 7);
|
|
27
|
+
this.completeCheckout = async (payment) => {
|
|
28
|
+
this.complete({
|
|
29
|
+
payment,
|
|
30
|
+
onSuccess: this.onSubmitted,
|
|
31
|
+
onError: this.onError,
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
this.onSubmitted = (data) => {
|
|
35
|
+
this.submitted.emit(data);
|
|
36
|
+
this.renderState = 'success';
|
|
37
|
+
};
|
|
38
|
+
this.onError = ({ error, code, severity }) => {
|
|
39
|
+
this.serverError = error;
|
|
40
|
+
this.errorEvent.emit({
|
|
41
|
+
errorCode: code,
|
|
42
|
+
message: error,
|
|
43
|
+
severity,
|
|
44
|
+
});
|
|
45
|
+
this.renderState = 'error';
|
|
46
|
+
};
|
|
47
|
+
this.iframeOrigin = undefined;
|
|
48
|
+
this.authToken = undefined;
|
|
49
|
+
this.getCheckout = undefined;
|
|
50
|
+
this.complete = undefined;
|
|
51
|
+
this.checkoutId = undefined;
|
|
52
|
+
this.disableCreditCard = undefined;
|
|
53
|
+
this.disableBankAccount = undefined;
|
|
54
|
+
this.disableBnpl = undefined;
|
|
55
|
+
this.disablePaymentMethodGroup = undefined;
|
|
56
|
+
this.hasLoadedFonts = false;
|
|
57
|
+
this.checkout = undefined;
|
|
58
|
+
this.serverError = undefined;
|
|
59
|
+
this.renderState = 'loading';
|
|
60
|
+
this.creatingNewPaymentMethod = false;
|
|
61
|
+
this.insuranceToggled = false;
|
|
62
|
+
}
|
|
63
|
+
async fillBillingForm(fields) {
|
|
64
|
+
this.paymentMethodOptionsRef.fillBillingForm(fields);
|
|
65
|
+
}
|
|
66
|
+
componentWillLoad() {
|
|
67
|
+
console.log('CheckoutCore: componentWillLoad iframeOrigin', this, this.iframeOrigin);
|
|
68
|
+
if (this.getCheckout) {
|
|
69
|
+
this.fetchData();
|
|
70
|
+
// Refresh the checkout data when insurance is added or removed
|
|
71
|
+
insuranceValuesOn('set', (key) => {
|
|
72
|
+
const value = insuranceValues[key];
|
|
73
|
+
if (value !== undefined) {
|
|
74
|
+
this.insuranceToggled = value;
|
|
75
|
+
this.fetchData();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
fetchData() {
|
|
81
|
+
this.renderState = 'loading';
|
|
82
|
+
this.getCheckout({
|
|
83
|
+
onSuccess: ({ checkout }) => {
|
|
84
|
+
this.checkout = new Checkout(checkout);
|
|
85
|
+
const { status } = this.checkout;
|
|
86
|
+
this.loaded.emit({ checkout_status: status });
|
|
87
|
+
this.renderState = 'success';
|
|
88
|
+
},
|
|
89
|
+
onError: ({ error, code, severity }) => {
|
|
90
|
+
this.serverError = error;
|
|
91
|
+
this.renderState = 'error';
|
|
92
|
+
this.errorEvent.emit({
|
|
93
|
+
errorCode: code,
|
|
94
|
+
message: error,
|
|
95
|
+
severity,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
;
|
|
101
|
+
async submit(event) {
|
|
102
|
+
var _a;
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
this.renderState = 'loading';
|
|
105
|
+
const insuranceValidation = validateInsuranceValues();
|
|
106
|
+
const payload = await this.paymentMethodOptionsRef.resolvePaymentMethod(insuranceValidation);
|
|
107
|
+
if (payload.validationError) {
|
|
108
|
+
this.renderState = 'error';
|
|
109
|
+
}
|
|
110
|
+
else if (payload.error) {
|
|
111
|
+
this.renderState = 'error';
|
|
112
|
+
this.serverError = payload.error.message;
|
|
113
|
+
this.onError({
|
|
114
|
+
code: payload.error.code,
|
|
115
|
+
error: payload.error.message,
|
|
116
|
+
severity: ComponentErrorSeverity.ERROR,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
else if (payload.token) {
|
|
120
|
+
this.completeCheckout({ payment_mode: 'ecom', payment_token: payload.token });
|
|
121
|
+
}
|
|
122
|
+
else if (((_a = payload.bnpl) === null || _a === void 0 ? void 0 : _a.status) === 'success') {
|
|
123
|
+
this.completeCheckout({ payment_mode: 'bnpl' });
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
this.renderState = 'error';
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
get isLoading() {
|
|
130
|
+
return this.renderState === 'loading';
|
|
131
|
+
}
|
|
132
|
+
get isError() {
|
|
133
|
+
return this.renderState === 'error';
|
|
134
|
+
}
|
|
135
|
+
get paymentType() {
|
|
136
|
+
var _a, _b, _c, _d, _e;
|
|
137
|
+
return (h("section", null, h("div", { class: !this.isLoading && 'visually-hidden' }, h(Skeleton, { variant: "rounded", height: "300px" })), h("div", { class: this.isLoading && 'visually-hidden' }, h("justifi-payment-method-options", { ref: (el) => (this.paymentMethodOptionsRef = el), "show-card": !this.disableCreditCard, "show-ach": !this.disableBankAccount, "show-bnpl": !this.disableBnpl, paymentMethodGroupId: (_a = this.checkout) === null || _a === void 0 ? void 0 : _a.payment_method_group_id, "show-saved-payment-methods": !this.disablePaymentMethodGroup, bnpl: (_b = this.checkout) === null || _b === void 0 ? void 0 : _b.bnpl, authToken: this.authToken, "account-id": (_c = this.checkout) === null || _c === void 0 ? void 0 : _c.account_id, savedPaymentMethods: ((_d = this.checkout) === null || _d === void 0 ? void 0 : _d.payment_methods) || [], paymentAmount: (_e = this.checkout) === null || _e === void 0 ? void 0 : _e.payment_amount, insuranceToggled: this.insuranceToggled }))));
|
|
138
|
+
}
|
|
139
|
+
get summary() {
|
|
140
|
+
var _a, _b;
|
|
141
|
+
return (h("section", null, h("div", { class: !this.isLoading && 'visually-hidden' }, h(Skeleton, { height: "24px" })), h("div", { class: this.isLoading && 'visually-hidden' }, h("div", { class: "jfi-payment-description" }, (_a = this.checkout) === null || _a === void 0 ? void 0 : _a.payment_description), h("div", { class: "jfi-payment-total" }, h("span", { class: "jfi-payment-total-label" }, "Total"), "\u00A0", h("span", { class: "jfi-payment-total-amount" }, formatCurrency(+((_b = this.checkout) === null || _b === void 0 ? void 0 : _b.total_amount)))))));
|
|
142
|
+
}
|
|
143
|
+
render() {
|
|
144
|
+
return (h(StyledHost, { key: '991ae6970e426028ace0d1e8327119bc197639b0' }, h("div", { key: '1e57ee21429b494240e644235a2d5815ced99d43', class: "row gy-3 jfi-checkout-core" }, h("div", { key: '70023ce10dea6ff8d5bd8e30c7d474f774682c65', class: "col-12" }, h("h2", { key: '8b09b03c1998e4d60e174fefb3d196e48d50b84a', class: "fs-5 fw-bold pb-3 jfi-header" }, "Summary"), this.summary), h("div", { key: 'e3bbdaaaf010451a31fe9c60bdf81e89bdd142f2', class: "col-12" }, h("slot", { key: '442a01184960f42b5e1f6694798633d3e7219bf5', name: "insurance" })), h("div", { key: '716e26e3dc675e9d72a3a992b1cb212ce48ffb1a', class: "col-12 mt-4" }, h("h2", { key: '762cfc8549b20d16583d0fd8748bde8035042c00', class: "fs-5 fw-bold pb-3 jfi-header" }, "Payment"), h("h3", { key: 'f07d716a87f3e2bd44471f7e93f7af5f5d20440e', class: "fs-6 fw-bold lh-lg" }, "Select payment type"), h("div", { key: '1156291dd748b90d64a08916ffb98c3123132175', class: "d-flex flex-column" }, this.paymentType)), h("div", { key: 'a5bd142a1c72c5abb29338a2cf24c180119d4ea7', class: "col-12" }, h("div", { key: '5a94ed9d54fd3dd24cfe3e34c23ee3c4995eca6d', class: "d-flex justify-content-end" }, h(Button, { key: '7fce3940d8fe562aa7c23e38201b5d2924157288', type: "submit", variant: "primary", onClick: (e) => this.submit(e), disabled: this.isLoading, isLoading: this.isLoading, style: { width: '100%' } }, "Pay"))))));
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
CheckoutCore.style = JustifiCheckoutCoreStyle0 + JustifiCheckoutCoreStyle1;
|
|
148
|
+
|
|
149
|
+
export { CheckoutCore as justifi_checkout_core };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h } from './p-fad19d75.js';
|
|
2
|
+
import { a as BusinessFormClickActions } from './p-d89bad72.js';
|
|
3
|
+
import { a as ComponentErrorCodes, C as ComponentErrorSeverity } from './p-14c91ffd.js';
|
|
4
|
+
import { a as checkProvisioningStatus } from './p-1ff8810b.js';
|
|
5
|
+
import { S as StyledHost } from './p-ba4bae6f.js';
|
|
6
|
+
import './p-6078a370.js';
|
|
7
|
+
|
|
8
|
+
const PaymentProvisioningCore = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.clickEvent = createEvent(this, "click-event", 7);
|
|
12
|
+
this.errorEvent = createEvent(this, "error-event", 7);
|
|
13
|
+
this.submitted = createEvent(this, "submitted", 7);
|
|
14
|
+
this.setBusinessProvisioned = () => {
|
|
15
|
+
this.getBusiness({
|
|
16
|
+
onSuccess: (response) => {
|
|
17
|
+
this.businessProvisioned = checkProvisioningStatus(response.data);
|
|
18
|
+
if (this.businessProvisioned) {
|
|
19
|
+
this.errorEvent.emit({
|
|
20
|
+
message: 'A request to provision payments for this business has already been submitted.',
|
|
21
|
+
errorCode: ComponentErrorCodes.PROVISIONING_REQUESTED,
|
|
22
|
+
severity: ComponentErrorSeverity.INFO,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
onError: ({ error, code, severity }) => {
|
|
27
|
+
this.errorEvent.emit({
|
|
28
|
+
message: error,
|
|
29
|
+
errorCode: code,
|
|
30
|
+
severity: severity
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
this.postProvisioningData = () => {
|
|
36
|
+
this.postProvisioning({
|
|
37
|
+
onSuccess: (response) => {
|
|
38
|
+
this.submitted.emit({ data: { response } });
|
|
39
|
+
},
|
|
40
|
+
onError: ({ error, code, severity }) => {
|
|
41
|
+
this.submitted.emit({ data: { error } });
|
|
42
|
+
this.errorEvent.emit({
|
|
43
|
+
message: error,
|
|
44
|
+
errorCode: code,
|
|
45
|
+
severity: severity
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
this.refs = [];
|
|
51
|
+
this.incrementSteps = () => {
|
|
52
|
+
if (this.currentStep < this.totalSteps) {
|
|
53
|
+
return this.currentStep++;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.decrementSteps = () => { return this.currentStep--; };
|
|
57
|
+
this.previousStepButtonOnClick = () => {
|
|
58
|
+
this.clickEvent.emit({ name: BusinessFormClickActions.previousStep });
|
|
59
|
+
this.decrementSteps();
|
|
60
|
+
};
|
|
61
|
+
this.nextStepButtonOnClick = (e, clickEventName) => {
|
|
62
|
+
e.preventDefault();
|
|
63
|
+
this.clickEvent.emit({ name: clickEventName });
|
|
64
|
+
const currentStep = this.refs[this.currentStep];
|
|
65
|
+
currentStep.validateAndSubmit({ onSuccess: this.incrementSteps });
|
|
66
|
+
};
|
|
67
|
+
this.loading = false;
|
|
68
|
+
this.businessProvisioned = false;
|
|
69
|
+
this.currentStep = 0;
|
|
70
|
+
this.errorMessage = undefined;
|
|
71
|
+
this.businessId = undefined;
|
|
72
|
+
this.authToken = undefined;
|
|
73
|
+
this.allowOptionalFields = false;
|
|
74
|
+
this.formTitle = undefined;
|
|
75
|
+
this.getBusiness = undefined;
|
|
76
|
+
this.postProvisioning = undefined;
|
|
77
|
+
}
|
|
78
|
+
componentWillLoad() {
|
|
79
|
+
this.getBusiness && this.setBusinessProvisioned();
|
|
80
|
+
this.refs = [this.coreInfoRef, this.legalAddressRef, this.additionalQuestionsRef, this.representativeRef, this.ownersRef, this.bankAccountRef, this.documentUploadRef, this.termsRef];
|
|
81
|
+
}
|
|
82
|
+
get businessEndpoint() {
|
|
83
|
+
return `entities/business/${this.businessId}`;
|
|
84
|
+
}
|
|
85
|
+
get formDisabled() {
|
|
86
|
+
return this.loading || this.businessProvisioned;
|
|
87
|
+
}
|
|
88
|
+
get totalSteps() {
|
|
89
|
+
return this.refs.length - 1;
|
|
90
|
+
}
|
|
91
|
+
get stepCounter() {
|
|
92
|
+
return `${this.currentStep + 1} of ${this.totalSteps + 1}`;
|
|
93
|
+
}
|
|
94
|
+
handleFormLoading(event) {
|
|
95
|
+
this.loading = event.detail;
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
return (h(StyledHost, { key: '80f2730a6a4e273391888b086c3633a3dec012b8', exportparts: 'label,input,input-invalid' }, h("div", { key: 'b4e7be2fed14b404ee7bcbe42c3c1c54bb78fdb6', class: 'row gap-3' }, h("h1", { key: 'f477beb7934a94a74dfc6b8a9c18cc54a720f70e' }, this.formTitle), h("justifi-payment-provisioning-form-steps", { key: 'e74aa3a01cfe7550f4917d28ccda1aca211d9394', businessId: this.businessId, authToken: this.authToken, refs: this.refs, currentStep: this.currentStep, allowOptionalFields: this.allowOptionalFields, handleFormLoading: this.handleFormLoading, onFormCompleted: () => this.postProvisioningData() }), h("div", { key: '26a585ec4b6b677cb01ac17696269168887f4c76', class: 'd-flex justify-content-between align-items-center' }, h("div", { key: 'ca5ddc176f8c2eb3315620076b401e47f45039bd', class: 'd-flex align-items-center' }, this.stepCounter), h("justifi-payment-provisioning-form-buttons", { key: '8299387bf859b33c829d29d66947c3c053ffa53c', currentStep: this.currentStep, totalSteps: this.totalSteps, formLoading: this.loading, formDisabled: this.formDisabled, previousStepButtonOnClick: this.previousStepButtonOnClick, nextStepButtonOnClick: this.nextStepButtonOnClick })))));
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export { PaymentProvisioningCore as justifi_payment_provisioning_core };
|