@zeniai/client-epic-state 5.2.97-beta0KB → 5.2.97-beta1KB
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/lib/entity/genericEntity/entitySelector.d.ts +1 -3
- package/lib/entity/genericEntity/entitySelector.js +0 -8
- package/lib/esm/entity/genericEntity/entitySelector.js +0 -4
- package/lib/esm/view/transactionDetail/createTransaction/createTransactionPayload.js +2 -8
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.d.ts +2 -4
- package/lib/view/transactionDetail/createTransaction/createTransactionPayload.js +2 -8
- package/lib/view/transactionDetail/createTransaction/createTransactionState.d.ts +0 -2
- package/package.json +1 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { Entity } from './entity';
|
|
3
2
|
import { EntityState } from './entityState';
|
|
4
|
-
export declare function getEntityByEntityIDs(entityState: EntityState, entityIds: ID[]): Entity[];
|
|
5
|
-
export declare function getEntityByEntityId(entityState: EntityState, entityId: ID): Entity | undefined;
|
|
3
|
+
export declare function getEntityByEntityIDs(entityState: EntityState, entityIds: ID[]): import("./entity").Entity[];
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getEntityByEntityIDs = getEntityByEntityIDs;
|
|
7
|
-
exports.getEntityByEntityId = getEntityByEntityId;
|
|
8
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
9
4
|
function getEntityByEntityIDs(entityState, entityIds) {
|
|
10
5
|
return entityIds.map((entityId) => {
|
|
11
6
|
return entityState.entityById[entityId];
|
|
12
7
|
});
|
|
13
8
|
}
|
|
14
|
-
function getEntityByEntityId(entityState, entityId) {
|
|
15
|
-
return (0, get_1.default)(entityState.entityById, entityId, undefined);
|
|
16
|
-
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import recordGet from 'lodash/get';
|
|
2
1
|
export function getEntityByEntityIDs(entityState, entityIds) {
|
|
3
2
|
return entityIds.map((entityId) => {
|
|
4
3
|
return entityState.entityById[entityId];
|
|
5
4
|
});
|
|
6
5
|
}
|
|
7
|
-
export function getEntityByEntityId(entityState, entityId) {
|
|
8
|
-
return recordGet(entityState.entityById, entityId, undefined);
|
|
9
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_DATE_FORMAT } from '../../../commonStateTypes/timePeriod';
|
|
2
2
|
import { getAccountBaseForTransferAccounts } from '../../../entity/account/accountSelector';
|
|
3
3
|
import { getClassById } from '../../../entity/class/classSelector';
|
|
4
|
-
import { getEntityByEntityId } from '../../../entity/genericEntity/entitySelector';
|
|
5
4
|
import { toProjectBasePayload, } from '../../../entity/project/projectPayload';
|
|
6
5
|
import { getProjectById } from '../../../entity/project/projectSelector';
|
|
7
6
|
import { getVendorByQboId, getVendorByVendorId, } from '../../../entity/vendor/vendorSelector';
|
|
@@ -94,14 +93,10 @@ const toSyncedVendorQboId = (vendor) => {
|
|
|
94
93
|
}
|
|
95
94
|
return vendor.qboId;
|
|
96
95
|
};
|
|
97
|
-
/**
|
|
98
|
-
* Resolves the picked vendor to its QBO id -- `vendor_id` on the wire is a QBO id. A vendor
|
|
99
|
-
* found by the server-side search is only in the entity store, keyed by its entity id.
|
|
100
|
-
*/
|
|
96
|
+
/** Resolves a Zeni vendor id to its QBO id -- `vendor_id` on the wire is a QBO id. */
|
|
101
97
|
const toQboVendorId = (state, vendorId) => vendorId == null
|
|
102
98
|
? undefined
|
|
103
|
-
: toSyncedVendorQboId(getVendorByVendorId(state.vendorState, vendorId)
|
|
104
|
-
getEntityByEntityId(state.entityState, vendorId));
|
|
99
|
+
: toSyncedVendorQboId(getVendorByVendorId(state.vendorState, vendorId));
|
|
105
100
|
/** A journal entry line holds the QBO id already, so it is only checked against the store. */
|
|
106
101
|
const toQboLineVendorId = (state, vendorQboId) => vendorQboId == null
|
|
107
102
|
? undefined
|
|
@@ -133,7 +128,6 @@ export const prepareCreateTransactionPayload = (state, localData) => {
|
|
|
133
128
|
if (transactionType === 'journal_entry') {
|
|
134
129
|
return {
|
|
135
130
|
...base,
|
|
136
|
-
document_id: localData.documentId,
|
|
137
131
|
lines,
|
|
138
132
|
};
|
|
139
133
|
}
|
|
@@ -12,8 +12,8 @@ import { CreateTransactionLocalData } from './createTransactionState';
|
|
|
12
12
|
* 1. `line_detail_type` is snake_case. The PascalCase strings in the backend are Python
|
|
13
13
|
* constant NAMES; ZENI_LINE_DETAIL_TYPE_TO_QBO_LINE_DETAIL_TYPE_MAP converts them for the
|
|
14
14
|
* body the backend sends on to QuickBooks, never for ours.
|
|
15
|
-
* 2.
|
|
16
|
-
*
|
|
15
|
+
* 2. Only the QBO Purchases (check, credit_card_credit) send a reference number, as
|
|
16
|
+
* `document_number`. A journal entry sends none.
|
|
17
17
|
*/
|
|
18
18
|
export interface CreateTransactionAccountPayload {
|
|
19
19
|
qbo_id: ID;
|
|
@@ -51,8 +51,6 @@ export interface CreateTransactionRemitToAddressPayload {
|
|
|
51
51
|
export interface CreateTransactionRequest extends Record<string, unknown> {
|
|
52
52
|
transaction_date: string;
|
|
53
53
|
transaction_type: string;
|
|
54
|
-
/** journal_entry reference number. */
|
|
55
|
-
document_id?: string;
|
|
56
54
|
/** check / credit_card_credit reference number (QBO Purchase). */
|
|
57
55
|
document_number?: string;
|
|
58
56
|
from_account_id?: ID;
|
|
@@ -4,7 +4,6 @@ exports.prepareCreateTransactionPayload = exports.UnresolvedCreateTransactionIdE
|
|
|
4
4
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
5
5
|
const accountSelector_1 = require("../../../entity/account/accountSelector");
|
|
6
6
|
const classSelector_1 = require("../../../entity/class/classSelector");
|
|
7
|
-
const entitySelector_1 = require("../../../entity/genericEntity/entitySelector");
|
|
8
7
|
const projectPayload_1 = require("../../../entity/project/projectPayload");
|
|
9
8
|
const projectSelector_1 = require("../../../entity/project/projectSelector");
|
|
10
9
|
const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
@@ -98,14 +97,10 @@ const toSyncedVendorQboId = (vendor) => {
|
|
|
98
97
|
}
|
|
99
98
|
return vendor.qboId;
|
|
100
99
|
};
|
|
101
|
-
/**
|
|
102
|
-
* Resolves the picked vendor to its QBO id -- `vendor_id` on the wire is a QBO id. A vendor
|
|
103
|
-
* found by the server-side search is only in the entity store, keyed by its entity id.
|
|
104
|
-
*/
|
|
100
|
+
/** Resolves a Zeni vendor id to its QBO id -- `vendor_id` on the wire is a QBO id. */
|
|
105
101
|
const toQboVendorId = (state, vendorId) => vendorId == null
|
|
106
102
|
? undefined
|
|
107
|
-
: toSyncedVendorQboId((0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId)
|
|
108
|
-
(0, entitySelector_1.getEntityByEntityId)(state.entityState, vendorId));
|
|
103
|
+
: toSyncedVendorQboId((0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId));
|
|
109
104
|
/** A journal entry line holds the QBO id already, so it is only checked against the store. */
|
|
110
105
|
const toQboLineVendorId = (state, vendorQboId) => vendorQboId == null
|
|
111
106
|
? undefined
|
|
@@ -137,7 +132,6 @@ const prepareCreateTransactionPayload = (state, localData) => {
|
|
|
137
132
|
if (transactionType === 'journal_entry') {
|
|
138
133
|
return {
|
|
139
134
|
...base,
|
|
140
|
-
document_id: localData.documentId,
|
|
141
135
|
lines,
|
|
142
136
|
};
|
|
143
137
|
}
|
|
@@ -54,8 +54,6 @@ export interface CreateTransactionLocalData {
|
|
|
54
54
|
/** Empty for transfer, which has no lines at all. */
|
|
55
55
|
lines: CreateTransactionLineLocalData[];
|
|
56
56
|
transactionType: CreatableTransactionType;
|
|
57
|
-
/** journal_entry reference number. */
|
|
58
|
-
documentId?: string;
|
|
59
57
|
/** check / credit_card_credit reference number. */
|
|
60
58
|
documentNumber?: string;
|
|
61
59
|
/** transfer */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.97-
|
|
3
|
+
"version": "5.2.97-beta1KB",
|
|
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",
|