@zeniai/client-epic-state 4.16.50 → 4.16.51

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.
@@ -32,6 +32,9 @@ interface TenantPayload {
32
32
  is_spend_management_enabled: boolean;
33
33
  is_other_products_enabled: boolean;
34
34
  is_card_enabled: boolean;
35
+ is_payroll_enabled: boolean;
36
+ is_cfo_enabled: boolean;
37
+ is_tax_enabled: boolean;
35
38
  is_admin: boolean;
36
39
  is_zeni_support_user: boolean;
37
40
  is_bookkeeping_admin: boolean;
@@ -395,6 +395,9 @@ function mapTenantPayloadToTenant(payload, userTenantPayload) {
395
395
  isBookkeepingEnabled: payload.is_book_keeping_enabled,
396
396
  isOtherProductsEnabled: payload.is_other_products_enabled,
397
397
  isCardsEnabled: payload.is_card_enabled,
398
+ isPayrollEnabled: payload.is_payroll_enabled,
399
+ isCfoEnabled: payload.is_cfo_enabled,
400
+ isTaxEnabled: payload.is_tax_enabled,
398
401
  },
399
402
  userLastCheckInTime: payload.user_last_check_in_time_into_tenant != null
400
403
  ? (0, zeniDayJS_1.date)(payload.user_last_check_in_time_into_tenant)
@@ -42,6 +42,9 @@ export interface TenantProductSettings {
42
42
  isSpendManagementEnabled: boolean;
43
43
  isOtherProductsEnabled: boolean;
44
44
  isCardsEnabled: boolean;
45
+ isPayrollEnabled: boolean;
46
+ isCfoEnabled: boolean;
47
+ isTaxEnabled: boolean;
45
48
  }
46
49
  export interface Tenant {
47
50
  tenantId: ID;
@@ -22,4 +22,4 @@ export interface TransactionVendorSelectorView extends SelectorView {
22
22
  editVendorState?: TransactionVendorDetails;
23
23
  newVendorState?: TransactionVendorDetails;
24
24
  }
25
- export declare const getTransactionVendorView: (state: RootState, vendorId?: ID) => TransactionVendorSelectorView;
25
+ export declare const getTransactionVendorView: (state: RootState, vendorId?: ID, initialVendorCategoryId?: ID, initialVendorClassId?: ID) => TransactionVendorSelectorView;
@@ -6,8 +6,8 @@ const userSelector_1 = require("../../../entity/user/userSelector");
6
6
  const accountListSelector_1 = require("../../accountList/accountListSelector");
7
7
  const classListSelector_1 = require("../../classList/classListSelector");
8
8
  const transactionVendorViewReducer_1 = require("./transactionVendorViewReducer");
9
- const getTransactionVendorView = (state, vendorId) => {
10
- var _a, _b, _c, _d;
9
+ const getTransactionVendorView = (state, vendorId, initialVendorCategoryId, initialVendorClassId) => {
10
+ var _a, _b, _c, _d, _e;
11
11
  const { accountListState, accountState, classListState, classState, transactionVendorViewState, } = state;
12
12
  const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
13
13
  const classList = (0, classListSelector_1.getClassList)(classState, classListState);
@@ -26,9 +26,13 @@ const getTransactionVendorView = (state, vendorId) => {
26
26
  fetchState = (0, reduceFetchState_1.reduceFetchState)([accountList, classList]);
27
27
  }
28
28
  else {
29
+ const vendorDetailLocalData = ((_d = transactionVendorViewState.newVendorState) === null || _d === void 0 ? void 0 : _d.vendorDetailLocalData) || {};
29
30
  newVendorState = {
30
- saveStatus: transactionVendorViewState.newVendorState.saveStatus,
31
- vendorDetailLocalData: (_d = transactionVendorViewState.newVendorState) === null || _d === void 0 ? void 0 : _d.vendorDetailLocalData,
31
+ saveStatus: (_e = transactionVendorViewState.newVendorState.saveStatus) !== null && _e !== void 0 ? _e : {
32
+ fetchState: 'Not-Started',
33
+ error: undefined,
34
+ },
35
+ vendorDetailLocalData: Object.assign(Object.assign({}, vendorDetailLocalData), { vendorCategory: initialVendorCategoryId, vendorClass: initialVendorClassId }),
32
36
  };
33
37
  fetchState = (0, reduceFetchState_1.reduceFetchState)([
34
38
  { fetchState: accountList.fetchState, error: accountList.error },
@@ -133,7 +133,17 @@ const getSelectedProducts = (tenant) => {
133
133
  ];
134
134
  }
135
135
  else if (isOtherProductsEnabled) {
136
- return ['other'];
136
+ const selectedProducts = [];
137
+ if (tenant.productSettings.isCfoEnabled) {
138
+ selectedProducts.push('zeni_cfo');
139
+ }
140
+ if (tenant.productSettings.isTaxEnabled) {
141
+ selectedProducts.push('zeni_tax');
142
+ }
143
+ if (tenant.productSettings.isPayrollEnabled) {
144
+ selectedProducts.push('zeni_payroll');
145
+ }
146
+ return selectedProducts;
137
147
  }
138
148
  else {
139
149
  return [];
@@ -67,6 +67,9 @@ export interface OnboardingCustomerPayload extends Partial<OnboardingEmailGroupP
67
67
  is_spend_management_enabled: boolean;
68
68
  is_other_products_enabled: boolean;
69
69
  is_card_enabled: boolean;
70
+ is_payroll_enabled: boolean;
71
+ is_cfo_enabled: boolean;
72
+ is_tax_enabled: boolean;
70
73
  }
71
74
  export declare const toOnboardingCustomerPayload: (onboardingCustomer: Partial<NewOnboardingCustomer>, sendInvite: boolean, company?: CompanyWithSchema, tenant?: Tenant) => Partial<OnboardingCustomerPayload>;
72
75
  export {};
@@ -18,49 +18,69 @@ const toOnboardingCustomerPayload = (onboardingCustomer, sendInvite, company, te
18
18
  is_card_enabled: false,
19
19
  is_spend_management_enabled: false,
20
20
  is_other_products_enabled: false,
21
+ is_payroll_enabled: false,
22
+ is_cfo_enabled: false,
23
+ is_tax_enabled: false,
21
24
  };
22
25
  if (selectedProducts != null) {
23
26
  const isChecking = selectedProducts.includes('zeni_checking');
24
27
  const isCards = selectedProducts.includes('zeni_cards');
25
28
  const isBookkeeping = selectedProducts.includes('bookkeeping');
26
- const isOther = selectedProducts.includes('other');
27
- if (isBookkeeping) {
28
- onboardingCustomerPayload.is_book_keeping_enabled = true;
29
- onboardingCustomerPayload.is_banking_enabled = true;
30
- onboardingCustomerPayload.is_spend_management_enabled = true;
31
- onboardingCustomerPayload.is_other_products_enabled = false;
32
- onboardingCustomerPayload.is_card_enabled = true;
33
- }
34
- else if (isChecking && isCards && !isBookkeeping) {
35
- // for card and checking
36
- onboardingCustomerPayload.is_book_keeping_enabled = false;
37
- onboardingCustomerPayload.is_banking_enabled = true;
38
- onboardingCustomerPayload.is_spend_management_enabled = false;
39
- onboardingCustomerPayload.is_other_products_enabled = false;
40
- onboardingCustomerPayload.is_card_enabled = true;
41
- }
42
- else if (isCards && !isBookkeeping) {
43
- // for card only
29
+ const isPayroll = selectedProducts.includes('zeni_payroll');
30
+ const isCFO = selectedProducts.includes('zeni_cfo');
31
+ const isTax = selectedProducts.includes('zeni_tax');
32
+ const isOtherProducts = isPayroll || isCFO || isTax;
33
+ onboardingCustomerPayload.is_other_products_enabled = isOtherProducts;
34
+ // Always set other product flags explicitly
35
+ onboardingCustomerPayload.is_payroll_enabled = isPayroll;
36
+ onboardingCustomerPayload.is_cfo_enabled = isCFO;
37
+ onboardingCustomerPayload.is_tax_enabled = isTax;
38
+ if (isOtherProducts) {
39
+ // Disable all core product flags if any other product is selected
44
40
  onboardingCustomerPayload.is_book_keeping_enabled = false;
45
41
  onboardingCustomerPayload.is_banking_enabled = false;
46
42
  onboardingCustomerPayload.is_spend_management_enabled = false;
47
- onboardingCustomerPayload.is_other_products_enabled = false;
48
- onboardingCustomerPayload.is_card_enabled = true;
49
- }
50
- else if (isChecking && !isBookkeeping) {
51
- //for checking only
52
- onboardingCustomerPayload.is_book_keeping_enabled = false;
53
- onboardingCustomerPayload.is_banking_enabled = true;
54
- onboardingCustomerPayload.is_spend_management_enabled = false;
55
- onboardingCustomerPayload.is_other_products_enabled = false;
56
43
  onboardingCustomerPayload.is_card_enabled = false;
57
44
  }
58
- else if (isOther) {
59
- onboardingCustomerPayload.is_book_keeping_enabled = false;
60
- onboardingCustomerPayload.is_banking_enabled = false;
61
- onboardingCustomerPayload.is_spend_management_enabled = false;
62
- onboardingCustomerPayload.is_other_products_enabled = true;
63
- onboardingCustomerPayload.is_card_enabled = false;
45
+ else {
46
+ // Disable all other product flags
47
+ onboardingCustomerPayload.is_payroll_enabled = false;
48
+ onboardingCustomerPayload.is_cfo_enabled = false;
49
+ onboardingCustomerPayload.is_tax_enabled = false;
50
+ if (isBookkeeping) {
51
+ onboardingCustomerPayload.is_book_keeping_enabled = true;
52
+ onboardingCustomerPayload.is_banking_enabled = true;
53
+ onboardingCustomerPayload.is_spend_management_enabled = true;
54
+ onboardingCustomerPayload.is_card_enabled = true;
55
+ }
56
+ else if (isChecking && isCards) {
57
+ // for checking and cards
58
+ onboardingCustomerPayload.is_book_keeping_enabled = false;
59
+ onboardingCustomerPayload.is_banking_enabled = true;
60
+ onboardingCustomerPayload.is_spend_management_enabled = false;
61
+ onboardingCustomerPayload.is_card_enabled = true;
62
+ }
63
+ else if (isCards) {
64
+ // for cards only
65
+ onboardingCustomerPayload.is_book_keeping_enabled = false;
66
+ onboardingCustomerPayload.is_banking_enabled = false;
67
+ onboardingCustomerPayload.is_spend_management_enabled = false;
68
+ onboardingCustomerPayload.is_card_enabled = true;
69
+ }
70
+ else if (isChecking) {
71
+ // for checking only
72
+ onboardingCustomerPayload.is_book_keeping_enabled = false;
73
+ onboardingCustomerPayload.is_banking_enabled = true;
74
+ onboardingCustomerPayload.is_spend_management_enabled = false;
75
+ onboardingCustomerPayload.is_card_enabled = false;
76
+ }
77
+ else {
78
+ // Nothing selected: disable all core flags
79
+ onboardingCustomerPayload.is_book_keeping_enabled = false;
80
+ onboardingCustomerPayload.is_banking_enabled = false;
81
+ onboardingCustomerPayload.is_spend_management_enabled = false;
82
+ onboardingCustomerPayload.is_card_enabled = false;
83
+ }
64
84
  }
65
85
  }
66
86
  if (Boolean(companyId) === true) {
@@ -247,8 +247,18 @@ const allProductsList = [
247
247
  group: 'spend_management',
248
248
  },
249
249
  {
250
- code: 'other',
251
- name: 'Other',
250
+ code: 'zeni_payroll',
251
+ name: 'Zeni Payroll',
252
+ group: 'other',
253
+ },
254
+ {
255
+ code: 'zeni_cfo',
256
+ name: 'Zeni CFO',
257
+ group: 'other',
258
+ },
259
+ {
260
+ code: 'zeni_tax',
261
+ name: 'Zeni Tax',
252
262
  group: 'other',
253
263
  },
254
264
  ];
@@ -5,8 +5,8 @@ import { Tenant } from '../../../../entity/tenant/tenantState';
5
5
  import { CompanyDetailsLocalData, PrimaryContactLocalData } from '../../../spendManagement/commonSetup/setupViewState';
6
6
  declare const toProductGroupType: (v: string) => "other" | "bookkeeping" | "banking" | "spend_management" | "cards";
7
7
  export type ProductGroupType = ReturnType<typeof toProductGroupType>;
8
- export declare const toProductType: (v: string) => "other" | "bookkeeping" | "zeni_checking" | "zeni_bill_pay" | "zeni_reimbursements" | "zeni_cards";
9
- export declare const toProductTypeStrict: (v: string) => "other" | "bookkeeping" | "zeni_checking" | "zeni_bill_pay" | "zeni_reimbursements" | "zeni_cards" | undefined;
8
+ export declare const toProductType: (v: string) => "other" | "bookkeeping" | "zeni_checking" | "zeni_bill_pay" | "zeni_reimbursements" | "zeni_cards" | "zeni_payroll" | "zeni_cfo" | "zeni_tax";
9
+ export declare const toProductTypeStrict: (v: string) => "other" | "bookkeeping" | "zeni_checking" | "zeni_bill_pay" | "zeni_reimbursements" | "zeni_cards" | "zeni_payroll" | "zeni_cfo" | "zeni_tax" | undefined;
10
10
  export type ProductType = ReturnType<typeof toProductType>;
11
11
  export interface OnboardingCustomer {
12
12
  company: CompanyWithSchema;
@@ -18,6 +18,9 @@ const ALL_PRODUCTS = [
18
18
  'zeni_reimbursements',
19
19
  'zeni_cards',
20
20
  'other',
21
+ 'zeni_payroll',
22
+ 'zeni_cfo',
23
+ 'zeni_tax',
21
24
  ];
22
25
  const toProductType = (v) => (0, stringToUnion_1.stringToUnion)(v, ALL_PRODUCTS);
23
26
  exports.toProductType = toProductType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.16.50",
3
+ "version": "4.16.51",
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
  "types": "lib/index.d.ts",