@zeniai/client-epic-state 5.1.30-betaAK2 → 5.1.30-betaAK3

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.
@@ -1,11 +1,23 @@
1
1
  import recordGet from 'lodash/get';
2
2
  import { getInvoicingCustomerById } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector';
3
+ import { getInvoicingPaymentLinkSendState, getInvoicingPaymentMethodSaveState, getInvoicingPlaidLinkToken, getInvoicingSentPaymentLinkEmail, getInvoicingSetupIntent, getInvoicingSetupIntentFetchState, } from '../customerPaymentMethod/customerPaymentMethodSelector';
4
+ import { getInvoiceListItems } from '../invoiceList/invoiceListSelector';
5
+ import { getInvoicingSettings } from '../settingsView/settingsViewSelector';
3
6
  export const getInvoicingCustomerDetail = (state, invoicingCustomerID) => {
4
7
  const { invoicingCustomerState, invoicingCustomerDetailViewState } = state;
5
8
  const invoicingCustomerDetail = recordGet(invoicingCustomerDetailViewState.detailById, invoicingCustomerID, undefined);
6
- const invoicingCustomer = getInvoicingCustomerById(invoicingCustomerState, invoicingCustomerID);
9
+ const settings = getInvoicingSettings(state);
7
10
  return {
8
- invoicingCustomer,
11
+ invoicingCustomer: getInvoicingCustomerById(invoicingCustomerState, invoicingCustomerID),
12
+ invoices: getInvoiceListItems(state),
13
+ setupIntent: getInvoicingSetupIntent(state),
14
+ setupIntentFetchState: getInvoicingSetupIntentFetchState(state),
15
+ plaidLinkToken: getInvoicingPlaidLinkToken(state),
16
+ paymentMethodSaveState: getInvoicingPaymentMethodSaveState(state),
17
+ sendLinkState: getInvoicingPaymentLinkSendState(state),
18
+ sentPaymentLinkEmail: getInvoicingSentPaymentLinkEmail(state),
19
+ stripeConnected: settings?.stripe_connected_account_id != null &&
20
+ settings.stripe_connected_account_id !== '',
9
21
  fetchState: invoicingCustomerDetail?.fetchState ?? 'Not-Started',
10
22
  error: invoicingCustomerDetail?.error,
11
23
  version: 1.0,
@@ -1,8 +1,25 @@
1
- import { ID } from '../../../commonStateTypes/common';
1
+ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
+ import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoicePayload';
3
4
  import { InvoicingCustomer } from '../../../entity/invoicing/invoicingCustomer/invoicingCustomerState';
4
5
  import { RootState } from '../../../reducer';
6
+ import { InvoicingSetupIntent } from '../customerPaymentMethod/customerPaymentMethodState';
7
+ /**
8
+ * Read-only view for the customer detail page: the customer entity + its fetch
9
+ * state, plus everything the page renders in view mode — recent invoices, the
10
+ * Add-Payment-Method dialog state (setup intent / Plaid token / save), the
11
+ * payment-link send state, and whether Stripe is connected. Lets the detail
12
+ * screen depend on this single read selector.
13
+ */
5
14
  export interface InvoicingCustomerDetailView extends SelectorView {
15
+ invoices: InvoicingInvoice[];
16
+ paymentMethodSaveState: FetchStateAndError;
17
+ sendLinkState: FetchStateAndError;
18
+ setupIntentFetchState: FetchStateAndError;
19
+ stripeConnected: boolean;
6
20
  invoicingCustomer?: InvoicingCustomer;
21
+ plaidLinkToken?: string;
22
+ sentPaymentLinkEmail?: string;
23
+ setupIntent?: InvoicingSetupIntent;
7
24
  }
8
25
  export declare const getInvoicingCustomerDetail: (state: RootState, invoicingCustomerID: ID) => InvoicingCustomerDetailView;
@@ -6,12 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getInvoicingCustomerDetail = void 0;
7
7
  const get_1 = __importDefault(require("lodash/get"));
8
8
  const invoicingCustomerSelector_1 = require("../../../entity/invoicing/invoicingCustomer/invoicingCustomerSelector");
9
+ const customerPaymentMethodSelector_1 = require("../customerPaymentMethod/customerPaymentMethodSelector");
10
+ const invoiceListSelector_1 = require("../invoiceList/invoiceListSelector");
11
+ const settingsViewSelector_1 = require("../settingsView/settingsViewSelector");
9
12
  const getInvoicingCustomerDetail = (state, invoicingCustomerID) => {
10
13
  const { invoicingCustomerState, invoicingCustomerDetailViewState } = state;
11
14
  const invoicingCustomerDetail = (0, get_1.default)(invoicingCustomerDetailViewState.detailById, invoicingCustomerID, undefined);
12
- const invoicingCustomer = (0, invoicingCustomerSelector_1.getInvoicingCustomerById)(invoicingCustomerState, invoicingCustomerID);
15
+ const settings = (0, settingsViewSelector_1.getInvoicingSettings)(state);
13
16
  return {
14
- invoicingCustomer,
17
+ invoicingCustomer: (0, invoicingCustomerSelector_1.getInvoicingCustomerById)(invoicingCustomerState, invoicingCustomerID),
18
+ invoices: (0, invoiceListSelector_1.getInvoiceListItems)(state),
19
+ setupIntent: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntent)(state),
20
+ setupIntentFetchState: (0, customerPaymentMethodSelector_1.getInvoicingSetupIntentFetchState)(state),
21
+ plaidLinkToken: (0, customerPaymentMethodSelector_1.getInvoicingPlaidLinkToken)(state),
22
+ paymentMethodSaveState: (0, customerPaymentMethodSelector_1.getInvoicingPaymentMethodSaveState)(state),
23
+ sendLinkState: (0, customerPaymentMethodSelector_1.getInvoicingPaymentLinkSendState)(state),
24
+ sentPaymentLinkEmail: (0, customerPaymentMethodSelector_1.getInvoicingSentPaymentLinkEmail)(state),
25
+ stripeConnected: settings?.stripe_connected_account_id != null &&
26
+ settings.stripe_connected_account_id !== '',
15
27
  fetchState: invoicingCustomerDetail?.fetchState ?? 'Not-Started',
16
28
  error: invoicingCustomerDetail?.error,
17
29
  version: 1.0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.30-betaAK2",
3
+ "version": "5.1.30-betaAK3",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",