@justifi/webcomponents 4.7.1 → 4.7.2

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.
Files changed (133) hide show
  1. package/dist/cjs/{Payout-68a99ee3.js → Payout-f8240e9c.js} +49 -1
  2. package/dist/cjs/additional-questions-details_5.cjs.entry.js +9 -6
  3. package/dist/cjs/form-control-datepart_2.cjs.entry.js +1 -1
  4. package/dist/cjs/justifi-business-details.cjs.entry.js +17 -13
  5. package/dist/cjs/justifi-business-form-stepped.cjs.entry.js +1 -1
  6. package/dist/cjs/justifi-business-form.cjs.entry.js +1 -1
  7. package/dist/cjs/justifi-business-list.cjs.entry.js +1 -1
  8. package/dist/cjs/justifi-details.cjs.entry.js +1 -1
  9. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +23 -11
  10. package/dist/cjs/justifi-payment-balance-transactions.cjs.entry.js +1 -1
  11. package/dist/cjs/justifi-payment-details.cjs.entry.js +21 -12
  12. package/dist/cjs/justifi-payment-form.cjs.entry.js +16 -6
  13. package/dist/cjs/justifi-payment-method-form.cjs.entry.js +3 -1
  14. package/dist/cjs/justifi-payments-list.cjs.entry.js +22 -23
  15. package/dist/cjs/justifi-payout-details.cjs.entry.js +20 -12
  16. package/dist/cjs/justifi-payouts-list.cjs.entry.js +21 -11
  17. package/dist/cjs/justifi-proceeds-list.cjs.entry.js +1 -1
  18. package/dist/cjs/justifi-refund-form.cjs.entry.js +1 -1
  19. package/dist/cjs/justifi-subaccount-details.cjs.entry.js +4 -6
  20. package/dist/cjs/justifi-subaccounts-list.cjs.entry.js +1 -1
  21. package/dist/cjs/justifi-table_2.cjs.entry.js +4 -4
  22. package/dist/cjs/subaccount-account-details_4.cjs.entry.js +1 -1
  23. package/dist/cjs/subaccount-bank-details.cjs.entry.js +1 -1
  24. package/dist/cjs/subaccount-terms-details.cjs.entry.js +1 -1
  25. package/dist/cjs/{utils-4622829d.js → utils-a47b2e73.js} +4 -4
  26. package/dist/collection/api/Payment.js +49 -1
  27. package/dist/collection/api/mockData/MockPayments.js +21 -21
  28. package/dist/collection/components/business-details/additional-questions-details/additional-questions-details.js +2 -2
  29. package/dist/collection/components/business-details/business-details.js +16 -12
  30. package/dist/collection/components/business-details/owner-details/owner-details.js +4 -1
  31. package/dist/collection/components/business-details/representative-details/representative-details.js +2 -2
  32. package/dist/collection/components/business-form/business-form-example.js +12 -0
  33. package/dist/collection/components/business-form/business-form-stepped-example.js +12 -0
  34. package/dist/collection/components/business-form/business-form-stepped.stories.js +1 -1
  35. package/dist/collection/components/details/utils.js +2 -2
  36. package/dist/collection/components/form/form-control-datepart.js +1 -1
  37. package/dist/collection/components/gross-payment-chart/example.js +12 -0
  38. package/dist/collection/components/gross-payment-chart/gross-payment-chart.js +20 -8
  39. package/dist/collection/components/payment-details/payment-details.js +21 -12
  40. package/dist/collection/components/payment-form/payment-form.js +16 -6
  41. package/dist/collection/components/payments-list/payments-list.js +21 -22
  42. package/dist/collection/components/payout-details/payout-details.js +19 -11
  43. package/dist/collection/components/payouts-list/payouts-list.js +20 -10
  44. package/dist/collection/components/subaccount-details/subaccount-details.js +2 -4
  45. package/dist/collection/components/table/table.css +5 -0
  46. package/dist/collection/components/table/table.js +2 -2
  47. package/dist/components/Payout.js +50 -2
  48. package/dist/components/additional-questions-details2.js +2 -2
  49. package/dist/components/form-control-datepart2.js +1 -1
  50. package/dist/components/justifi-business-details.js +15 -11
  51. package/dist/components/justifi-gross-payment-chart.js +21 -9
  52. package/dist/components/justifi-payment-details.js +21 -12
  53. package/dist/components/justifi-payment-form.js +16 -6
  54. package/dist/components/justifi-payments-list.js +22 -23
  55. package/dist/components/justifi-payout-details.js +19 -11
  56. package/dist/components/justifi-payouts-list.js +21 -11
  57. package/dist/components/justifi-subaccount-details.js +2 -4
  58. package/dist/components/owner-details2.js +4 -1
  59. package/dist/components/pagination-menu2.js +1 -1
  60. package/dist/components/payment-method-form.js +3 -1
  61. package/dist/components/representative-details2.js +2 -2
  62. package/dist/components/table.js +3 -3
  63. package/dist/components/utils.js +4 -4
  64. package/dist/esm/{Payout-fcf16887.js → Payout-586f06a3.js} +50 -2
  65. package/dist/esm/additional-questions-details_5.entry.js +9 -6
  66. package/dist/esm/form-control-datepart_2.entry.js +1 -1
  67. package/dist/esm/justifi-business-details.entry.js +17 -13
  68. package/dist/esm/justifi-business-form-stepped.entry.js +1 -1
  69. package/dist/esm/justifi-business-form.entry.js +1 -1
  70. package/dist/esm/justifi-business-list.entry.js +1 -1
  71. package/dist/esm/justifi-details.entry.js +1 -1
  72. package/dist/esm/justifi-gross-payment-chart.entry.js +23 -11
  73. package/dist/esm/justifi-payment-balance-transactions.entry.js +1 -1
  74. package/dist/esm/justifi-payment-details.entry.js +22 -13
  75. package/dist/esm/justifi-payment-form.entry.js +16 -6
  76. package/dist/esm/justifi-payment-method-form.entry.js +3 -1
  77. package/dist/esm/justifi-payments-list.entry.js +22 -23
  78. package/dist/esm/justifi-payout-details.entry.js +20 -12
  79. package/dist/esm/justifi-payouts-list.entry.js +21 -11
  80. package/dist/esm/justifi-proceeds-list.entry.js +1 -1
  81. package/dist/esm/justifi-refund-form.entry.js +1 -1
  82. package/dist/esm/justifi-subaccount-details.entry.js +4 -6
  83. package/dist/esm/justifi-subaccounts-list.entry.js +1 -1
  84. package/dist/esm/justifi-table_2.entry.js +4 -4
  85. package/dist/esm/subaccount-account-details_4.entry.js +1 -1
  86. package/dist/esm/subaccount-bank-details.entry.js +1 -1
  87. package/dist/esm/subaccount-terms-details.entry.js +1 -1
  88. package/dist/esm/{utils-6352c002.js → utils-d19c2778.js} +4 -4
  89. package/dist/types/api/Payment.d.ts +32 -5
  90. package/dist/types/api/Payout.d.ts +2 -2
  91. package/dist/types/components/business-details/business-details.d.ts +0 -1
  92. package/dist/types/components/payment-method-form/payment-method-responses.d.ts +7 -1
  93. package/dist/types/components/payments-list/payments-list.d.ts +1 -3
  94. package/dist/webcomponents/p-2140e9ba.entry.js +1 -0
  95. package/dist/webcomponents/{p-914d2284.entry.js → p-311250e2.entry.js} +1 -1
  96. package/dist/webcomponents/{p-2306d7aa.entry.js → p-3501b0e8.entry.js} +1 -1
  97. package/dist/webcomponents/{p-5e78d370.entry.js → p-3ed43465.entry.js} +1 -1
  98. package/dist/webcomponents/{p-29528eca.entry.js → p-3ee831ac.entry.js} +1 -1
  99. package/dist/webcomponents/{p-6075122d.entry.js → p-4214dbb8.entry.js} +1 -1
  100. package/dist/webcomponents/p-4852ce94.entry.js +1 -0
  101. package/dist/webcomponents/p-4ec00b55.entry.js +1 -0
  102. package/dist/webcomponents/p-5e6726a8.entry.js +1 -0
  103. package/dist/webcomponents/p-77a8bcea.entry.js +1 -0
  104. package/dist/webcomponents/p-86c23e1e.js +1 -0
  105. package/dist/webcomponents/{p-3fd6ff27.entry.js → p-91757d9f.entry.js} +1 -1
  106. package/dist/webcomponents/{p-984ff1aa.entry.js → p-98e4eae3.entry.js} +1 -1
  107. package/dist/webcomponents/p-9e012e33.entry.js +1 -0
  108. package/dist/webcomponents/p-a1ef6b4c.entry.js +1 -0
  109. package/dist/webcomponents/p-ac8ee442.entry.js +1 -0
  110. package/dist/webcomponents/{p-21998fea.entry.js → p-af771964.entry.js} +1 -1
  111. package/dist/webcomponents/{p-742188d9.entry.js → p-b60a58f4.entry.js} +1 -1
  112. package/dist/webcomponents/p-bc91044c.entry.js +1 -0
  113. package/dist/webcomponents/{p-ce2e68df.entry.js → p-c0f9f6a8.entry.js} +3 -3
  114. package/dist/webcomponents/{p-98bb3c6a.entry.js → p-c29c587f.entry.js} +1 -1
  115. package/dist/webcomponents/p-e12ab547.js +1 -0
  116. package/dist/webcomponents/{p-6444d443.entry.js → p-e7ef2455.entry.js} +1 -1
  117. package/dist/webcomponents/{p-5cf9128c.entry.js → p-ed8c9b88.entry.js} +1 -1
  118. package/dist/webcomponents/p-f2f0aa6e.entry.js +1 -0
  119. package/dist/webcomponents/webcomponents.esm.js +1 -1
  120. package/package.json +3 -2
  121. package/readme.md +38 -10
  122. package/dist/webcomponents/p-0e51a185.entry.js +0 -1
  123. package/dist/webcomponents/p-10210702.entry.js +0 -1
  124. package/dist/webcomponents/p-3b80dc4a.entry.js +0 -1
  125. package/dist/webcomponents/p-44271b0c.entry.js +0 -1
  126. package/dist/webcomponents/p-52643813.entry.js +0 -1
  127. package/dist/webcomponents/p-656a6bc8.entry.js +0 -1
  128. package/dist/webcomponents/p-76983a7e.js +0 -1
  129. package/dist/webcomponents/p-76dffeec.js +0 -1
  130. package/dist/webcomponents/p-884b8cf4.entry.js +0 -1
  131. package/dist/webcomponents/p-a82e7fcd.entry.js +0 -1
  132. package/dist/webcomponents/p-b0fbddb2.entry.js +0 -1
  133. package/dist/webcomponents/p-d89b1a78.entry.js +0 -1
@@ -1,8 +1,8 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { A as Api } from './Api.js';
3
3
  import './Pagination.js';
4
- import './Payout.js';
5
- import { M as MapPaymentStatusToBadge, b as formatCurrency, a as formatDate, d as formatTime } from './utils2.js';
4
+ import { a as Payment } from './Payout.js';
5
+ import { M as MapPaymentStatusToBadge, b as formatCurrency, a as formatDate, d as formatTime, s as snakeCaseToHumanReadable } from './utils2.js';
6
6
  import { L as LoadingState, E as ErrorState, b as EntityHeadInfo, c as EntityHeadInfoItem, D as DetailSection, a as DetailItem, C as CodeBlock } from './utils.js';
7
7
  import { c as config } from './config.js';
8
8
  import { d as defineCustomElement$2 } from './details.js';
@@ -27,26 +27,35 @@ const PaymentDetails = /*@__PURE__*/ proxyCustomElement(class PaymentDetails ext
27
27
  this.fetchData();
28
28
  }
29
29
  async fetchData() {
30
- this.errorMessage = '';
31
30
  if (!this.paymentId || !this.authToken) {
32
31
  this.errorMessage = "Can not fetch any data without a PaymentID and an AuthToken";
33
32
  this.loading = false;
34
33
  return;
35
34
  }
36
35
  this.loading = true;
37
- const endpoint = `payments/${this.paymentId}`;
38
- const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
39
- if (!response.error) {
40
- this.payment = response.data;
36
+ try {
37
+ const endpoint = `payments/${this.paymentId}`;
38
+ const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
39
+ if (!response.error) {
40
+ this.payment = new Payment(response.data);
41
+ }
42
+ else {
43
+ const responseError = typeof response.error === 'string' ? response.error : response.error.message;
44
+ this.errorMessage = `Error trying to fetch data : ${responseError}`;
45
+ console.error(this.errorMessage);
46
+ }
41
47
  }
42
- else {
43
- this.errorMessage = typeof response.error === 'string' ? response.error : response.error.message;
48
+ catch (error) {
49
+ this.errorMessage = `Error trying to fetch data : ${error}`;
50
+ console.error(this.errorMessage);
51
+ }
52
+ finally {
53
+ this.loading = false;
44
54
  }
45
- this.loading = false;
46
55
  }
47
56
  render() {
48
- 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;
49
- return (h(Host, null, this.loading && LoadingState, !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && this.payment && (h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPaymentStatusToBadge((_a = this.payment) === null || _a === void 0 ? void 0 : _a.status) }), title: `${formatCurrency(this.payment.amount)} ${this.payment.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate((_b = this.payment) === null || _b === void 0 ? void 0 : _b.updated_at)} ${formatTime((_c = this.payment) === null || _c === void 0 ? void 0 : _c.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate((_d = this.payment) === null || _d === void 0 ? void 0 : _d.created_at)} ${formatTime((_e = this.payment) === null || _e === void 0 ? void 0 : _e.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: (_f = this.payment) === null || _f === void 0 ? void 0 : _f.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Amount", value: formatCurrency((_g = this.payment) === null || _g === void 0 ? void 0 : _g.amount) }), h(DetailItem, { title: "Fees", value: formatCurrency((_h = this.payment) === null || _h === void 0 ? void 0 : _h.fee_amount) }), h(DetailItem, { title: "Refunded", value: formatCurrency((_j = this.payment) === null || _j === void 0 ? void 0 : _j.amount_refunded) }), h(DetailItem, { title: "Net", value: formatCurrency((_k = this.payment) === null || _k === void 0 ? void 0 : _k.balance) }), h(DetailItem, { title: "Status", value: MapPaymentStatusToBadge((_l = this.payment) === null || _l === void 0 ? void 0 : _l.status) }), h(DetailItem, { title: "Payment ID", value: (_m = this.payment) === null || _m === void 0 ? void 0 : _m.id }), h(DetailItem, { title: "Processing Fees", value: formatCurrency((_o = this.payment) === null || _o === void 0 ? void 0 : _o.fee_amount) }), h(DetailItem, { title: "Statement Descriptor", value: (_p = this.payment) === null || _p === void 0 ? void 0 : _p.statement_descriptor }), h(DetailItem, { title: "Description", value: (_q = this.payment) === null || _q === void 0 ? void 0 : _q.description })), ((_r = this.payment) === null || _r === void 0 ? void 0 : _r.payment_method.card) && (h(DetailSection, { sectionTitle: "Payment Method" }, h(DetailItem, { title: "ID", value: (_s = this.payment) === null || _s === void 0 ? void 0 : _s.payment_method.card.id }), h(DetailItem, { title: "Payment Type", value: "Card" }), h(DetailItem, { title: "Last 4 Numbers", value: (_t = this.payment) === null || _t === void 0 ? void 0 : _t.payment_method.card.acct_last_four }), h(DetailItem, { title: "Brand", value: (_u = this.payment) === null || _u === void 0 ? void 0 : _u.payment_method.card.brand }), h(DetailItem, { title: "Cardholder", value: (_v = this.payment) === null || _v === void 0 ? void 0 : _v.payment_method.card.name }))), ((_w = this.payment) === null || _w === void 0 ? void 0 : _w.payment_method.bank_account) && (h(DetailSection, { sectionTitle: "Payment Method" }, h(DetailItem, { title: "ID", value: (_x = this.payment) === null || _x === void 0 ? void 0 : _x.payment_method.bank_account.id }), h(DetailItem, { title: "Last 4 Numbers", value: (_y = this.payment) === null || _y === void 0 ? void 0 : _y.payment_method.bank_account.acct_last_four }), h(DetailItem, { title: "Bank Name", value: (_z = this.payment) === null || _z === void 0 ? void 0 : _z.payment_method.bank_account.bank_name }), h(DetailItem, { title: "Account Owner", value: (_0 = this.payment) === null || _0 === void 0 ? void 0 : _0.payment_method.bank_account.account_owner_name }))), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: (_1 = this.payment) === null || _1 === void 0 ? void 0 : _1.metadata })))))));
57
+ return (h(Host, null, this.loading && LoadingState, !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && !this.errorMessage &&
58
+ 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)} ${this.payment.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 })))))));
50
59
  }
51
60
  static get watchers() { return {
52
61
  "paymentId": ["updateOnPropChange"],
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import './Pagination.js';
3
- import { a as PaymentMethodTypes } from './Payout.js';
3
+ import { b as PaymentMethodTypes } from './Payout.js';
4
4
  import { e as extractComputedFontsToLoad } from './utils2.js';
5
5
  import { d as defineCustomElement$6 } from './billing-form.js';
6
6
  import { d as defineCustomElement$5 } from './payment-method-form.js';
@@ -76,11 +76,21 @@ const PaymentForm = /*@__PURE__*/ proxyCustomElement(class PaymentForm extends H
76
76
  if (!billingFormValidation.isValid || !paymentMethodFormValidation.isValid)
77
77
  return;
78
78
  this.isLoading = true;
79
- const billingFormFieldValues = await this.billingFormRef.getValues();
80
- const paymentMethodData = Object.assign({ email: this.email }, billingFormFieldValues);
81
- const tokenizeResponse = await this.paymentMethodFormRef.tokenize(this.clientId, paymentMethodData, this.accountId);
82
- this.submitted.emit(tokenizeResponse);
83
- this.isLoading = false;
79
+ try {
80
+ const billingFormFieldValues = await this.billingFormRef.getValues();
81
+ const paymentMethodData = Object.assign({ email: this.email }, billingFormFieldValues);
82
+ const tokenizeResponse = await this.paymentMethodFormRef.tokenize(this.clientId, paymentMethodData, this.accountId);
83
+ if (tokenizeResponse.error) {
84
+ console.error(`An error occured submitting the form: ${tokenizeResponse.error.message}`);
85
+ }
86
+ this.submitted.emit(tokenizeResponse);
87
+ }
88
+ catch (error) {
89
+ console.error(`An error occured submitting the form: ${error}`);
90
+ }
91
+ finally {
92
+ this.isLoading = false;
93
+ }
84
94
  }
85
95
  render() {
86
96
  return (h(Host, null, h("form", { class: "row gy-3" }, this.allowedPaymentMethodTypes.length > 1 && (h("div", { class: "col-12" }, h("justifi-payment-method-selector", { paymentMethodTypes: this.allowedPaymentMethodTypes, selectedPaymentMethodType: this.selectedPaymentMethodType }))), h("div", { class: "col-12" }, h("justifi-payment-method-form", { "payment-method-form-type": this.selectedPaymentMethodType, "iframe-origin": this.iframeOrigin, ref: el => {
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { A as Api } from './Api.js';
3
3
  import { p as pagingDefaults } from './Pagination.js';
4
- import { b as Payment } from './Payout.js';
4
+ import { a as Payment } from './Payout.js';
5
5
  import { a as formatDate, d as formatTime, b as formatCurrency, M as MapPaymentStatusToBadge } from './utils2.js';
6
6
  import { c as config } from './config.js';
7
7
  import { d as defineCustomElement$3 } from './table.js';
@@ -47,28 +47,27 @@ const PaymentsList = /*@__PURE__*/ proxyCustomElement(class PaymentsList extends
47
47
  return;
48
48
  }
49
49
  this.loading = true;
50
- const api = Api(this.authToken, config.proxyApiOrigin);
51
- const endpoint = `account/${this.accountId}/payments`;
52
- const response = await api.get(endpoint, this.params);
53
- if (!response.error) {
54
- this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
55
- const data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.map(dataItem => new Payment(dataItem));
56
- this.payments = data;
57
- }
58
- else {
59
- this.errorMessage = typeof response.error === 'string' ? response.error : response.error.message;
50
+ try {
51
+ const api = Api(this.authToken, config.proxyApiOrigin);
52
+ const endpoint = `account/${this.accountId}/payments`;
53
+ const response = await api.get(endpoint, this.params);
54
+ if (!response.error) {
55
+ this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
56
+ const data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.map(dataItem => new Payment(dataItem));
57
+ this.payments = data;
58
+ }
59
+ else {
60
+ const responseError = typeof response.error === 'string' ? response.error : response.error.message;
61
+ console.error(`Error fetching payments: ${responseError}`);
62
+ this.errorMessage = 'No results';
63
+ }
60
64
  }
61
- this.loading = false;
62
- }
63
- getPaymentMethod(paymentMethod) {
64
- return paymentMethod.card || paymentMethod.bank_account;
65
- }
66
- getPaymentMethodName(paymentMethod) {
67
- if (paymentMethod.card) {
68
- return paymentMethod.card.name;
65
+ catch (error) {
66
+ console.error(`Error fetching payments: ${error.message}`);
67
+ this.errorMessage = 'No results';
69
68
  }
70
- else {
71
- return paymentMethod.bank_account.account_owner_name;
69
+ finally {
70
+ this.loading = false;
72
71
  }
73
72
  }
74
73
  render() {
@@ -96,8 +95,8 @@ const PaymentsList = /*@__PURE__*/ proxyCustomElement(class PaymentsList extends
96
95
  },
97
96
  formatCurrency(payment.amount),
98
97
  payment.description,
99
- this.getPaymentMethodName(payment.payment_method),
100
- this.getPaymentMethod(payment.payment_method).acct_last_four,
98
+ payment.payment_method.payersName,
99
+ payment.payment_method.lastFourDigits,
101
100
  {
102
101
  type: 'inner',
103
102
  value: MapPaymentStatusToBadge(payment.status)
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
  import { A as Api } from './Api.js';
3
3
  import './Pagination.js';
4
- import './Payout.js';
4
+ import { c as Payout } from './Payout.js';
5
5
  import { g as MapPayoutStatusToBadge, b as formatCurrency, a as formatDate, d as formatTime } from './utils2.js';
6
6
  import { L as LoadingState, E as ErrorState, b as EntityHeadInfo, c as EntityHeadInfoItem, D as DetailSection, a as DetailItem, C as CodeBlock } from './utils.js';
7
7
  import { c as config } from './config.js';
@@ -34,21 +34,29 @@ const PaymentDetails = /*@__PURE__*/ proxyCustomElement(class PaymentDetails ext
34
34
  return;
35
35
  }
36
36
  this.loading = true;
37
- const endpoint = `payouts/${this.payoutId}`;
38
- const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
39
- if (!response.error) {
40
- this.payout = response.data;
37
+ try {
38
+ const endpoint = `payouts/${this.payoutId}`;
39
+ const response = await Api(this.authToken, config.proxyApiOrigin).get(endpoint);
40
+ if (!response.error) {
41
+ this.payout = new Payout(response.data);
42
+ }
43
+ else {
44
+ const responseError = typeof response.error === 'string' ? response.error : response.error.message;
45
+ this.errorMessage = `Error fetching payout details: ${responseError}`;
46
+ console.error(this.errorMessage);
47
+ }
41
48
  }
42
- else {
43
- this.errorMessage = typeof response.error === 'string' ? response.error : response.error.message;
49
+ catch (error) {
50
+ this.errorMessage = `Error fetching payout details: ${error}`;
51
+ console.error(this.errorMessage);
52
+ }
53
+ finally {
54
+ this.loading = false;
44
55
  }
45
- this.loading = false;
46
56
  }
47
57
  render() {
48
58
  var _a;
49
- return (h(Host, null, this.loading ? LoadingState :
50
- !this.payout ? ErrorState(this.errorMessage) :
51
- h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPayoutStatusToBadge((_a = this.payout) === null || _a === void 0 ? void 0 : _a.status) }), title: `${formatCurrency(this.payout.amount)} ${this.payout.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate(this.payout.updated_at)} ${formatTime(this.payout.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.payout.created_at)} ${formatTime(this.payout.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.payout.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Date paid", value: formatDate(this.payout.deposits_at) }), h(DetailItem, { title: "Statement Description", value: this.payout.description }), h(DetailItem, { title: "Payout Method", value: this.payout.delivery_method }), h(DetailItem, { title: "Amount", value: formatCurrency(this.payout.amount) }), h(DetailItem, { title: "Fee", value: formatCurrency(this.payout.fees_total) })), h(DetailSection, { sectionTitle: "Account" }, h(DetailItem, { title: "ID", value: this.payout.account_id }), h(DetailItem, { title: "Account Type", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Institution", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Routing Number", value: this.payout.bank_account.routing_number }), h(DetailItem, { title: "Account Number", value: this.payout.bank_account.account_number_last4 })), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: this.payout.metadata }))))));
59
+ return (h(Host, null, this.loading && LoadingState, !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && this.payout && (h("justifi-details", { "error-message": this.errorMessage }, h(EntityHeadInfo, { slot: "head-info", badge: h("span", { slot: 'badge', innerHTML: MapPayoutStatusToBadge((_a = this.payout) === null || _a === void 0 ? void 0 : _a.status) }), title: `${formatCurrency(this.payout.amount)} ${this.payout.currency.toUpperCase()}` }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Updated At", value: `${formatDate(this.payout.updated_at)} ${formatTime(this.payout.updated_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.payout.created_at)} ${formatTime(this.payout.created_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.payout.id })), h("div", { slot: 'detail-sections' }, h(DetailSection, { sectionTitle: "Details" }, h(DetailItem, { title: "Date paid", value: formatDate(this.payout.deposits_at) }), h(DetailItem, { title: "Statement Description", value: this.payout.description }), h(DetailItem, { title: "Payout Method", value: this.payout.delivery_method }), h(DetailItem, { title: "Amount", value: formatCurrency(this.payout.amount) }), h(DetailItem, { title: "Fee", value: formatCurrency(this.payout.fees_total) })), h(DetailSection, { sectionTitle: "Account" }, h(DetailItem, { title: "ID", value: this.payout.account_id }), h(DetailItem, { title: "Account Type", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Institution", value: this.payout.bank_account.account_type }), h(DetailItem, { title: "Routing Number", value: this.payout.bank_account.routing_number }), h(DetailItem, { title: "Account Number", value: this.payout.bank_account.account_number_last4 })), h(DetailSection, { sectionTitle: 'Metadata' }, h(CodeBlock, { metadata: this.payout.metadata })))))));
52
60
  }
53
61
  static get watchers() { return {
54
62
  "payoutId": ["updateOnPropChange"],
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { A as Api } from './Api.js';
3
3
  import { p as pagingDefaults } from './Pagination.js';
4
- import { c as PayoutStatuses, d as PayoutStatusesSafeNames, e as Payout } from './Payout.js';
4
+ import { d as PayoutStatuses, e as PayoutStatusesSafeNames, c as Payout } from './Payout.js';
5
5
  import { a as formatDate, d as formatTime, b as formatCurrency } from './utils2.js';
6
6
  import { c as config } from './config.js';
7
7
  import { d as defineCustomElement$3 } from './table.js';
@@ -63,18 +63,28 @@ const PayoutsList = /*@__PURE__*/ proxyCustomElement(class PayoutsList extends H
63
63
  return;
64
64
  }
65
65
  this.loading = true;
66
- const api = Api(this.authToken, config.proxyApiOrigin);
67
- const endpoint = `account/${this.accountId}/payouts`;
68
- const response = await api.get(endpoint, this.params);
69
- if (!response.error) {
70
- this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
71
- const data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.map(dataItem => new Payout(dataItem));
72
- this.payouts = data;
66
+ try {
67
+ const api = Api(this.authToken, config.proxyApiOrigin);
68
+ const endpoint = `account/${this.accountId}/payouts`;
69
+ const response = await api.get(endpoint, this.params);
70
+ if (!response.error) {
71
+ this.paging = Object.assign(Object.assign({}, this.paging), response.page_info);
72
+ const data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.map(dataItem => new Payout(dataItem));
73
+ this.payouts = data;
74
+ }
75
+ else {
76
+ const responseError = typeof response.error === 'string' ? response.error : response.error.message;
77
+ console.error(`Error fetching payouts: ${responseError}`);
78
+ this.errorMessage = 'No results';
79
+ }
73
80
  }
74
- else {
75
- this.errorMessage = typeof response.error === 'string' ? response.error : response.error.message;
81
+ catch (error) {
82
+ console.error(`Error fetching payouts: ${error}`);
83
+ this.errorMessage = 'No results';
84
+ }
85
+ finally {
86
+ this.loading = false;
76
87
  }
77
- this.loading = false;
78
88
  }
79
89
  render() {
80
90
  return (h(Host, null, h("justifi-table", { rowClickHandler: (e) => {
@@ -68,10 +68,8 @@ const SubaccountDetails = /*@__PURE__*/ proxyCustomElement(class SubaccountDetai
68
68
  this.loading = false;
69
69
  }
70
70
  render() {
71
- var _a, _b, _c, _d, _e, _f;
72
- return (h(Host, null, this.loading ? LoadingState :
73
- !this.subaccount || !this.onboardingData ? ErrorState(this.errorMessage) :
74
- h("justifi-details", null, h(EntityHeadInfo, { slot: 'head-info', badge: h("span", { slot: 'badge', innerHTML: MapSubAccountStatusToBadge((_a = this.subaccount) === null || _a === void 0 ? void 0 : _a.status) }), title: (_b = this.subaccount) === null || _b === void 0 ? void 0 : _b.name }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.subaccount.created_at)} ${formatTime(this.subaccount.created_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Last Updated", value: `${formatDate(this.subaccount.updated_at)} ${formatTime(this.subaccount.updated_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.subaccount.id })), h("div", { slot: 'detail-sections' }, h("subaccount-account-details", { subaccount: this.subaccount, onboardingData: this.onboardingData }), h("subaccount-merchant-details", { onboardingData: this.onboardingData }), h("subaccount-representative-details", { data: (_d = (_c = this.onboardingData) === null || _c === void 0 ? void 0 : _c.payload) === null || _d === void 0 ? void 0 : _d.representative }), h("subaccount-owners-details", { data: (_f = (_e = this.onboardingData) === null || _e === void 0 ? void 0 : _e.payload) === null || _f === void 0 ? void 0 : _f.owners })))));
71
+ var _a, _b;
72
+ return (h(Host, null, this.loading && LoadingState, !this.loading && this.errorMessage && ErrorState(this.errorMessage), !this.loading && this.subaccount && this.onboardingData && (h("justifi-details", null, h(EntityHeadInfo, { slot: 'head-info', badge: h("span", { slot: 'badge', innerHTML: MapSubAccountStatusToBadge(this.subaccount.status) }), title: this.subaccount.name }, h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Created At", value: `${formatDate(this.subaccount.created_at)} ${formatTime(this.subaccount.created_at)}` }), h(EntityHeadInfoItem, { classes: "border-1 border-end", title: "Last Updated", value: `${formatDate(this.subaccount.updated_at)} ${formatTime(this.subaccount.updated_at)}` }), h(EntityHeadInfoItem, { title: "ID", value: this.subaccount.id })), h("div", { slot: 'detail-sections' }, h("subaccount-account-details", { subaccount: this.subaccount, onboardingData: this.onboardingData }), h("subaccount-merchant-details", { onboardingData: this.onboardingData }), h("subaccount-representative-details", { data: (_a = this.onboardingData.payload) === null || _a === void 0 ? void 0 : _a.representative }), h("subaccount-owners-details", { data: (_b = this.onboardingData.payload) === null || _b === void 0 ? void 0 : _b.owners }))))));
75
73
  }
76
74
  static get watchers() { return {
77
75
  "subaccountId": ["updateOnPropChange"],
@@ -12,7 +12,10 @@ const OwnerDetails = /*@__PURE__*/ proxyCustomElement(class OwnerDetails extends
12
12
  this.owners = undefined;
13
13
  }
14
14
  render() {
15
- return (h(Host, null, h(DetailSection, { sectionTitle: "Owner Details" }, h("div", { class: "row" }, !!(this === null || this === void 0 ? void 0 : this.owners.length) ? (this.owners.map(owner => (h("div", null, h("div", { class: "col-12 col-md-6" }, h(DetailItem, { title: "Name", value: owner.name }), h(DetailItem, { title: "Title", value: owner.title }), h(DetailItem, { title: "Email", value: owner.email }), h(DetailItem, { title: "Phone", value: owner.phone }), h(DetailItem, { title: "Date of Birth", value: formatMediumDate(new Date(Number(owner.dob_day), Number(owner.dob_month), Number(owner.dob_year))) }), h(DetailItem, { title: "Identification Number", value: `********${owner.ssn_last4}` })), h(DetailSection, { sectionTitle: "Owner Address" }, h("div", { class: "row gy-3" }, h("div", { class: "col-12 col-md-6" }, h(DetailItem, { title: "Line 1", value: owner.address.line1 }), h(DetailItem, { title: "Line 2", value: owner.address.line2 }), h(DetailItem, { title: "City", value: owner.address.city }), h(DetailItem, { title: "State", value: owner.address.state }), h(DetailItem, { title: "Zip", value: owner.address.postal_code })))))))) : (h(DetailItem, { title: "No owners", value: "" }))))));
15
+ return (h(Host, null, !!(this === null || this === void 0 ? void 0 : this.owners.length) ? (this.owners.map(owner => {
16
+ var _a, _b, _c, _d, _e;
17
+ return (h("div", { class: "row" }, h(DetailSection, { sectionTitle: `Owner ${owner === null || owner === void 0 ? void 0 : owner.name}'s Details` }, h(DetailItem, { title: "Name", value: owner === null || owner === void 0 ? void 0 : owner.name }), h(DetailItem, { title: "Title", value: owner === null || owner === void 0 ? void 0 : owner.title }), h(DetailItem, { title: "Email", value: owner === null || owner === void 0 ? void 0 : owner.email }), h(DetailItem, { title: "Phone", value: owner === null || owner === void 0 ? void 0 : owner.phone }), h(DetailItem, { title: "Date of Birth", value: formatMediumDate(new Date(Number(owner === null || owner === void 0 ? void 0 : owner.dob_day), Number(owner === null || owner === void 0 ? void 0 : owner.dob_month), Number(owner === null || owner === void 0 ? void 0 : owner.dob_year))) }), h(DetailItem, { title: "Identification Number", value: `********${owner === null || owner === void 0 ? void 0 : owner.ssn_last4}` }), h(DetailItem, { title: "Line 1", value: (_a = owner === null || owner === void 0 ? void 0 : owner.address) === null || _a === void 0 ? void 0 : _a.line1 }), h(DetailItem, { title: "Line 2", value: (_b = owner === null || owner === void 0 ? void 0 : owner.address) === null || _b === void 0 ? void 0 : _b.line2 }), h(DetailItem, { title: "City", value: (_c = owner === null || owner === void 0 ? void 0 : owner.address) === null || _c === void 0 ? void 0 : _c.city }), h(DetailItem, { title: "State", value: (_d = owner === null || owner === void 0 ? void 0 : owner.address) === null || _d === void 0 ? void 0 : _d.state }), h(DetailItem, { title: "Zip", value: (_e = owner === null || owner === void 0 ? void 0 : owner.address) === null || _e === void 0 ? void 0 : _e.postal_code }))));
18
+ })) : (h(DetailItem, { title: "No owners", value: "" }))));
16
19
  }
17
20
  static get style() { return ownerDetailsCss; }
18
21
  }, [1, "owner-details", {