@justifi/webcomponents 4.7.5 → 4.8.0
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/Business-540a6feb.js +67 -0
- package/dist/cjs/BusinessFormEventTypes-863f48e9.js +42 -0
- package/dist/cjs/{Payout-7821eb61.js → Payout-44b49b2d.js} +2 -1
- package/dist/cjs/additional-questions-details_5.cjs.entry.js +5 -5
- package/dist/cjs/{business-form-schema-a2b87e77.js → business-form-schema-37e5381d.js} +17 -17
- package/dist/cjs/{form-control-datepart_2.cjs.entry.js → form-control-datepart_3.cjs.entry.js} +46 -3
- package/dist/cjs/form-control-monetary.cjs.entry.js +1 -1
- package/dist/cjs/{form-control-number_3.cjs.entry.js → form-control-select_2.cjs.entry.js} +1 -44
- package/dist/cjs/form-input-masks-e3bf2614.js +9 -0
- package/dist/cjs/{index-4286ac32.js → index-55950669.js} +31 -1
- package/dist/cjs/{index.esm-c08c2adc.js → index.esm-d25bd7bf.js} +0 -259
- package/dist/cjs/{justifi-additional-questions_6.cjs.entry.js → justifi-additional-questions_5.cjs.entry.js} +10 -280
- package/dist/cjs/justifi-bank-account-form.cjs.entry.js +1 -1
- package/dist/cjs/justifi-billing-form_2.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-details.cjs.entry.js +6 -6
- package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +56 -49
- package/dist/cjs/justifi-business-form.cjs.entry.js +43 -36
- package/dist/cjs/justifi-business-list.cjs.entry.js +4 -51
- package/dist/cjs/justifi-business-owners.cjs.entry.js +78 -0
- 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 +3 -3
- package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +44 -43
- package/dist/cjs/justifi-payment-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-method-form.cjs.entry.js +7 -5
- package/dist/cjs/justifi-payments-list.cjs.entry.js +47 -91
- package/dist/cjs/justifi-payout-details.cjs.entry.js +48 -46
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +47 -113
- package/dist/cjs/justifi-proceeds-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-form.cjs.entry.js +3 -3
- package/dist/cjs/justifi-subaccount-details.cjs.entry.js +3 -3
- package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +4 -4
- package/dist/cjs/justifi-table_2.cjs.entry.js +33 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/payment-details-core.cjs.entry.js +52 -0
- package/dist/cjs/payment.service-605896dc.js +20 -0
- package/dist/cjs/payments-list-core.cjs.entry.js +98 -0
- package/dist/cjs/payout-details-core.cjs.entry.js +52 -0
- package/dist/cjs/payout.service-b39f2739.js +21 -0
- package/dist/cjs/payouts-list-core.cjs.entry.js +121 -0
- 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/{utils-a2ee48ca.js → utils-d126d17c.js} +5 -5
- package/dist/cjs/utils-f5d82f21.js +10 -0
- package/dist/cjs/webcomponents.cjs.js +2 -2
- package/dist/collection/api/Business.js +18 -3
- package/dist/collection/api/Payment.js +2 -1
- package/dist/collection/api/mockData/MockPayments.js +25 -0
- package/dist/collection/api/services/payment.service.js +13 -0
- package/dist/collection/api/services/payout.service.js +14 -0
- package/dist/collection/api/services/utils.js +6 -0
- package/dist/collection/collection-manifest.json +4 -0
- package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +8 -8
- package/dist/collection/components/business-details/business-details.js +3 -3
- package/dist/collection/components/business-form/BusinessFormEventTypes.js +6 -0
- package/dist/collection/components/business-form/business-address/business-address-form-schema.js +1 -1
- package/dist/collection/components/business-form/business-form-schema.js +16 -16
- package/dist/collection/components/business-form/business-form-stepped.js +99 -57
- package/dist/collection/components/business-form/business-form.css +95 -0
- package/dist/collection/components/business-form/business-form.js +92 -32
- package/dist/collection/components/business-form/business-generic-info/business-generic-info.js +7 -3
- package/dist/collection/components/business-form/business-owners/business-owners.js +6 -21
- package/dist/collection/components/business-form/business-representative/business-representative.js +1 -1
- package/dist/collection/components/business-form/helpers.js +21 -20
- package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js +1 -1
- package/dist/collection/components/business-form/legal-address-form/legal-address-form.js +1 -2
- package/dist/collection/components/business-form/test/business-form.spec.js +5 -14
- package/dist/collection/components/details/utils.js +2 -2
- package/dist/collection/components/form/utils.js +2 -0
- package/dist/collection/components/pagination-menu/test/pagination-menu.spec.js +87 -0
- package/dist/collection/components/payment-details/get-payment-details.js +17 -0
- package/dist/collection/components/payment-details/payment-details-core.js +86 -0
- package/dist/collection/components/payment-details/payment-details.js +27 -52
- package/dist/collection/components/payment-details/test/get-payment-details.spec.js +64 -0
- package/dist/collection/components/payment-details/test/payment-details-core.spec.js +47 -0
- package/dist/collection/components/payment-details/test/payment-details.spec.js +31 -0
- package/dist/collection/components/payments-list/get-payments.js +20 -0
- package/dist/collection/components/payments-list/payments-list-core.js +158 -0
- package/dist/collection/components/payments-list/payments-list.js +27 -127
- package/dist/collection/components/payments-list/test/get-payments.spec.js +70 -0
- package/dist/collection/components/payments-list/test/payments-list-core.spec.js +100 -0
- package/dist/collection/components/payments-list/test/payments-list.spec.js +17 -21
- package/dist/collection/components/payout-details/get-payout-details.js +20 -0
- package/dist/collection/components/payout-details/payout-details-core.js +86 -0
- package/dist/collection/components/payout-details/payout-details.js +27 -78
- package/dist/collection/components/payout-details/test/get-payout-details.spec.js +55 -0
- package/dist/collection/components/payout-details/test/payout-details-core.spec.js +72 -0
- package/dist/collection/components/payout-details/test/payout-details.spec.js +13 -0
- package/dist/collection/components/payouts-list/get-payouts.js +20 -0
- package/dist/collection/components/payouts-list/payouts-list-core.js +181 -0
- package/dist/collection/components/payouts-list/payouts-list.js +26 -148
- package/dist/collection/components/payouts-list/test/get-payouts.spec.js +64 -0
- package/dist/collection/components/payouts-list/test/payouts-list-core.spec.js +105 -0
- package/dist/collection/components/payouts-list/test/payouts-list.spec.js +29 -0
- 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 +47 -13
- package/dist/collection/components/table/utils.js +4 -0
- package/dist/collection/utils/{phone-masks.js → form-input-masks.js} +1 -0
- package/dist/docs.json +486 -317
- package/dist/esm/Business-1f5e9f6b.js +64 -0
- package/dist/esm/BusinessFormEventTypes-989960ba.js +39 -0
- package/dist/esm/{Payout-c42e3877.js → Payout-dc5f009c.js} +2 -1
- package/dist/esm/{SubAccount-b3ce8720.js → SubAccount-bd59f646.js} +1 -1
- package/dist/esm/additional-questions-details_5.entry.js +6 -6
- package/dist/esm/{business-form-schema-997c585c.js → business-form-schema-f8f554d1.js} +17 -17
- package/dist/esm/{form-control-datepart_2.entry.js → form-control-datepart_3.entry.js} +46 -4
- package/dist/esm/form-control-monetary.entry.js +1 -1
- package/dist/esm/{form-control-number_3.entry.js → form-control-select_2.entry.js} +2 -44
- package/dist/esm/form-input-masks-a8187c77.js +6 -0
- package/dist/esm/{index-ff8194f9.js → index-62b8aa8a.js} +31 -1
- package/dist/esm/{index.esm-8ae36d07.js → index.esm-22b47398.js} +1 -258
- package/dist/esm/{justifi-additional-questions_6.entry.js → justifi-additional-questions_5.entry.js} +10 -279
- package/dist/esm/justifi-bank-account-form.entry.js +1 -1
- package/dist/esm/justifi-billing-form_2.entry.js +2 -2
- package/dist/esm/justifi-business-details.entry.js +6 -6
- package/dist/esm/justifi-business-form-stepped.entry.js +56 -49
- package/dist/esm/justifi-business-form.entry.js +43 -36
- package/dist/esm/justifi-business-list.entry.js +4 -51
- package/dist/{module/business-owners.js → esm/justifi-business-owners.entry.js} +13 -55
- 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 +4 -4
- package/dist/esm/justifi-payment-balance-transactions.entry.js +3 -3
- package/dist/esm/justifi-payment-details.entry.js +44 -43
- package/dist/esm/justifi-payment-form.entry.js +3 -3
- package/dist/esm/justifi-payment-method-form.entry.js +7 -5
- package/dist/esm/justifi-payments-list.entry.js +47 -91
- package/dist/esm/justifi-payout-details.entry.js +48 -46
- package/dist/esm/justifi-payouts-list.entry.js +47 -113
- package/dist/esm/justifi-proceeds-list.entry.js +3 -3
- package/dist/esm/justifi-refund-form.entry.js +3 -3
- package/dist/esm/justifi-subaccount-details.entry.js +5 -5
- package/dist/esm/justifi-subaccounts-list.entry.js +6 -6
- package/dist/esm/justifi-table_2.entry.js +33 -30
- package/dist/esm/loader.js +3 -3
- package/dist/esm/payment-details-core.entry.js +48 -0
- package/dist/esm/payment.service-bea02ccf.js +18 -0
- package/dist/esm/payments-list-core.entry.js +94 -0
- package/dist/{webcomponents/p-b2dc938f.entry.js → esm/payout-details-core.entry.js} +48 -1
- package/dist/esm/payout.service-92e56814.js +19 -0
- package/dist/esm/payouts-list-core.entry.js +117 -0
- package/dist/esm/select-input_2.entry.js +1 -1
- package/dist/esm/subaccount-account-details_4.entry.js +3 -3
- package/dist/esm/subaccount-bank-details.entry.js +2 -2
- package/dist/esm/subaccount-terms-details.entry.js +2 -2
- package/dist/esm/utils-546ca6aa.js +8 -0
- package/dist/esm/{utils-7c6bd149.js → utils-576874df.js} +5 -5
- package/dist/esm/{utils-26c7dd12.js → utils-dd428dba.js} +1 -1
- package/dist/esm/webcomponents.js +3 -3
- package/dist/module/Business.js +64 -0
- package/dist/module/BusinessFormEventTypes.js +39 -0
- package/dist/module/Payout.js +2 -1
- package/dist/module/additional-questions-details2.js +4 -4
- package/dist/module/business-generic-info.js +25 -27
- package/dist/module/business-representative.js +1 -1
- package/dist/module/form-input-masks.js +6 -0
- package/dist/module/index.esm.js +1 -258
- package/dist/module/justifi-business-details.js +3 -3
- package/dist/module/justifi-business-form-stepped.js +74 -72
- package/dist/module/justifi-business-form.js +62 -58
- package/dist/module/justifi-business-list.js +1 -48
- package/dist/module/justifi-business-owners.js +115 -1
- package/dist/module/justifi-payment-details.js +52 -48
- package/dist/module/justifi-payments-list.js +58 -102
- package/dist/module/justifi-payout-details.js +57 -52
- package/dist/module/justifi-payouts-list.js +59 -125
- package/dist/module/justifi-refund-form.js +1 -1
- package/dist/module/justifi-subaccounts-list.js +2 -2
- package/dist/module/legal-address-form.js +1 -202
- package/dist/module/payment-details-core.d.ts +11 -0
- package/dist/module/payment-details-core.js +6 -0
- package/dist/module/payment-details-core2.js +76 -0
- package/dist/module/payment-method-form.js +6 -4
- package/dist/module/payment.service.js +18 -0
- package/dist/module/payments-list-core.d.ts +11 -0
- package/dist/module/payments-list-core.js +6 -0
- package/dist/module/payments-list-core2.js +131 -0
- package/dist/module/payout-details-core.d.ts +11 -0
- package/dist/module/payout-details-core.js +6 -0
- package/dist/module/payout-details-core2.js +76 -0
- package/dist/module/payout.service.js +19 -0
- package/dist/module/payouts-list-core.d.ts +11 -0
- package/dist/module/payouts-list-core.js +6 -0
- package/dist/module/payouts-list-core2.js +153 -0
- package/dist/module/table.js +33 -30
- package/dist/module/utils.js +4 -4
- package/dist/module/utils3.js +8 -0
- package/dist/types/api/Business.d.ts +60 -37
- package/dist/types/api/Payment.d.ts +33 -1
- package/dist/types/api/services/payment.service.d.ts +9 -0
- package/dist/types/api/services/payout.service.d.ts +9 -0
- package/dist/types/api/services/utils.d.ts +1 -0
- package/dist/types/components/business-details/additional-questions-details/additional-questions-details.d.ts +2 -2
- package/dist/types/components/business-details/business-details.d.ts +2 -2
- package/dist/types/components/business-form/BusinessFormEventTypes.d.ts +5 -0
- package/dist/types/components/business-form/business-form-schema.d.ts +1 -19
- package/dist/types/components/business-form/business-form-stepped.d.ts +22 -4
- package/dist/types/components/business-form/business-form.d.ts +15 -1
- package/dist/types/components/business-form/business-generic-info/business-generic-info.d.ts +2 -0
- package/dist/types/components/business-form/business-owners/business-owners.d.ts +1 -1
- package/dist/types/components/business-form/helpers.d.ts +1 -1
- package/dist/types/components/details/utils.d.ts +4 -3
- package/dist/types/components/form/utils.d.ts +1 -0
- package/dist/types/components/payment-details/get-payment-details.d.ts +8 -0
- package/dist/types/components/payment-details/payment-details-core.d.ts +11 -0
- package/dist/types/components/payment-details/payment-details.d.ts +6 -6
- package/dist/types/components/payment-method-form/payment-method-responses.d.ts +10 -2
- package/dist/types/components/payments-list/get-payments.d.ts +9 -0
- package/dist/types/components/payments-list/payments-list-core.d.ts +17 -0
- package/dist/types/components/payments-list/payments-list.d.ts +4 -12
- package/dist/types/components/payout-details/get-payout-details.d.ts +8 -0
- package/dist/types/components/payout-details/payout-details-core.d.ts +11 -0
- package/dist/types/components/payout-details/payout-details.d.ts +5 -31
- package/dist/types/components/payouts-list/get-payouts.d.ts +9 -0
- package/dist/types/components/payouts-list/payouts-list-core.d.ts +18 -0
- package/dist/types/components/payouts-list/payouts-list.d.ts +4 -13
- 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 +138 -138
- package/dist/types/utils/form-input-masks.d.ts +6 -0
- package/dist/webcomponents/p-081cf5f6.entry.js +1 -0
- package/dist/webcomponents/{p-04817850.entry.js → p-0a0cf2e6.entry.js} +1 -1
- package/dist/webcomponents/p-0b9146cd.entry.js +1 -0
- package/dist/webcomponents/p-112acd3c.entry.js +1 -0
- package/dist/webcomponents/p-1555e6b1.js +1 -0
- package/dist/webcomponents/{p-377303af.entry.js → p-16f41fd0.entry.js} +1 -1
- package/dist/webcomponents/p-17715325.js +1 -0
- package/dist/webcomponents/p-19c5ddf1.entry.js +1 -0
- package/dist/webcomponents/p-1b6ff0d3.entry.js +1 -0
- package/dist/webcomponents/p-1cb65d15.entry.js +1 -0
- package/dist/webcomponents/{p-8302a5e2.entry.js → p-2e318b6a.entry.js} +1 -1
- package/dist/webcomponents/p-34de1c5d.entry.js +1 -0
- package/dist/webcomponents/p-36618b59.entry.js +1 -0
- package/dist/webcomponents/p-3a4d4869.entry.js +1 -0
- package/dist/webcomponents/p-3cb0b96d.js +1 -0
- package/dist/webcomponents/p-4ba2c711.entry.js +1 -0
- package/dist/webcomponents/p-4c01df65.entry.js +1 -0
- package/dist/webcomponents/p-4f14df36.js +2 -0
- package/dist/webcomponents/p-4fa27a28.entry.js +1 -0
- package/dist/webcomponents/{p-3bef762a.js → p-50730e69.js} +1 -1
- package/dist/webcomponents/{p-d84cd3a5.entry.js → p-57aab065.entry.js} +1 -1
- package/dist/webcomponents/p-57e592ac.entry.js +1 -0
- package/dist/webcomponents/p-5e142186.entry.js +1 -0
- package/dist/webcomponents/{p-57efe345.entry.js → p-5f8b9f64.entry.js} +1 -1
- package/dist/webcomponents/p-663bfe87.js +1 -0
- package/dist/webcomponents/p-6ab67031.entry.js +1 -0
- package/dist/webcomponents/p-6ed680e9.js +1 -0
- package/dist/webcomponents/{p-cf656598.entry.js → p-731cb109.entry.js} +1 -1
- package/dist/webcomponents/{p-c8916484.entry.js → p-7c0f91fa.entry.js} +1 -1
- package/dist/webcomponents/{p-0f5206f0.entry.js → p-7dd83492.entry.js} +1 -1
- package/dist/webcomponents/p-810b72b5.js +1 -0
- package/dist/webcomponents/p-876c7257.entry.js +1 -0
- package/dist/webcomponents/p-88027949.js +1 -0
- package/dist/webcomponents/{p-dd4e8fa1.entry.js → p-896a9ddb.entry.js} +1 -1
- package/dist/webcomponents/{p-22c2a11e.entry.js → p-8a90b976.entry.js} +1 -1
- package/dist/webcomponents/p-9b99370e.js +1 -0
- package/dist/webcomponents/p-9cb3ff78.entry.js +1 -0
- package/dist/webcomponents/p-ade12f56.js +1 -0
- package/dist/webcomponents/{p-0a351e24.entry.js → p-b5aba473.entry.js} +1 -1
- package/dist/webcomponents/p-b8a8b551.js +1 -0
- package/dist/webcomponents/{p-439a79c7.entry.js → p-bd099662.entry.js} +1 -1
- package/dist/webcomponents/{p-cb5352a3.entry.js → p-c0f882ce.entry.js} +1 -1
- package/dist/webcomponents/p-d66a6057.entry.js +1 -0
- package/dist/webcomponents/{p-650eb614.entry.js → p-d71ce1cd.entry.js} +1 -1
- package/dist/webcomponents/{p-33e74da7.entry.js → p-ec4f27e7.entry.js} +1 -1
- package/dist/webcomponents/{p-9a6e4749.js → p-f0c535ed.js} +1 -1
- package/dist/webcomponents/{p-0ad353cc.entry.js → p-f7a3fd12.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 +6 -4
- package/readme.md +1 -1
- package/dist/cjs/helpers-b254d050.js +0 -26
- package/dist/esm/helpers-d8a6a0f1.js +0 -24
- package/dist/module/helpers.js +0 -24
- package/dist/module/phone-masks.js +0 -5
- package/dist/types/utils/phone-masks.d.ts +0 -3
- package/dist/webcomponents/p-173fb8ef.entry.js +0 -1
- package/dist/webcomponents/p-1e2a98bf.js +0 -1
- package/dist/webcomponents/p-210677e3.js +0 -1
- package/dist/webcomponents/p-2cab231e.entry.js +0 -1
- package/dist/webcomponents/p-2ea68b03.entry.js +0 -1
- package/dist/webcomponents/p-34430db2.entry.js +0 -1
- package/dist/webcomponents/p-42bc8e53.entry.js +0 -1
- package/dist/webcomponents/p-59ecc2d7.entry.js +0 -1
- package/dist/webcomponents/p-71679a41.js +0 -1
- package/dist/webcomponents/p-78baff54.js +0 -1
- package/dist/webcomponents/p-7d922421.entry.js +0 -1
- package/dist/webcomponents/p-862f38cc.entry.js +0 -1
- package/dist/webcomponents/p-bedada09.js +0 -1
- package/dist/webcomponents/p-c8099443.entry.js +0 -1
- package/dist/webcomponents/p-da00d9bf.js +0 -2
- package/dist/webcomponents/p-df8f6a0f.entry.js +0 -1
- package/dist/webcomponents/p-e8f41c84.entry.js +0 -1
- package/dist/webcomponents/p-e9589e45.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import { PHONE_MASKS } from "../../../utils/
|
|
2
|
+
import { PHONE_MASKS } from "../../../utils/form-input-masks";
|
|
3
3
|
class BusinessOwner {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.name = '';
|
|
@@ -21,9 +21,11 @@ class BusinessOwner {
|
|
|
21
21
|
* @exportedPart input-invalid: Invalid state for inputfs
|
|
22
22
|
*/
|
|
23
23
|
export class BusinessOwners {
|
|
24
|
+
get disabledState() {
|
|
25
|
+
return !!this.formController.getInitialValues().owners && !!this.formController.getInitialValues().owners.length;
|
|
26
|
+
}
|
|
24
27
|
constructor() {
|
|
25
28
|
this.formController = undefined;
|
|
26
|
-
this.isEditing = undefined;
|
|
27
29
|
this.errors = [];
|
|
28
30
|
this.owners = [];
|
|
29
31
|
this.inputHandler = this.inputHandler.bind(this);
|
|
@@ -64,8 +66,8 @@ export class BusinessOwners {
|
|
|
64
66
|
const ownersDefaultValue = this.formController.values.getValue().owners || [];
|
|
65
67
|
return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Owners"), h("hr", null), this.owners.map((_owner, index) => {
|
|
66
68
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
67
|
-
return (h("div", { class: "row gx-2 gy-2 mb-4" }, h("div", { class: "col-12" }, h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: (_a = ownersDefaultValue[index]) === null || _a === void 0 ? void 0 : _a.name, error: (_b = this.errors[index]) === null || _b === void 0 ? void 0 : _b.name, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.
|
|
68
|
-
}), h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("button", { type: "button", class: "btn btn-outline-primary", onClick: event => this.addOwner(event) }, "Add an owner"))))));
|
|
69
|
+
return (h("div", { class: "row gx-2 gy-2 mb-4" }, h("div", { class: "col-12" }, h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "name", label: "Full Name", defaultValue: (_a = ownersDefaultValue[index]) === null || _a === void 0 ? void 0 : _a.name, error: (_b = this.errors[index]) === null || _b === void 0 ? void 0 : _b.name, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "title", label: "Title", defaultValue: (_c = ownersDefaultValue[index]) === null || _c === void 0 ? void 0 : _c.title, error: (_d = this.errors[index]) === null || _d === void 0 ? void 0 : _d.title, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "email", label: "Email", defaultValue: (_e = ownersDefaultValue[index]) === null || _e === void 0 ? void 0 : _e.email, error: (_f = this.errors[index]) === null || _f === void 0 ? void 0 : _f.email, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-number-masked", { name: "phone", label: "Phone", defaultValue: (_g = ownersDefaultValue[index]) === null || _g === void 0 ? void 0 : _g.phone, error: (_h = this.errors[index]) === null || _h === void 0 ? void 0 : _h.phone, inputHandler: (name, value) => this.inputHandler(name, value, index), mask: PHONE_MASKS.US, disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_day", label: "Date of Birth - Day", defaultValue: (_j = ownersDefaultValue[index]) === null || _j === void 0 ? void 0 : _j.dob_day, error: (_k = this.errors[index]) === null || _k === void 0 ? void 0 : _k.dob_day, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "day", disabled: this.disabledState })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_month", label: "Date of Birth - Month", defaultValue: (_l = ownersDefaultValue[index]) === null || _l === void 0 ? void 0 : _l.dob_month, error: (_m = this.errors[index]) === null || _m === void 0 ? void 0 : _m.dob_month, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "month", disabled: this.disabledState })), h("div", { class: "col-12 col-md-4" }, h("form-control-datepart", { name: "dob_year", label: "Date of Birth - Year", defaultValue: (_o = ownersDefaultValue[index]) === null || _o === void 0 ? void 0 : _o.dob_year, error: (_p = this.errors[index]) === null || _p === void 0 ? void 0 : _p.dob_year, inputHandler: (name, value) => this.inputHandler(name, value, index), type: "year", disabled: this.disabledState }))), h("div", { class: "mb-3" }, h("form-control-number", { name: "identification_number", label: "Identification Number", defaultValue: (_q = ownersDefaultValue[index]) === null || _q === void 0 ? void 0 : _q.identification_number, error: (_r = this.errors[index]) === null || _r === void 0 ? void 0 : _r.identification_number, inputHandler: (name, value) => this.inputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "grid gap-3" }, h("legend", { class: "mb-3" }, "Owner Address:"), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "line1", label: "Street Address", defaultValue: (_t = (_s = ownersDefaultValue[index]) === null || _s === void 0 ? void 0 : _s.address) === null || _t === void 0 ? void 0 : _t.line1, error: (_v = (_u = this.errors[index]) === null || _u === void 0 ? void 0 : _u.address) === null || _v === void 0 ? void 0 : _v.line1, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "city", label: "City", defaultValue: (_x = (_w = ownersDefaultValue[index]) === null || _w === void 0 ? void 0 : _w.address) === null || _x === void 0 ? void 0 : _x.city, error: (_z = (_y = this.errors[index]) === null || _y === void 0 ? void 0 : _y.address) === null || _z === void 0 ? void 0 : _z.city, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState }))), h("div", { class: "row mb-3" }, h("div", { class: "col-12 col-md-6" }, h("form-control-text", { name: "state", label: "State", defaultValue: (_1 = (_0 = ownersDefaultValue[index]) === null || _0 === void 0 ? void 0 : _0.address) === null || _1 === void 0 ? void 0 : _1.state, error: (_3 = (_2 = this.errors[index]) === null || _2 === void 0 ? void 0 : _2.address) === null || _3 === void 0 ? void 0 : _3.state, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })), h("div", { class: "col-12 col-md-6" }, h("form-control-number", { name: "postal_code", label: "Postal Code", defaultValue: (_5 = (_4 = ownersDefaultValue[index]) === null || _4 === void 0 ? void 0 : _4.address) === null || _5 === void 0 ? void 0 : _5.postal_code, error: (_7 = (_6 = this.errors[index]) === null || _6 === void 0 ? void 0 : _6.address) === null || _7 === void 0 ? void 0 : _7.postal_code, inputHandler: (name, value) => this.addressInputHandler(name, value, index), disabled: this.disabledState })))), h("button", { type: "button", class: "btn btn-outline-danger", onClick: event => this.removeOwner(event, index), disabled: this.disabledState }, "Remove owner"))));
|
|
70
|
+
}), h("div", { class: "row gy-3" }, h("div", { class: "col-12" }, h("button", { type: "button", class: "btn btn-outline-primary", onClick: event => this.addOwner(event), disabled: this.disabledState }, "Add an owner"))))));
|
|
69
71
|
}
|
|
70
72
|
static get is() { return "justifi-business-owners"; }
|
|
71
73
|
static get originalStyleUrls() {
|
|
@@ -100,23 +102,6 @@ export class BusinessOwners {
|
|
|
100
102
|
"tags": [],
|
|
101
103
|
"text": ""
|
|
102
104
|
}
|
|
103
|
-
},
|
|
104
|
-
"isEditing": {
|
|
105
|
-
"type": "boolean",
|
|
106
|
-
"mutable": false,
|
|
107
|
-
"complexType": {
|
|
108
|
-
"original": "boolean",
|
|
109
|
-
"resolved": "boolean",
|
|
110
|
-
"references": {}
|
|
111
|
-
},
|
|
112
|
-
"required": false,
|
|
113
|
-
"optional": false,
|
|
114
|
-
"docs": {
|
|
115
|
-
"tags": [],
|
|
116
|
-
"text": ""
|
|
117
|
-
},
|
|
118
|
-
"attribute": "is-editing",
|
|
119
|
-
"reflect": false
|
|
120
105
|
}
|
|
121
106
|
};
|
|
122
107
|
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
// These props should not be sent to the server
|
|
2
|
-
export const parseForPatching = (
|
|
3
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4
|
-
delete
|
|
5
|
-
delete
|
|
6
|
-
delete
|
|
7
|
-
delete
|
|
8
|
-
delete
|
|
9
|
-
delete
|
|
10
|
-
(_a =
|
|
11
|
-
(_b =
|
|
12
|
-
(_c =
|
|
13
|
-
(_d =
|
|
14
|
-
(_e =
|
|
15
|
-
(_f =
|
|
16
|
-
(_g =
|
|
17
|
-
(_h =
|
|
18
|
-
(_j =
|
|
19
|
-
(_k =
|
|
20
|
-
delete
|
|
21
|
-
|
|
2
|
+
export const parseForPatching = (values, initialValues) => {
|
|
3
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
4
|
+
delete values.id;
|
|
5
|
+
delete values.documents;
|
|
6
|
+
delete values.bank_accounts;
|
|
7
|
+
delete values.product_categories;
|
|
8
|
+
delete values.created_at;
|
|
9
|
+
delete values.updated_at;
|
|
10
|
+
(_a = values.legal_address) === null || _a === void 0 ? true : delete _a.id;
|
|
11
|
+
(_b = values.legal_address) === null || _b === void 0 ? true : delete _b.created_at;
|
|
12
|
+
(_c = values.legal_address) === null || _c === void 0 ? true : delete _c.updated_at;
|
|
13
|
+
(_d = values.representative) === null || _d === void 0 ? true : delete _d.id;
|
|
14
|
+
(_e = values.representative) === null || _e === void 0 ? true : delete _e.documents;
|
|
15
|
+
(_f = values.representative) === null || _f === void 0 ? true : delete _f.created_at;
|
|
16
|
+
(_g = values.representative) === null || _g === void 0 ? true : delete _g.updated_at;
|
|
17
|
+
(_h = values.representative) === null || _h === void 0 ? true : delete _h.address.id;
|
|
18
|
+
(_j = values.representative) === null || _j === void 0 ? true : delete _j.address.created_at;
|
|
19
|
+
(_k = values.representative) === null || _k === void 0 ? true : delete _k.address.updated_at;
|
|
20
|
+
(_l = values.representative) === null || _l === void 0 ? true : delete _l.business_id;
|
|
21
|
+
((_m = initialValues.owners) === null || _m === void 0 ? void 0 : _m.length) && delete values.owners;
|
|
22
|
+
return values;
|
|
22
23
|
};
|
package/dist/collection/components/business-form/legal-address-form/legal-address-form-schema.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Yup from "yup";
|
|
2
2
|
const legalAddressSchema = Yup.object({
|
|
3
3
|
line1: Yup.string().required('Enter street address'),
|
|
4
|
-
line2: Yup.string(),
|
|
4
|
+
line2: Yup.string().nullable(),
|
|
5
5
|
city: Yup.string().required('Enter city'),
|
|
6
6
|
state: Yup.string().required('Select state'),
|
|
7
7
|
postal_code: Yup.string().required('Enter postal code'),
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
-
import countryOptions from "../../../utils/country-options";
|
|
3
2
|
/**
|
|
4
3
|
* @exportedPart label: Label for inputs
|
|
5
4
|
* @exportedPart input: The input fields
|
|
@@ -22,7 +21,7 @@ export class LegalAddressForm {
|
|
|
22
21
|
render() {
|
|
23
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
24
23
|
const legalAddressDefaultValue = this.formController.getInitialValues().legal_address;
|
|
25
|
-
return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Business Legal Address"), h("hr", null), h("div", { class: "row gx-2 gy-2" }, h("div", { class: "col-12" }, h("form-control-text", { name: "line1", label: "Legal Address", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line1, error: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.legal_address) === null || _b === void 0 ? void 0 : _b.line1 })), h("div", { class: "col-12" }, h("form-control-text", { name: "line2", label: "Address Line 2", inputHandler: (name, value) => this.inputHandler(name, value), defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line2 })), h("div", { class: "col-12" }, h("form-control-text", { name: "city", label: "City", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.city, error: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.legal_address) === null || _d === void 0 ? void 0 : _d.city })), h("div", { class: "col-12" }, h("form-control-text", { name: "state", label: "State", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.state, error: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.legal_address) === null || _f === void 0 ? void 0 : _f.state })), h("div", { class: "col-12" }, h("form-control-number", { name: "postal_code", label: "Postal Code", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.postal_code, error: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.legal_address) === null || _h === void 0 ? void 0 : _h.postal_code })), h("div", { class: "col-12" }, h("form-control-select", { name: "country", label: "Country", options:
|
|
24
|
+
return (h(Host, { exportparts: "label,input,input-invalid" }, h("fieldset", null, h("legend", null, "Business Legal Address"), h("hr", null), h("div", { class: "row gx-2 gy-2" }, h("div", { class: "col-12" }, h("form-control-text", { name: "line1", label: "Legal Address", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line1, error: (_b = (_a = this.errors) === null || _a === void 0 ? void 0 : _a.legal_address) === null || _b === void 0 ? void 0 : _b.line1 })), h("div", { class: "col-12" }, h("form-control-text", { name: "line2", label: "Address Line 2", inputHandler: (name, value) => this.inputHandler(name, value), defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.line2 })), h("div", { class: "col-12" }, h("form-control-text", { name: "city", label: "City", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.city, error: (_d = (_c = this.errors) === null || _c === void 0 ? void 0 : _c.legal_address) === null || _d === void 0 ? void 0 : _d.city })), h("div", { class: "col-12" }, h("form-control-text", { name: "state", label: "State", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.state, error: (_f = (_e = this.errors) === null || _e === void 0 ? void 0 : _e.legal_address) === null || _f === void 0 ? void 0 : _f.state })), h("div", { class: "col-12" }, h("form-control-number", { name: "postal_code", label: "Postal Code", inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.postal_code, error: (_h = (_g = this.errors) === null || _g === void 0 ? void 0 : _g.legal_address) === null || _h === void 0 ? void 0 : _h.postal_code })), h("div", { class: "col-12" }, h("form-control-select", { name: "country", label: "Country", options: [{ label: 'United States', value: 'USA' }], inputHandler: this.inputHandler, defaultValue: legalAddressDefaultValue === null || legalAddressDefaultValue === void 0 ? void 0 : legalAddressDefaultValue.country, error: (_k = (_j = this.errors) === null || _j === void 0 ? void 0 : _j.legal_address) === null || _k === void 0 ? void 0 : _k.country,
|
|
26
25
|
// just for now so we skip handling country specificities
|
|
27
26
|
disabled: true }))))));
|
|
28
27
|
}
|
|
@@ -4,7 +4,7 @@ describe('justifi-business-form', () => {
|
|
|
4
4
|
let consoleSpy;
|
|
5
5
|
// Initialize the spy in the beforeEach
|
|
6
6
|
beforeEach(() => {
|
|
7
|
-
consoleSpy = jest.spyOn(console, '
|
|
7
|
+
consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => { });
|
|
8
8
|
});
|
|
9
9
|
// Restore the original function in the afterEach
|
|
10
10
|
afterEach(() => {
|
|
@@ -17,26 +17,17 @@ describe('justifi-business-form', () => {
|
|
|
17
17
|
});
|
|
18
18
|
expect(consoleSpy).toHaveBeenCalledWith('Warning: Missing auth-token. The form will not be functional without it.');
|
|
19
19
|
});
|
|
20
|
-
it('should
|
|
21
|
-
|
|
20
|
+
it('should log a warning if no businessId is provided', async () => {
|
|
21
|
+
await newSpecPage({
|
|
22
22
|
components: [BusinessForm],
|
|
23
23
|
html: `<justifi-business-form></justifi-business-form>`,
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
expect(submitButton).toHaveAttribute('disabled');
|
|
27
|
-
});
|
|
28
|
-
it('should not disable the submit button if an authToken is provided', async () => {
|
|
29
|
-
const { root } = await newSpecPage({
|
|
30
|
-
components: [BusinessForm],
|
|
31
|
-
html: `<justifi-business-form auth-token="auth-token"></justifi-business-form>`,
|
|
32
|
-
});
|
|
33
|
-
const submitButton = root.querySelector('.jfi-submit-button');
|
|
34
|
-
expect(submitButton).not.toHaveAttribute('disabled');
|
|
25
|
+
expect(consoleSpy).toHaveBeenCalledWith('Warning: Missing business-id. The form requires an existing business-id to function.');
|
|
35
26
|
});
|
|
36
27
|
it('should not log a warning if an authToken is provided', async () => {
|
|
37
28
|
await newSpecPage({
|
|
38
29
|
components: [BusinessForm],
|
|
39
|
-
html: `<justifi-business-form auth-token="some-token"></justifi-business-form>`,
|
|
30
|
+
html: `<justifi-business-form business-id="biz_123" auth-token="some-token"></justifi-business-form>`,
|
|
40
31
|
});
|
|
41
32
|
expect(consoleSpy).not.toHaveBeenCalled();
|
|
42
33
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
export const LoadingState = (h("main", { part: "detail-loading-state", class: "p-4 d-flex justify-content-center text-center", style: { fontSize: '1.2rem' } }, h("div", { part: "detail-loading-spinner", class: "spinner-border spinner-border-sm", role: "status" }, h("span", { class: "visually-hidden" }, "Loading..."))));
|
|
2
|
+
export const LoadingState = () => (h("main", { part: "detail-loading-state", class: "p-4 d-flex justify-content-center text-center", style: { fontSize: '1.2rem' } }, h("div", { part: "detail-loading-spinner", class: "spinner-border spinner-border-sm", role: "status" }, h("span", { class: "visually-hidden" }, "Loading..."))));
|
|
3
3
|
export const ErrorState = (errorMessage) => (h("main", { part: "detail-empty-state", class: "p-4 d-flex justify-content-center text-center", style: { fontSize: '1.2rem' } }, h("div", null, errorMessage)));
|
|
4
|
-
export const DetailSection = (
|
|
4
|
+
export const DetailSection = (props, children) => (h("div", { part: "detail-section", class: "mt-4" }, h("h5", { part: "detail-section-title" }, props.sectionTitle), h("hr", null), h("div", { class: "d-table gap-2 w-100" }, ...children)));
|
|
5
5
|
export const DetailItem = ({ title, value, }) => title && value ? (h("div", { class: "d-table-row gap-2" }, h("span", { part: "detail-section-item-title", class: "fw-bold d-table-cell px-2" }, title), h("span", { part: "detail-section-item-data", class: "flex-1 d-table-cell px-2 text-wrap", innerHTML: value }))) : null;
|
|
6
6
|
export const EntityHeadInfoItem = ({ title, value, classes, }) => (h("div", { part: "detail-head-info-item", class: `d-flex flex-column ${classes}` }, h("span", { part: "detail-head-info-item-title", class: "fw-bold border-1 border-bottom ps-2 pe-2" }, title), h("span", { part: "detail-head-info-item-data", class: "pt-2 ps-2 pe-2" }, value)));
|
|
7
7
|
export const EntityHeadInfo = ({ title, slot, badge }, children) => (h("div", { slot: slot, part: "detail-head", class: "p-2" }, h("div", { class: "d-flex flex-row align-items-center gap-2 mb-2" }, h("h1", { class: "m-0", part: "detail-title" }, title), badge), h("div", { part: "detail-head-info", class: "d-flex flex-row align-items-top" }, children)));
|
|
@@ -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)));
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { newSpecPage } from "@stencil/core/testing";
|
|
2
|
+
import { PaginationMenu } from "../pagination-menu";
|
|
3
|
+
import { ExtendedPagingDefaults } from "../../../api";
|
|
4
|
+
const mockExtendedPagingInfo = {
|
|
5
|
+
has_previous: false,
|
|
6
|
+
has_next: true,
|
|
7
|
+
start_cursor: '',
|
|
8
|
+
end_cursor: '',
|
|
9
|
+
handleClickNext: jest.fn((after_cursor) => {
|
|
10
|
+
// Implementation for the mock; could just be empty for basic tests
|
|
11
|
+
console.log(`Mock handleClickNext called with after_cursor: ${after_cursor}`);
|
|
12
|
+
}),
|
|
13
|
+
handleClickPrevious: jest.fn((before_cursor) => {
|
|
14
|
+
console.log(`Mock handleClickPrevious called with before_cursor: ${before_cursor}`);
|
|
15
|
+
}),
|
|
16
|
+
amount: 0
|
|
17
|
+
};
|
|
18
|
+
describe('pagination-menu', () => {
|
|
19
|
+
it('initializes with default property values', async () => {
|
|
20
|
+
const page = await newSpecPage({
|
|
21
|
+
components: [PaginationMenu],
|
|
22
|
+
html: `<pagination-menu></pagination-menu>`,
|
|
23
|
+
});
|
|
24
|
+
expect(page.rootInstance.paging).toEqual(ExtendedPagingDefaults);
|
|
25
|
+
expect(page.rootInstance.params).toEqual({});
|
|
26
|
+
});
|
|
27
|
+
it('sets appropriate aria-labels for accessibility', async () => {
|
|
28
|
+
const page = await newSpecPage({
|
|
29
|
+
components: [PaginationMenu],
|
|
30
|
+
html: `<pagination-menu></pagination-menu>`,
|
|
31
|
+
});
|
|
32
|
+
expect(page.root.shadowRoot.querySelector('nav').getAttribute('aria-label')).toBe('Table pagination');
|
|
33
|
+
});
|
|
34
|
+
it('reflects passed properties', async () => {
|
|
35
|
+
const mockPagingInfo = mockExtendedPagingInfo;
|
|
36
|
+
const page = await newSpecPage({
|
|
37
|
+
components: [PaginationMenu],
|
|
38
|
+
html: `<pagination-menu></pagination-menu>`,
|
|
39
|
+
});
|
|
40
|
+
page.root.paging = mockPagingInfo;
|
|
41
|
+
await page.waitForChanges();
|
|
42
|
+
expect(page.rootInstance.paging).toBe(mockPagingInfo);
|
|
43
|
+
});
|
|
44
|
+
it('disables/enables buttons based on paging info', async () => {
|
|
45
|
+
const page = await newSpecPage({
|
|
46
|
+
components: [PaginationMenu],
|
|
47
|
+
html: `<pagination-menu></pagination-menu>`,
|
|
48
|
+
});
|
|
49
|
+
page.root.paging = {
|
|
50
|
+
has_previous: false,
|
|
51
|
+
has_next: true,
|
|
52
|
+
start_cursor: '',
|
|
53
|
+
end_cursor: '',
|
|
54
|
+
handleClickNext: jest.fn(),
|
|
55
|
+
handleClickPrevious: jest.fn(),
|
|
56
|
+
amount: 0
|
|
57
|
+
};
|
|
58
|
+
await page.waitForChanges();
|
|
59
|
+
const previousButton = page.root.shadowRoot.querySelector('.page-item:first-child');
|
|
60
|
+
const nextButton = page.root.shadowRoot.querySelector('.page-item:last-child');
|
|
61
|
+
// Convert classList to a string for the assertion
|
|
62
|
+
const previousButtonClasses = previousButton.className;
|
|
63
|
+
const nextButtonClasses = nextButton.className;
|
|
64
|
+
expect(previousButtonClasses).toContain('disabled');
|
|
65
|
+
expect(nextButtonClasses).not.toContain('disabled');
|
|
66
|
+
});
|
|
67
|
+
it('emits events on button clicks', async () => {
|
|
68
|
+
const mockPagingInfo = {
|
|
69
|
+
has_previous: true,
|
|
70
|
+
has_next: true,
|
|
71
|
+
handleClickPrevious: jest.fn(),
|
|
72
|
+
handleClickNext: jest.fn(),
|
|
73
|
+
};
|
|
74
|
+
const page = await newSpecPage({
|
|
75
|
+
components: [PaginationMenu],
|
|
76
|
+
html: `<pagination-menu></pagination-menu>`,
|
|
77
|
+
});
|
|
78
|
+
page.root.paging = mockPagingInfo;
|
|
79
|
+
await page.waitForChanges();
|
|
80
|
+
const previousButton = page.root.shadowRoot.querySelector('.page-item:first-child .page-link');
|
|
81
|
+
const nextButton = page.root.shadowRoot.querySelector('.page-item:last-child .page-link');
|
|
82
|
+
previousButton.click();
|
|
83
|
+
expect(mockPagingInfo.handleClickPrevious).toHaveBeenCalled();
|
|
84
|
+
nextButton.click();
|
|
85
|
+
expect(mockPagingInfo.handleClickNext).toHaveBeenCalled();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Payment } from "../../api";
|
|
2
|
+
import { getErrorMessage } from "../../api/services/utils";
|
|
3
|
+
export const makeGetPaymentDetails = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
|
|
4
|
+
try {
|
|
5
|
+
const response = await service.fetchPayment(id, authToken);
|
|
6
|
+
if (!response.error) {
|
|
7
|
+
onSuccess({ payment: new Payment(response.data) });
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
const responseError = getErrorMessage(response.error);
|
|
11
|
+
onError(`Error trying to fetch data : ${responseError}`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
onError(`Error trying to fetch data : ${error}`);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { MapPaymentStatusToBadge, formatCurrency, formatDate, formatTime, snakeCaseToHumanReadable } from "../../utils/utils";
|
|
3
|
+
import { CodeBlock, DetailItem, DetailSection, EntityHeadInfo, EntityHeadInfoItem, ErrorState, LoadingState } from "../details/utils";
|
|
4
|
+
export class PaymentDetailsCore {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.getPaymentDetails = undefined;
|
|
7
|
+
this.payment = undefined;
|
|
8
|
+
this.loading = true;
|
|
9
|
+
this.errorMessage = undefined;
|
|
10
|
+
}
|
|
11
|
+
componentWillLoad() {
|
|
12
|
+
if (this.getPaymentDetails) {
|
|
13
|
+
this.fetchData();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
updateOnPropChange() {
|
|
17
|
+
this.fetchData();
|
|
18
|
+
}
|
|
19
|
+
fetchData() {
|
|
20
|
+
this.loading = true;
|
|
21
|
+
this.getPaymentDetails({
|
|
22
|
+
onSuccess: ({ payment }) => {
|
|
23
|
+
this.payment = payment;
|
|
24
|
+
this.loading = false;
|
|
25
|
+
this.errorMessage = null;
|
|
26
|
+
},
|
|
27
|
+
onError: (error) => {
|
|
28
|
+
this.errorMessage = error;
|
|
29
|
+
this.loading = false;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
render() {
|
|
34
|
+
var _a;
|
|
35
|
+
return (h(Host, null, this.loading && LoadingState(), !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && !this.errorMessage &&
|
|
36
|
+
this.payment && (h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPaymentStatusToBadge(this.payment.status) }), title: `${formatCurrency(this.payment.amount)} ${(_a = this.payment) === null || _a === void 0 ? void 0 : _a.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate(this.payment.updated_at)} ${formatTime(this.payment.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.payment.created_at)} ${formatTime(this.payment.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.payment.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Amount", value: formatCurrency(this.payment.amount) }), h(DetailItem, { title: "Fees", value: formatCurrency(this.payment.fee_amount) }), h(DetailItem, { title: "Refunded", value: formatCurrency(this.payment.amount_refunded) }), h(DetailItem, { title: "Net", value: formatCurrency(this.payment.balance) }), h(DetailItem, { title: "Status", value: MapPaymentStatusToBadge(this.payment.status) }), h(DetailItem, { title: "Payment ID", value: this.payment.id }), h(DetailItem, { title: "Processing Fees", value: formatCurrency(this.payment.fee_amount) }), h(DetailItem, { title: "Statement Descriptor", value: this.payment.statement_descriptor }), h(DetailItem, { title: "Description", value: this.payment.description })), this.payment.payment_method.card && (h(DetailSection, { sectionTitle: "Payment Method" }, h(DetailItem, { title: "ID", value: this.payment.payment_method.card.id }), h(DetailItem, { title: "Payment Type", value: "Card" }), h(DetailItem, { title: "Last 4 Numbers", value: this.payment.payment_method.lastFourDigits }), h(DetailItem, { title: "Brand", value: snakeCaseToHumanReadable(this.payment.payment_method.card.brand) }), h(DetailItem, { title: "Cardholder", value: this.payment.payment_method.payersName }))), this.payment.payment_method.bank_account && (h(DetailSection, { sectionTitle: "Payment Method" }, h(DetailItem, { title: "ID", value: this.payment.payment_method.bank_account.id }), h(DetailItem, { title: "Last 4 Numbers", value: this.payment.payment_method.lastFourDigits }), h(DetailItem, { title: "Bank Name", value: this.payment.payment_method.bank_account.brand }), h(DetailItem, { title: "Account Owner", value: this.payment.payment_method.payersName }))), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: this.payment.metadata })))))));
|
|
37
|
+
}
|
|
38
|
+
static get is() { return "payment-details-core"; }
|
|
39
|
+
static get originalStyleUrls() {
|
|
40
|
+
return {
|
|
41
|
+
"$": ["payment-details.scss"]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static get styleUrls() {
|
|
45
|
+
return {
|
|
46
|
+
"$": ["payment-details.css"]
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
static get properties() {
|
|
50
|
+
return {
|
|
51
|
+
"getPaymentDetails": {
|
|
52
|
+
"type": "unknown",
|
|
53
|
+
"mutable": false,
|
|
54
|
+
"complexType": {
|
|
55
|
+
"original": "Function",
|
|
56
|
+
"resolved": "Function",
|
|
57
|
+
"references": {
|
|
58
|
+
"Function": {
|
|
59
|
+
"location": "global",
|
|
60
|
+
"id": "global::Function"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": false,
|
|
65
|
+
"optional": false,
|
|
66
|
+
"docs": {
|
|
67
|
+
"tags": [],
|
|
68
|
+
"text": ""
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
static get states() {
|
|
74
|
+
return {
|
|
75
|
+
"payment": {},
|
|
76
|
+
"loading": {},
|
|
77
|
+
"errorMessage": {}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
static get watchers() {
|
|
81
|
+
return [{
|
|
82
|
+
"propName": "getPaymentDetails",
|
|
83
|
+
"methodName": "updateOnPropChange"
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { config } from "../../../config";
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { PaymentService } from "../../api/services/payment.service";
|
|
3
|
+
import { makeGetPaymentDetails } from "./get-payment-details";
|
|
4
|
+
import { ErrorState } from "../details/utils";
|
|
6
5
|
/**
|
|
7
6
|
* @exportedPart detail-loading-spinner
|
|
8
7
|
* @exportedPart detail-loading-state
|
|
@@ -29,61 +28,38 @@ import { config } from "../../../config";
|
|
|
29
28
|
*/
|
|
30
29
|
export class PaymentDetails {
|
|
31
30
|
constructor() {
|
|
31
|
+
this.paymentService = new PaymentService();
|
|
32
32
|
this.paymentId = undefined;
|
|
33
33
|
this.authToken = undefined;
|
|
34
|
-
this.
|
|
35
|
-
this.
|
|
36
|
-
this.errorMessage = undefined;
|
|
34
|
+
this.getPaymentDetails = undefined;
|
|
35
|
+
this.errorMessage = null;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
this.
|
|
37
|
+
componentWillLoad() {
|
|
38
|
+
this.initializeGetPaymentDetails();
|
|
40
39
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
40
|
+
propChanged() {
|
|
41
|
+
this.initializeGetPaymentDetails();
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
initializeGetPaymentDetails() {
|
|
44
|
+
if (this.paymentId && this.authToken) {
|
|
45
|
+
this.getPaymentDetails = makeGetPaymentDetails({
|
|
46
|
+
id: this.paymentId,
|
|
47
|
+
authToken: this.authToken,
|
|
48
|
+
service: new PaymentService(),
|
|
49
|
+
});
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const endpoint = `payments/${this.paymentId}`;
|
|
53
|
-
const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
|
|
54
|
-
if (!response.error) {
|
|
55
|
-
this.payment = new Payment(response.data);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
const responseError = typeof response.error === 'string' ? response.error : response.error.message;
|
|
59
|
-
this.errorMessage = `Error trying to fetch data : ${responseError}`;
|
|
60
|
-
console.error(this.errorMessage);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
this.errorMessage = `Error trying to fetch data : ${error}`;
|
|
65
|
-
console.error(this.errorMessage);
|
|
66
|
-
}
|
|
67
|
-
finally {
|
|
68
|
-
this.loading = false;
|
|
51
|
+
else {
|
|
52
|
+
this.errorMessage = 'Payment ID and Auth Token are required';
|
|
69
53
|
}
|
|
70
54
|
}
|
|
71
55
|
render() {
|
|
72
|
-
|
|
73
|
-
|
|
56
|
+
if (this.errorMessage) {
|
|
57
|
+
return ErrorState(this.errorMessage);
|
|
58
|
+
}
|
|
59
|
+
return (h("payment-details-core", { getPaymentDetails: this.getPaymentDetails }));
|
|
74
60
|
}
|
|
75
61
|
static get is() { return "justifi-payment-details"; }
|
|
76
62
|
static get encapsulation() { return "shadow"; }
|
|
77
|
-
static get originalStyleUrls() {
|
|
78
|
-
return {
|
|
79
|
-
"$": ["payment-details.scss"]
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
static get styleUrls() {
|
|
83
|
-
return {
|
|
84
|
-
"$": ["payment-details.css"]
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
63
|
static get properties() {
|
|
88
64
|
return {
|
|
89
65
|
"paymentId": {
|
|
@@ -124,18 +100,17 @@ export class PaymentDetails {
|
|
|
124
100
|
}
|
|
125
101
|
static get states() {
|
|
126
102
|
return {
|
|
127
|
-
"
|
|
128
|
-
"loading": {},
|
|
103
|
+
"getPaymentDetails": {},
|
|
129
104
|
"errorMessage": {}
|
|
130
105
|
};
|
|
131
106
|
}
|
|
132
107
|
static get watchers() {
|
|
133
108
|
return [{
|
|
134
109
|
"propName": "paymentId",
|
|
135
|
-
"methodName": "
|
|
110
|
+
"methodName": "propChanged"
|
|
136
111
|
}, {
|
|
137
112
|
"propName": "authToken",
|
|
138
|
-
"methodName": "
|
|
113
|
+
"methodName": "propChanged"
|
|
139
114
|
}];
|
|
140
115
|
}
|
|
141
116
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Payment } from "../../../api";
|
|
2
|
+
import { PaymentService } from "../../../api/services/payment.service";
|
|
3
|
+
import { makeGetPaymentDetails } from "../get-payment-details";
|
|
4
|
+
import mockResponse from "../../../api/mockData/mockPaymentDetailSuccess.json";
|
|
5
|
+
// Mock the PaymentService class
|
|
6
|
+
jest.mock('../../../api/services/payment.service');
|
|
7
|
+
describe('getPaymentDetails', () => {
|
|
8
|
+
const paymentId = '123';
|
|
9
|
+
const authToken = '123';
|
|
10
|
+
let mockServiceInstance;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
// Create a new instance of the mocked PaymentService
|
|
14
|
+
mockServiceInstance = new PaymentService();
|
|
15
|
+
// Explicitly mock fetchPayment as a jest mock function
|
|
16
|
+
mockServiceInstance.fetchPayment = jest.fn();
|
|
17
|
+
});
|
|
18
|
+
it('should call onSuccess with payment on successful fetch', async () => {
|
|
19
|
+
const onSuccess = jest.fn();
|
|
20
|
+
const onError = jest.fn();
|
|
21
|
+
// Mock fetchPayment to resolve with mockResponse
|
|
22
|
+
mockServiceInstance.fetchPayment.mockResolvedValue(mockResponse);
|
|
23
|
+
const getPaymentDetails = makeGetPaymentDetails({
|
|
24
|
+
id: paymentId,
|
|
25
|
+
authToken: authToken,
|
|
26
|
+
service: mockServiceInstance,
|
|
27
|
+
});
|
|
28
|
+
await getPaymentDetails({ onSuccess, onError });
|
|
29
|
+
expect(onSuccess).toHaveBeenCalledWith({
|
|
30
|
+
payment: expect.any(Payment),
|
|
31
|
+
});
|
|
32
|
+
expect(onError).not.toHaveBeenCalled();
|
|
33
|
+
});
|
|
34
|
+
it('should call onError with an error message on API failure', async () => {
|
|
35
|
+
const mockError = new Error('Error fetching payment');
|
|
36
|
+
const onSuccess = jest.fn();
|
|
37
|
+
const onError = jest.fn();
|
|
38
|
+
// Mock fetchPayment to reject with mockError
|
|
39
|
+
mockServiceInstance.fetchPayment.mockRejectedValue(mockError);
|
|
40
|
+
const getPaymentDetails = makeGetPaymentDetails({
|
|
41
|
+
id: paymentId,
|
|
42
|
+
authToken: authToken,
|
|
43
|
+
service: mockServiceInstance,
|
|
44
|
+
});
|
|
45
|
+
await getPaymentDetails({ onSuccess, onError });
|
|
46
|
+
expect(onSuccess).not.toHaveBeenCalled();
|
|
47
|
+
expect(onError).toHaveBeenCalledWith(`Error trying to fetch data : ${mockError}`);
|
|
48
|
+
});
|
|
49
|
+
it('should call onError with an error message on API failure', async () => {
|
|
50
|
+
const mockError = new Error('Error fetching payment');
|
|
51
|
+
const onSuccess = jest.fn();
|
|
52
|
+
const onError = jest.fn();
|
|
53
|
+
// Mock fetchPayment to reject with mockError
|
|
54
|
+
mockServiceInstance.fetchPayment.mockRejectedValue(mockError);
|
|
55
|
+
const getPaymentDetails = makeGetPaymentDetails({
|
|
56
|
+
id: paymentId,
|
|
57
|
+
authToken: authToken,
|
|
58
|
+
service: mockServiceInstance,
|
|
59
|
+
});
|
|
60
|
+
await getPaymentDetails({ onSuccess, onError });
|
|
61
|
+
expect(onSuccess).not.toHaveBeenCalled();
|
|
62
|
+
expect(onError).toHaveBeenCalledWith(`Error trying to fetch data : ${mockError}`);
|
|
63
|
+
});
|
|
64
|
+
});
|