@justifi/webcomponents 4.7.5 → 4.7.6
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/additional-questions-details_5.cjs.entry.js +2 -2
- package/dist/cjs/form-control-datepart_2.cjs.entry.js +1 -1
- package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
- package/dist/cjs/form-control-number_3.cjs.entry.js +1 -1
- package/dist/cjs/{index-4286ac32.js → index-55950669.js} +31 -1
- package/dist/cjs/justifi-additional-questions_6.cjs.entry.js +1 -1
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js +1 -1
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +25 -12
- package/dist/cjs/justifi-business-form.cjs.entry.js +18 -7
- package/dist/cjs/justifi-business-list.cjs.entry.js +1 -1
- package/dist/cjs/justifi-card-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +3 -3
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +3 -3
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +1 -1
- package/dist/cjs/justifi-refund-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +3 -3
- package/dist/cjs/justifi-table_2.cjs.entry.js +33 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/select-input_2.cjs.entry.js +1 -1
- package/dist/cjs/subaccount-account-details_4.cjs.entry.js +2 -2
- package/dist/cjs/subaccount-bank-details.cjs.entry.js +2 -2
- package/dist/cjs/subaccount-terms-details.cjs.entry.js +2 -2
- package/dist/cjs/{helpers-b254d050.js → utils-931f4879.js} +8 -0
- package/dist/cjs/{utils-a2ee48ca.js → utils-99c086ee.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/components/business-form/business-form-stepped.js +40 -25
- package/dist/collection/components/business-form/business-form.css +95 -0
- package/dist/collection/components/business-form/business-form.js +35 -4
- package/dist/collection/components/form/utils.js +2 -0
- package/dist/collection/components/payments-list/payments-list.js +2 -2
- package/dist/collection/components/payouts-list/payouts-list.js +2 -2
- package/dist/collection/components/subaccounts-list/subaccounts-list.js +2 -2
- package/dist/collection/components/table/table.js +22 -29
- package/dist/collection/components/table/test/table.spec.js +29 -13
- package/dist/collection/components/table/utils.js +4 -0
- package/dist/docs.json +33 -28
- package/dist/esm/additional-questions-details_5.entry.js +2 -2
- package/dist/esm/form-control-datepart_2.entry.js +1 -1
- package/dist/esm/form-control-monetary.entry.js +1 -1
- package/dist/esm/form-control-number_3.entry.js +1 -1
- package/dist/esm/{index-ff8194f9.js → index-62b8aa8a.js} +31 -1
- package/dist/esm/justifi-additional-questions_6.entry.js +1 -1
- package/dist/esm/justifi-bank-account-form.entry.js +1 -1
- package/dist/esm/justifi-billing-form_2.entry.js +1 -1
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form-stepped.entry.js +24 -11
- package/dist/esm/justifi-business-form.entry.js +17 -6
- package/dist/esm/justifi-business-list.entry.js +1 -1
- package/dist/esm/justifi-card-form.entry.js +1 -1
- package/dist/esm/justifi-details.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-payment-balance-transactions.entry.js +1 -1
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-form.entry.js +1 -1
- package/dist/esm/justifi-payment-method-form.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +3 -3
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +3 -3
- package/dist/esm/justifi-proceeds-list.entry.js +1 -1
- package/dist/esm/justifi-refund-form.entry.js +1 -1
- package/dist/esm/justifi-subaccount-details.entry.js +2 -2
- package/dist/esm/justifi-subaccounts-list.entry.js +3 -3
- package/dist/esm/justifi-table_2.entry.js +33 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/select-input_2.entry.js +1 -1
- package/dist/esm/subaccount-account-details_4.entry.js +2 -2
- package/dist/esm/subaccount-bank-details.entry.js +2 -2
- package/dist/esm/subaccount-terms-details.entry.js +2 -2
- package/dist/{module/helpers.js → esm/utils-8cc130a9.js} +8 -1
- package/dist/esm/{utils-7c6bd149.js → utils-f33f7e3c.js} +1 -1
- package/dist/esm/webcomponents.js +3 -3
- package/dist/module/justifi-business-form-stepped.js +26 -12
- package/dist/module/justifi-business-form.js +20 -6
- package/dist/module/justifi-payments-list.js +2 -2
- package/dist/module/justifi-payouts-list.js +2 -2
- package/dist/module/justifi-subaccounts-list.js +2 -2
- package/dist/module/payment-method-form.js +1 -1
- package/dist/module/table.js +33 -30
- package/dist/{esm/helpers-d8a6a0f1.js → module/utils3.js} +8 -1
- package/dist/types/components/business-form/business-form-stepped.d.ts +6 -2
- package/dist/types/components/business-form/business-form.d.ts +5 -0
- package/dist/types/components/form/utils.d.ts +1 -0
- package/dist/types/components/table/table.d.ts +3 -4
- package/dist/types/components/table/utils.d.ts +3 -0
- package/dist/types/components.d.ts +4 -2
- package/dist/webcomponents/{p-04817850.entry.js → p-0a0cf2e6.entry.js} +1 -1
- package/dist/webcomponents/{p-862f38cc.entry.js → p-0a1347cf.entry.js} +1 -1
- package/dist/webcomponents/{p-210677e3.js → p-0f3e9483.js} +1 -1
- package/dist/webcomponents/p-0fa49c38.entry.js +1 -0
- package/dist/webcomponents/{p-8302a5e2.entry.js → p-2b2f8162.entry.js} +1 -1
- package/dist/webcomponents/{p-b2dc938f.entry.js → p-34c30022.entry.js} +1 -1
- package/dist/webcomponents/{p-0f5206f0.entry.js → p-40fb25c6.entry.js} +1 -1
- package/dist/webcomponents/{p-0a351e24.entry.js → p-45d2761d.entry.js} +1 -1
- package/dist/webcomponents/p-4f14df36.js +2 -0
- package/dist/webcomponents/{p-c8916484.entry.js → p-525adabf.entry.js} +1 -1
- package/dist/webcomponents/{p-d84cd3a5.entry.js → p-57aab065.entry.js} +1 -1
- package/dist/webcomponents/{p-2ea68b03.entry.js → p-5a502ceb.entry.js} +1 -1
- package/dist/webcomponents/p-5bf0ac1a.entry.js +1 -0
- package/dist/webcomponents/{p-dd4e8fa1.entry.js → p-64a5126c.entry.js} +1 -1
- package/dist/webcomponents/{p-34430db2.entry.js → p-6e80f063.entry.js} +1 -1
- package/dist/webcomponents/{p-57efe345.entry.js → p-85ddbe82.entry.js} +1 -1
- package/dist/webcomponents/{p-2cab231e.entry.js → p-8bbb1b10.entry.js} +1 -1
- package/dist/webcomponents/p-90926321.js +1 -0
- package/dist/webcomponents/{p-22c2a11e.entry.js → p-9ba0be02.entry.js} +1 -1
- package/dist/webcomponents/{p-650eb614.entry.js → p-9cec4a27.entry.js} +1 -1
- package/dist/webcomponents/{p-42bc8e53.entry.js → p-9e0d2179.entry.js} +1 -1
- package/dist/webcomponents/{p-377303af.entry.js → p-ac8be2a8.entry.js} +1 -1
- package/dist/webcomponents/{p-439a79c7.entry.js → p-bd099662.entry.js} +1 -1
- package/dist/webcomponents/{p-33e74da7.entry.js → p-c43e29ac.entry.js} +1 -1
- package/dist/webcomponents/p-c4826a33.entry.js +1 -0
- package/dist/webcomponents/{p-0ad353cc.entry.js → p-c63a98f6.entry.js} +1 -1
- package/dist/webcomponents/{p-cb5352a3.entry.js → p-c950901c.entry.js} +1 -1
- package/dist/webcomponents/p-d4755024.entry.js +1 -0
- package/dist/webcomponents/{p-cf656598.entry.js → p-d8835e7a.entry.js} +1 -1
- package/dist/webcomponents/p-e8e109bd.entry.js +1 -0
- package/dist/webcomponents/{p-e8f41c84.entry.js → p-ead8cfc2.entry.js} +1 -1
- package/dist/webcomponents/{p-c8099443.entry.js → p-f74899b9.entry.js} +1 -1
- package/dist/webcomponents/{p-68427454.entry.js → p-f9183f12.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- package/dist/webcomponents/p-173fb8ef.entry.js +0 -1
- package/dist/webcomponents/p-59ecc2d7.entry.js +0 -1
- package/dist/webcomponents/p-7d922421.entry.js +0 -1
- package/dist/webcomponents/p-bedada09.js +0 -1
- package/dist/webcomponents/p-da00d9bf.js +0 -2
- package/dist/webcomponents/p-df8f6a0f.entry.js +0 -1
- package/dist/webcomponents/p-e9589e45.entry.js +0 -1
|
@@ -7727,6 +7727,101 @@ progress {
|
|
|
7727
7727
|
display: none !important;
|
|
7728
7728
|
}
|
|
7729
7729
|
}
|
|
7730
|
+
.alert {
|
|
7731
|
+
--bs-alert-bg: transparent;
|
|
7732
|
+
--bs-alert-padding-x: 1rem;
|
|
7733
|
+
--bs-alert-padding-y: 1rem;
|
|
7734
|
+
--bs-alert-margin-bottom: 1rem;
|
|
7735
|
+
--bs-alert-color: inherit;
|
|
7736
|
+
--bs-alert-border-color: transparent;
|
|
7737
|
+
--bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
|
|
7738
|
+
--bs-alert-border-radius: var(--bs-border-radius);
|
|
7739
|
+
--bs-alert-link-color: inherit;
|
|
7740
|
+
position: relative;
|
|
7741
|
+
padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
|
|
7742
|
+
margin-bottom: var(--bs-alert-margin-bottom);
|
|
7743
|
+
color: var(--bs-alert-color);
|
|
7744
|
+
background-color: var(--bs-alert-bg);
|
|
7745
|
+
border: var(--bs-alert-border);
|
|
7746
|
+
border-radius: var(--bs-alert-border-radius);
|
|
7747
|
+
}
|
|
7748
|
+
|
|
7749
|
+
.alert-heading {
|
|
7750
|
+
color: inherit;
|
|
7751
|
+
}
|
|
7752
|
+
|
|
7753
|
+
.alert-link {
|
|
7754
|
+
font-weight: 700;
|
|
7755
|
+
color: var(--bs-alert-link-color);
|
|
7756
|
+
}
|
|
7757
|
+
|
|
7758
|
+
.alert-dismissible {
|
|
7759
|
+
padding-right: 3rem;
|
|
7760
|
+
}
|
|
7761
|
+
.alert-dismissible .btn-close {
|
|
7762
|
+
position: absolute;
|
|
7763
|
+
top: 0;
|
|
7764
|
+
right: 0;
|
|
7765
|
+
z-index: 2;
|
|
7766
|
+
padding: 1.25rem 1rem;
|
|
7767
|
+
}
|
|
7768
|
+
|
|
7769
|
+
.alert-primary {
|
|
7770
|
+
--bs-alert-color: var(--bs-primary-text-emphasis);
|
|
7771
|
+
--bs-alert-bg: var(--bs-primary-bg-subtle);
|
|
7772
|
+
--bs-alert-border-color: var(--bs-primary-border-subtle);
|
|
7773
|
+
--bs-alert-link-color: var(--bs-primary-text-emphasis);
|
|
7774
|
+
}
|
|
7775
|
+
|
|
7776
|
+
.alert-secondary {
|
|
7777
|
+
--bs-alert-color: var(--bs-secondary-text-emphasis);
|
|
7778
|
+
--bs-alert-bg: var(--bs-secondary-bg-subtle);
|
|
7779
|
+
--bs-alert-border-color: var(--bs-secondary-border-subtle);
|
|
7780
|
+
--bs-alert-link-color: var(--bs-secondary-text-emphasis);
|
|
7781
|
+
}
|
|
7782
|
+
|
|
7783
|
+
.alert-success {
|
|
7784
|
+
--bs-alert-color: var(--bs-success-text-emphasis);
|
|
7785
|
+
--bs-alert-bg: var(--bs-success-bg-subtle);
|
|
7786
|
+
--bs-alert-border-color: var(--bs-success-border-subtle);
|
|
7787
|
+
--bs-alert-link-color: var(--bs-success-text-emphasis);
|
|
7788
|
+
}
|
|
7789
|
+
|
|
7790
|
+
.alert-info {
|
|
7791
|
+
--bs-alert-color: var(--bs-info-text-emphasis);
|
|
7792
|
+
--bs-alert-bg: var(--bs-info-bg-subtle);
|
|
7793
|
+
--bs-alert-border-color: var(--bs-info-border-subtle);
|
|
7794
|
+
--bs-alert-link-color: var(--bs-info-text-emphasis);
|
|
7795
|
+
}
|
|
7796
|
+
|
|
7797
|
+
.alert-warning {
|
|
7798
|
+
--bs-alert-color: var(--bs-warning-text-emphasis);
|
|
7799
|
+
--bs-alert-bg: var(--bs-warning-bg-subtle);
|
|
7800
|
+
--bs-alert-border-color: var(--bs-warning-border-subtle);
|
|
7801
|
+
--bs-alert-link-color: var(--bs-warning-text-emphasis);
|
|
7802
|
+
}
|
|
7803
|
+
|
|
7804
|
+
.alert-danger {
|
|
7805
|
+
--bs-alert-color: var(--bs-danger-text-emphasis);
|
|
7806
|
+
--bs-alert-bg: var(--bs-danger-bg-subtle);
|
|
7807
|
+
--bs-alert-border-color: var(--bs-danger-border-subtle);
|
|
7808
|
+
--bs-alert-link-color: var(--bs-danger-text-emphasis);
|
|
7809
|
+
}
|
|
7810
|
+
|
|
7811
|
+
.alert-light {
|
|
7812
|
+
--bs-alert-color: var(--bs-light-text-emphasis);
|
|
7813
|
+
--bs-alert-bg: var(--bs-light-bg-subtle);
|
|
7814
|
+
--bs-alert-border-color: var(--bs-light-border-subtle);
|
|
7815
|
+
--bs-alert-link-color: var(--bs-light-text-emphasis);
|
|
7816
|
+
}
|
|
7817
|
+
|
|
7818
|
+
.alert-dark {
|
|
7819
|
+
--bs-alert-color: var(--bs-dark-text-emphasis);
|
|
7820
|
+
--bs-alert-bg: var(--bs-dark-bg-subtle);
|
|
7821
|
+
--bs-alert-border-color: var(--bs-dark-border-subtle);
|
|
7822
|
+
--bs-alert-link-color: var(--bs-dark-text-emphasis);
|
|
7823
|
+
}
|
|
7824
|
+
|
|
7730
7825
|
:host {
|
|
7731
7826
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
7732
7827
|
font-size: 1rem;
|
|
@@ -4,16 +4,26 @@ import businessFormSchema from "./business-form-schema";
|
|
|
4
4
|
import { Api } from "../../api";
|
|
5
5
|
import { parseForPatching } from "./helpers";
|
|
6
6
|
import { config } from "../../../config";
|
|
7
|
+
import { FormAlert } from "../form/utils";
|
|
7
8
|
/**
|
|
8
9
|
* @exportedPart label: Label for inputs
|
|
9
10
|
* @exportedPart input: The input fields
|
|
10
11
|
* @exportedPart input-invalid: Invalid state for inputfs
|
|
11
12
|
*/
|
|
12
13
|
export class BusinessForm {
|
|
14
|
+
get submitDisabled() {
|
|
15
|
+
return !this.authToken || this.isLoading || this.serverError;
|
|
16
|
+
}
|
|
17
|
+
get showErrors() {
|
|
18
|
+
return this.serverError && !this.hideErrors;
|
|
19
|
+
}
|
|
13
20
|
constructor() {
|
|
14
21
|
this.authToken = undefined;
|
|
15
22
|
this.businessId = undefined;
|
|
23
|
+
this.hideErrors = undefined;
|
|
16
24
|
this.isLoading = false;
|
|
25
|
+
this.serverError = false;
|
|
26
|
+
this.errorMessage = '';
|
|
17
27
|
this.sendData = this.sendData.bind(this);
|
|
18
28
|
this.fetchData = this.fetchData.bind(this);
|
|
19
29
|
}
|
|
@@ -50,7 +60,8 @@ export class BusinessForm {
|
|
|
50
60
|
}
|
|
51
61
|
}
|
|
52
62
|
catch (error) {
|
|
53
|
-
|
|
63
|
+
this.serverError = true;
|
|
64
|
+
this.errorMessage = error.message;
|
|
54
65
|
}
|
|
55
66
|
finally {
|
|
56
67
|
this.isLoading = false;
|
|
@@ -63,7 +74,8 @@ export class BusinessForm {
|
|
|
63
74
|
this.formController.setInitialValues(response.data);
|
|
64
75
|
}
|
|
65
76
|
catch (error) {
|
|
66
|
-
|
|
77
|
+
this.serverError = true;
|
|
78
|
+
this.errorMessage = `Error fetching data: ${error.message}`;
|
|
67
79
|
}
|
|
68
80
|
finally {
|
|
69
81
|
this.isLoading = false;
|
|
@@ -74,7 +86,7 @@ export class BusinessForm {
|
|
|
74
86
|
this.formController.validateAndSubmit(this.sendData);
|
|
75
87
|
}
|
|
76
88
|
render() {
|
|
77
|
-
return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: event => this.validateAndSubmit(event) }, h("div", { class: "row gap-3" }, h("div", { class: "col-12 mb-4" }, h("h1", null, "Business Information")), h("div", { class: "col-12 mb-4" }, h("justifi-business-generic-info", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-legal-address-form", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-additional-questions", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-representative", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-owners", { isEditing: !!this.businessId, formController: this.formController })), h("div", { class: "col-12 d-flex flex-row-reverse" }, h("button", { type: "submit", class: "btn btn-primary jfi-submit-button", disabled:
|
|
89
|
+
return (h(Host, { exportparts: "label,input,input-invalid" }, h("form", { onSubmit: event => this.validateAndSubmit(event) }, h("div", { class: "row gap-3" }, h("div", { class: "col-12 mb-4" }, h("h1", null, "Business Information")), this.showErrors && FormAlert(this.errorMessage), h("div", { class: "col-12 mb-4" }, h("justifi-business-generic-info", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-legal-address-form", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-additional-questions", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-representative", { formController: this.formController })), h("div", { class: "col-12 mb-4" }, h("justifi-business-owners", { isEditing: !!this.businessId, formController: this.formController })), h("div", { class: "col-12 d-flex flex-row-reverse" }, h("button", { type: "submit", class: "btn btn-primary jfi-submit-button", disabled: this.submitDisabled }, this.isLoading ? 'Loading...' : 'Submit'))))));
|
|
78
90
|
}
|
|
79
91
|
static get is() { return "justifi-business-form"; }
|
|
80
92
|
static get originalStyleUrls() {
|
|
@@ -122,12 +134,31 @@ export class BusinessForm {
|
|
|
122
134
|
},
|
|
123
135
|
"attribute": "business-id",
|
|
124
136
|
"reflect": false
|
|
137
|
+
},
|
|
138
|
+
"hideErrors": {
|
|
139
|
+
"type": "boolean",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "boolean",
|
|
143
|
+
"resolved": "boolean",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": true,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": ""
|
|
151
|
+
},
|
|
152
|
+
"attribute": "hide-errors",
|
|
153
|
+
"reflect": false
|
|
125
154
|
}
|
|
126
155
|
};
|
|
127
156
|
}
|
|
128
157
|
static get states() {
|
|
129
158
|
return {
|
|
130
|
-
"isLoading": {}
|
|
159
|
+
"isLoading": {},
|
|
160
|
+
"serverError": {},
|
|
161
|
+
"errorMessage": {}
|
|
131
162
|
};
|
|
132
163
|
}
|
|
133
164
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const FormAlert = (message) => (h("div", { class: 'alert alert-danger d-flex align-items-center', role: 'alert' }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", class: "bi bi-exclamation-triangle-fill flex-shrink-0 me-2", viewBox: "0 0 16 16", role: "img", "aria-label": "Warning:" }, h("path", { d: "M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" })), h("div", null, message)));
|
|
@@ -97,8 +97,8 @@ export class PaymentsList {
|
|
|
97
97
|
{
|
|
98
98
|
type: 'head',
|
|
99
99
|
value: `
|
|
100
|
-
<div>${formatDate(payment.created_at)}</div>
|
|
101
|
-
<div>${formatTime(payment.created_at)}</div>
|
|
100
|
+
<div class='fw-bold'>${formatDate(payment.created_at)}</div>
|
|
101
|
+
<div class='fw-bold'>${formatTime(payment.created_at)}</div>
|
|
102
102
|
`,
|
|
103
103
|
},
|
|
104
104
|
formatCurrency(payment.amount),
|
|
@@ -117,8 +117,8 @@ export class PayoutsList {
|
|
|
117
117
|
{
|
|
118
118
|
type: 'head',
|
|
119
119
|
value: `
|
|
120
|
-
<div>${formatDate(payout.created_at)}</div>
|
|
121
|
-
<div>${formatTime(payout.created_at)}</div>
|
|
120
|
+
<div class='fw-bold'>${formatDate(payout.created_at)}</div>
|
|
121
|
+
<div class='fw-bold'>${formatTime(payout.created_at)}</div>
|
|
122
122
|
`,
|
|
123
123
|
},
|
|
124
124
|
payout.payout_type,
|
|
@@ -67,8 +67,8 @@ export class SubaccountsList {
|
|
|
67
67
|
{
|
|
68
68
|
type: 'head',
|
|
69
69
|
value: `
|
|
70
|
-
<div>${subaccount.dateString}</div>
|
|
71
|
-
<div>${subaccount.timeString}</div>
|
|
70
|
+
<div class='fw-bold'>${subaccount.dateString}</div>
|
|
71
|
+
<div class='fw-bold'>${subaccount.timeString}</div>
|
|
72
72
|
`,
|
|
73
73
|
},
|
|
74
74
|
subaccount.name,
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
2
|
import { ExtendedPagingDefaults } from "../../api/Pagination";
|
|
3
3
|
import { tableExportedParts } from "./exported-parts";
|
|
4
|
+
import { EmptyState, ErrorState, LoadingState } from "./utils";
|
|
4
5
|
export class Table {
|
|
5
6
|
constructor() {
|
|
6
|
-
this.emptyState = () => {
|
|
7
|
-
var _a;
|
|
8
|
-
return (h("tr", null, h("td", { class: "empty-state", part: "empty-state", colSpan: (_a = this.columnData) === null || _a === void 0 ? void 0 : _a.length, style: { textAlign: 'center' } }, "No results")));
|
|
9
|
-
};
|
|
10
|
-
this.errorState = () => {
|
|
11
|
-
var _a;
|
|
12
|
-
return (h("tr", null, h("td", { class: "error-state", part: "error-state", colSpan: (_a = this.columnData) === null || _a === void 0 ? void 0 : _a.length, style: { textAlign: 'center' } }, "An unexpected error occurred: ", this.errorMessage)));
|
|
13
|
-
};
|
|
14
|
-
this.loadingState = () => {
|
|
15
|
-
var _a;
|
|
16
|
-
return (h("tr", null, h("td", { class: "loading-state", part: "loading-state-cell", colSpan: (_a = this.columnData) === null || _a === void 0 ? void 0 : _a.length, style: { textAlign: 'center' } }, h("div", { part: "loading-state-spinner", class: "spinner-border", role: "status" }, h("span", { class: "visually-hidden" }, "Loading...")))));
|
|
17
|
-
};
|
|
18
7
|
this.loading = true;
|
|
19
8
|
this.errorMessage = '';
|
|
20
9
|
this.rowData = [];
|
|
@@ -24,25 +13,29 @@ export class Table {
|
|
|
24
13
|
this.entityId = undefined;
|
|
25
14
|
this.rowClickHandler = undefined;
|
|
26
15
|
}
|
|
27
|
-
showEmptyState() {
|
|
28
|
-
return this.
|
|
16
|
+
get showEmptyState() {
|
|
17
|
+
return !this.loading && !this.errorMessage && this.rowData.length < 1;
|
|
18
|
+
}
|
|
19
|
+
get showErrorState() {
|
|
20
|
+
return !this.loading && !!this.errorMessage;
|
|
21
|
+
}
|
|
22
|
+
get showRowData() {
|
|
23
|
+
return !this.showEmptyState && !this.showErrorState;
|
|
29
24
|
}
|
|
30
25
|
render() {
|
|
31
|
-
var _a, _b
|
|
32
|
-
return (h(Host, { exportparts: tableExportedParts }, this.columnData ?
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
:
|
|
45
|
-
h("div", { "data-test-id": "empty-error-state" }, "Column data is required")));
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (h(Host, { exportparts: tableExportedParts }, h("div", { class: "table-wrapper" }, h("table", { class: "table table-hover" }, h("thead", { class: "table-head sticky-top", part: "table-head" }, h("tr", { class: "table-light text-nowrap", part: 'table-head-row' }, (_a = this.columnData) === null || _a === void 0 ? void 0 : _a.map((column) => h("th", { part: "table-head-cell", scope: "col", title: Array.isArray(column) ? column[1] : '' }, !Array.isArray(column) ? column : column[0])))), h("tbody", { class: "table-body", part: 'table-body' }, this.loading && LoadingState(this.columnData.length), this.showEmptyState && EmptyState(this.columnData.length), this.showErrorState && ErrorState(this.columnData.length, this.errorMessage), this.showRowData && (this.rowData.map((data, index) => {
|
|
28
|
+
return (h("tr", { "data-row-entity-id": this.entityId[index], onClick: e => this.rowClickHandler ? this.rowClickHandler(e) : null, part: `table-row ${index % 2 ? 'table-row-even' : 'table-row-odd'}` }, data.map((dataEntry) => {
|
|
29
|
+
let nestedHtml = dataEntry === null || dataEntry === void 0 ? void 0 : dataEntry.type;
|
|
30
|
+
if (nestedHtml) {
|
|
31
|
+
return (h("td", { part: "table-cell", innerHTML: dataEntry.value }));
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return (h("td", { part: "table-cell" }, dataEntry));
|
|
35
|
+
}
|
|
36
|
+
})));
|
|
37
|
+
}))), this.paging &&
|
|
38
|
+
h("tfoot", { class: "sticky-bottom" }, h("tr", { class: "table-light align-middle" }, h("td", { part: "pagination-bar", colSpan: (_b = this.columnData) === null || _b === void 0 ? void 0 : _b.length }, h("pagination-menu", { paging: this.paging, params: this.params }))))))));
|
|
46
39
|
}
|
|
47
40
|
static get is() { return "justifi-table"; }
|
|
48
41
|
static get encapsulation() { return "shadow"; }
|
|
@@ -2,21 +2,29 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
import { newSpecPage } from "@stencil/core/testing";
|
|
3
3
|
import { Table } from "../table";
|
|
4
4
|
describe('justifi-table', () => {
|
|
5
|
-
it('
|
|
5
|
+
it('enters loading state when loading is true', async () => {
|
|
6
6
|
const page = await newSpecPage({
|
|
7
7
|
components: [Table],
|
|
8
|
-
|
|
8
|
+
template: () => h("justifi-table", { columnData: ['test', 'test'], loading: true })
|
|
9
9
|
});
|
|
10
|
-
const
|
|
11
|
-
expect(
|
|
10
|
+
const loading = page.root.shadowRoot.querySelector('.loading-state');
|
|
11
|
+
expect(loading).toBeTruthy();
|
|
12
|
+
const loadingSpinner = page.root.shadowRoot.querySelector('.spinner-border');
|
|
13
|
+
expect(loadingSpinner).toBeTruthy();
|
|
14
|
+
const error = await page.root.shadowRoot.querySelector('.error-state');
|
|
15
|
+
expect(error).toBeNull();
|
|
12
16
|
});
|
|
13
|
-
it('
|
|
17
|
+
it('renders the empty state when no data is passed', async () => {
|
|
14
18
|
const page = await newSpecPage({
|
|
15
19
|
components: [Table],
|
|
16
20
|
template: () => h("justifi-table", { columnData: ['test', 'test'], loading: false })
|
|
17
21
|
});
|
|
18
|
-
const
|
|
19
|
-
expect(
|
|
22
|
+
const empty = page.root.shadowRoot.querySelector('.empty-state');
|
|
23
|
+
expect(empty).toBeTruthy();
|
|
24
|
+
const emptyStateMessage = empty.innerHTML;
|
|
25
|
+
expect(emptyStateMessage).toBe('No results');
|
|
26
|
+
const error = await page.root.shadowRoot.querySelector('.error-state');
|
|
27
|
+
expect(error).toBeNull();
|
|
20
28
|
});
|
|
21
29
|
it('renders the state and displays error message passed', async () => {
|
|
22
30
|
const ERROR_TEXT = 'error-123';
|
|
@@ -24,18 +32,20 @@ describe('justifi-table', () => {
|
|
|
24
32
|
components: [Table],
|
|
25
33
|
template: () => h("justifi-table", { columnData: ['test', 'test'], loading: false, errorMessage: ERROR_TEXT })
|
|
26
34
|
});
|
|
35
|
+
const loading = page.root.shadowRoot.querySelector('.loading-state');
|
|
36
|
+
expect(loading).toBeNull();
|
|
27
37
|
const error = page.root.shadowRoot.querySelector('.error-state');
|
|
28
|
-
expect(error).
|
|
38
|
+
expect(error).toBeTruthy();
|
|
29
39
|
const errorText = error.innerHTML;
|
|
30
40
|
expect(errorText).toBe(`An unexpected error occurred: ${ERROR_TEXT}`);
|
|
31
41
|
});
|
|
32
42
|
it('renders the pagination bar when pagination is passed', async () => {
|
|
33
43
|
const PAG = {
|
|
34
|
-
amount:
|
|
44
|
+
amount: 50,
|
|
35
45
|
start_cursor: '',
|
|
36
46
|
end_cursor: '',
|
|
37
47
|
has_previous: false,
|
|
38
|
-
has_next:
|
|
48
|
+
has_next: true,
|
|
39
49
|
handleClickNext: () => { },
|
|
40
50
|
handleClickPrevious: () => { }
|
|
41
51
|
};
|
|
@@ -43,8 +53,8 @@ describe('justifi-table', () => {
|
|
|
43
53
|
components: [Table],
|
|
44
54
|
template: () => h("justifi-table", { columnData: ['test', 'test'], loading: false, paging: PAG })
|
|
45
55
|
});
|
|
46
|
-
const
|
|
47
|
-
expect(
|
|
56
|
+
const paginationBar = page.root.shadowRoot.querySelector('[part="pagination-bar"]');
|
|
57
|
+
expect(paginationBar).toBeTruthy();
|
|
48
58
|
});
|
|
49
59
|
it('has an ID for each row', async () => {
|
|
50
60
|
const page = await newSpecPage({
|
|
@@ -52,7 +62,13 @@ describe('justifi-table', () => {
|
|
|
52
62
|
template: () => h("justifi-table", { entityId: ['123'], rowData: [['test']], columnData: ['test', 'test'], loading: false })
|
|
53
63
|
});
|
|
54
64
|
const row = page.root.shadowRoot.querySelector('[data-row-entity-id]');
|
|
55
|
-
expect(row).
|
|
65
|
+
expect(row).toBeTruthy();
|
|
56
66
|
expect(row.dataset.rowEntityId).toBe('123');
|
|
67
|
+
const loading = page.root.shadowRoot.querySelector('.loading-state');
|
|
68
|
+
expect(loading).toBeNull();
|
|
69
|
+
const empty = page.root.shadowRoot.querySelector('.empty-state');
|
|
70
|
+
expect(empty).toBeNull();
|
|
71
|
+
const error = await page.root.shadowRoot.querySelector('.error-state');
|
|
72
|
+
expect(error).toBeNull();
|
|
57
73
|
});
|
|
58
74
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const LoadingState = (columnSpan) => (h("tr", null, h("td", { class: "loading-state", part: "loading-state-cell", colSpan: columnSpan, style: { textAlign: 'center' } }, h("div", { part: "loading-state-spinner", class: "spinner-border", role: "status" }, h("span", { class: "visually-hidden" }, "Loading...")))));
|
|
3
|
+
export const EmptyState = (columnSpan) => (h("tr", null, h("td", { class: "empty-state", part: "empty-state", colSpan: columnSpan, style: { textAlign: 'center' } }, "No results")));
|
|
4
|
+
export const ErrorState = (columnSpan, errorMessage) => (h("tr", null, h("td", { class: "error-state", part: "error-state", colSpan: columnSpan, style: { textAlign: 'center' } }, "An unexpected error occurred: ", errorMessage)));
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-
|
|
2
|
+
"timestamp": "2024-02-09T22:26:47",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.10.0",
|
|
@@ -2139,6 +2139,27 @@
|
|
|
2139
2139
|
],
|
|
2140
2140
|
"optional": true,
|
|
2141
2141
|
"required": false
|
|
2142
|
+
},
|
|
2143
|
+
{
|
|
2144
|
+
"name": "hideErrors",
|
|
2145
|
+
"type": "boolean",
|
|
2146
|
+
"complexType": {
|
|
2147
|
+
"original": "boolean",
|
|
2148
|
+
"resolved": "boolean",
|
|
2149
|
+
"references": {}
|
|
2150
|
+
},
|
|
2151
|
+
"mutable": false,
|
|
2152
|
+
"attr": "hide-errors",
|
|
2153
|
+
"reflectToAttr": false,
|
|
2154
|
+
"docs": "",
|
|
2155
|
+
"docsTags": [],
|
|
2156
|
+
"values": [
|
|
2157
|
+
{
|
|
2158
|
+
"type": "boolean"
|
|
2159
|
+
}
|
|
2160
|
+
],
|
|
2161
|
+
"optional": true,
|
|
2162
|
+
"required": false
|
|
2142
2163
|
}
|
|
2143
2164
|
],
|
|
2144
2165
|
"methods": [],
|
|
@@ -2221,7 +2242,7 @@
|
|
|
2221
2242
|
"usage": {},
|
|
2222
2243
|
"props": [
|
|
2223
2244
|
{
|
|
2224
|
-
"name": "
|
|
2245
|
+
"name": "authToken",
|
|
2225
2246
|
"type": "string",
|
|
2226
2247
|
"complexType": {
|
|
2227
2248
|
"original": "string",
|
|
@@ -2229,7 +2250,7 @@
|
|
|
2229
2250
|
"references": {}
|
|
2230
2251
|
},
|
|
2231
2252
|
"mutable": false,
|
|
2232
|
-
"attr": "
|
|
2253
|
+
"attr": "auth-token",
|
|
2233
2254
|
"reflectToAttr": false,
|
|
2234
2255
|
"docs": "",
|
|
2235
2256
|
"docsTags": [],
|
|
@@ -2242,7 +2263,7 @@
|
|
|
2242
2263
|
"required": false
|
|
2243
2264
|
},
|
|
2244
2265
|
{
|
|
2245
|
-
"name": "
|
|
2266
|
+
"name": "businessId",
|
|
2246
2267
|
"type": "string",
|
|
2247
2268
|
"complexType": {
|
|
2248
2269
|
"original": "string",
|
|
@@ -2250,7 +2271,7 @@
|
|
|
2250
2271
|
"references": {}
|
|
2251
2272
|
},
|
|
2252
2273
|
"mutable": false,
|
|
2253
|
-
"attr": "
|
|
2274
|
+
"attr": "business-id",
|
|
2254
2275
|
"reflectToAttr": false,
|
|
2255
2276
|
"docs": "",
|
|
2256
2277
|
"docsTags": [],
|
|
@@ -2259,25 +2280,25 @@
|
|
|
2259
2280
|
"type": "string"
|
|
2260
2281
|
}
|
|
2261
2282
|
],
|
|
2262
|
-
"optional":
|
|
2283
|
+
"optional": true,
|
|
2263
2284
|
"required": false
|
|
2264
2285
|
},
|
|
2265
2286
|
{
|
|
2266
|
-
"name": "
|
|
2267
|
-
"type": "
|
|
2287
|
+
"name": "hideErrors",
|
|
2288
|
+
"type": "boolean",
|
|
2268
2289
|
"complexType": {
|
|
2269
|
-
"original": "
|
|
2270
|
-
"resolved": "
|
|
2290
|
+
"original": "boolean",
|
|
2291
|
+
"resolved": "boolean",
|
|
2271
2292
|
"references": {}
|
|
2272
2293
|
},
|
|
2273
2294
|
"mutable": false,
|
|
2274
|
-
"attr": "
|
|
2295
|
+
"attr": "hide-errors",
|
|
2275
2296
|
"reflectToAttr": false,
|
|
2276
2297
|
"docs": "",
|
|
2277
2298
|
"docsTags": [],
|
|
2278
2299
|
"values": [
|
|
2279
2300
|
{
|
|
2280
|
-
"type": "
|
|
2301
|
+
"type": "boolean"
|
|
2281
2302
|
}
|
|
2282
2303
|
],
|
|
2283
2304
|
"optional": true,
|
|
@@ -5425,22 +5446,6 @@
|
|
|
5425
5446
|
"styles": [],
|
|
5426
5447
|
"slots": [],
|
|
5427
5448
|
"parts": [
|
|
5428
|
-
{
|
|
5429
|
-
"name": "empty-state",
|
|
5430
|
-
"docs": ""
|
|
5431
|
-
},
|
|
5432
|
-
{
|
|
5433
|
-
"name": "error-state",
|
|
5434
|
-
"docs": ""
|
|
5435
|
-
},
|
|
5436
|
-
{
|
|
5437
|
-
"name": "loading-state-cell",
|
|
5438
|
-
"docs": ""
|
|
5439
|
-
},
|
|
5440
|
-
{
|
|
5441
|
-
"name": "loading-state-spinner",
|
|
5442
|
-
"docs": ""
|
|
5443
|
-
},
|
|
5444
5449
|
{
|
|
5445
5450
|
"name": "pagination-bar",
|
|
5446
5451
|
"docs": ""
|