@zeniai/client-epic-state 5.1.6 → 5.1.8
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/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +13 -7
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +8 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +15 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +12 -6
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +1 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +9 -1
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +15 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import { getUserRoleByUserIds } from '../../../entity/userRole/userRoleSelector'
|
|
|
8
8
|
import { getCompanyConfig } from '../../companyConfigView/companyConfigSelector';
|
|
9
9
|
import { getCompanyView } from '../../companyView/selectorHelpers/getCompanyView';
|
|
10
10
|
import { getCompanyAndIdentityDetails, } from '../../spendManagement/commonSetup/setupViewSelector';
|
|
11
|
-
import { ALL_ONBOARDING_STEPS, ALL_ZENI_USER_ONBOARDING_STEPS, REQUIRED_ONBOARDING_STEPS, ZENI_USER_REQUIRED_ONBOARDING_STEPS, emptyAiAgentsActivationSubview, toOnboardingStepType, } from './onboardingCustomerViewState';
|
|
11
|
+
import { ALL_ONBOARDING_STEPS, ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS, ALL_ZENI_USER_ONBOARDING_STEPS, REQUIRED_ONBOARDING_STEPS, ZENI_USER_REQUIRED_ONBOARDING_STEPS, emptyAiAgentsActivationSubview, toOnboardingStepType, } from './onboardingCustomerViewState';
|
|
12
12
|
export function getOnboardingCustomerView(state, companyId) {
|
|
13
13
|
const { fileState, paymentAccountState, onboardingCustomerViewState, userState, userRoleState, subscriptionPaymentAccountState, companyConfigState, cardPaymentViewState, countryListState, addressViewState, } = state;
|
|
14
14
|
const { companyDetails, companyOfficerUpdateStatus, primaryContactDetails, subscriptionPaymentAccountIds, paymentAccountDetails, plaidConnectionDetails, parsingDocumentFileIds, updateStatus, saveStatus, currentStep, currentSubStep, uiState, fetchState, error, } = onboardingCustomerViewState;
|
|
@@ -207,14 +207,20 @@ export function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles,
|
|
|
207
207
|
isPhoneVerified === true);
|
|
208
208
|
}
|
|
209
209
|
export const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
// 3 cohorts:
|
|
211
|
+
// - Core-only (banking/cards, no bookkeeping): no ledger, no integrations.
|
|
212
|
+
// - Zeni-team-connects-QBO bookkeeping: skip ledger but keep integrations
|
|
213
|
+
// so the customer can still wire up Plaid / Stripe / HubSpot / email.
|
|
214
|
+
// - Customer-connects-QBO bookkeeping: full 4-step flow.
|
|
215
|
+
const isCoreOnlyTenant = (productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
216
|
+
!productSettings.isBookkeepingEnabled;
|
|
217
|
+
const allStepsData = isCoreOnlyTenant
|
|
213
218
|
? ALL_ZENI_USER_ONBOARDING_STEPS
|
|
214
|
-
:
|
|
219
|
+
: accountingConnectionCreationMode === 'zeni_user'
|
|
220
|
+
? ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS
|
|
221
|
+
: ALL_ONBOARDING_STEPS;
|
|
215
222
|
const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
|
|
216
|
-
|
|
217
|
-
!productSettings.isBookkeepingEnabled)
|
|
223
|
+
isCoreOnlyTenant
|
|
218
224
|
? ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
219
225
|
: REQUIRED_ONBOARDING_STEPS;
|
|
220
226
|
return {
|
|
@@ -18,6 +18,14 @@ export const ALL_ZENI_USER_ONBOARDING_STEPS = [
|
|
|
18
18
|
...ZENI_USER_REQUIRED_ONBOARDING_STEPS,
|
|
19
19
|
...ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
|
|
20
20
|
];
|
|
21
|
+
// Zeni-team-connects-QBO bookkeeping tenants: skip the `connect_ledger` step
|
|
22
|
+
// (Zeni already did it) but keep `connect_data_source` so the customer can
|
|
23
|
+
// still wire up non-QBO integrations (Plaid, Stripe, HubSpot, email, etc.).
|
|
24
|
+
export const ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS = [
|
|
25
|
+
...ZENI_USER_REQUIRED_ONBOARDING_STEPS,
|
|
26
|
+
'connect_data_source',
|
|
27
|
+
...ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
|
|
28
|
+
];
|
|
21
29
|
export const ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = [
|
|
22
30
|
...CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
|
|
23
31
|
'connect_data_source',
|
|
@@ -11,7 +11,21 @@ import { KYC_KYB_AUTOFILL_MIN_CONFIDENCE, } from './types/kycKybAutofill';
|
|
|
11
11
|
export const OFFICER_ADDRESS_AUTOFILL_FIELD = 'officerAddress';
|
|
12
12
|
// US driving licenses carry a US state in `address_state` but no country field;
|
|
13
13
|
// default the composed address to the US.
|
|
14
|
-
|
|
14
|
+
// Extend's driving-license parser is US-focused — its response shape
|
|
15
|
+
// (`ExtendDrivingLicenseParsed`) only returns `issuing_state`, no
|
|
16
|
+
// `issuing_country` / `country_of_issue`. So we default the address country
|
|
17
|
+
// to US for autofill purposes.
|
|
18
|
+
//
|
|
19
|
+
// `country` is the alpha-3 ISO code (matches the rest of the codebase's
|
|
20
|
+
// address payloads — e.g. `subscriptionBillingAddress.country = 'USA'`).
|
|
21
|
+
// The Edit Address form's country dropdown looks up the option by alpha-3,
|
|
22
|
+
// so using the country name here would leave the dropdown blank.
|
|
23
|
+
//
|
|
24
|
+
// To support non-US driving licenses later: (1) extend the document-service
|
|
25
|
+
// Extend workflow to return an issuing-country field, (2) add it to
|
|
26
|
+
// `ExtendDrivingLicenseParsed`, (3) read it here with this US value as the
|
|
27
|
+
// fallback when the parser couldn't determine the country.
|
|
28
|
+
const DRIVING_LICENSE_DEFAULT_COUNTRY = 'USA';
|
|
15
29
|
const DRIVING_LICENSE_DEFAULT_COUNTRY_CODE = 'US';
|
|
16
30
|
const emptyResult = () => ({
|
|
17
31
|
values: {},
|
|
@@ -213,14 +213,20 @@ function isOfficerDetailsCompleted(companyOfficers, companyOfficerRoles, officer
|
|
|
213
213
|
isPhoneVerified === true);
|
|
214
214
|
}
|
|
215
215
|
const onboardingStepsData = (isValidConnection, productSettings, accountingConnectionCreationMode) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
// 3 cohorts:
|
|
217
|
+
// - Core-only (banking/cards, no bookkeeping): no ledger, no integrations.
|
|
218
|
+
// - Zeni-team-connects-QBO bookkeeping: skip ledger but keep integrations
|
|
219
|
+
// so the customer can still wire up Plaid / Stripe / HubSpot / email.
|
|
220
|
+
// - Customer-connects-QBO bookkeeping: full 4-step flow.
|
|
221
|
+
const isCoreOnlyTenant = (productSettings.isBankingEnabled || productSettings.isCardsEnabled) &&
|
|
222
|
+
!productSettings.isBookkeepingEnabled;
|
|
223
|
+
const allStepsData = isCoreOnlyTenant
|
|
219
224
|
? onboardingCustomerViewState_1.ALL_ZENI_USER_ONBOARDING_STEPS
|
|
220
|
-
:
|
|
225
|
+
: accountingConnectionCreationMode === 'zeni_user'
|
|
226
|
+
? onboardingCustomerViewState_1.ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS
|
|
227
|
+
: onboardingCustomerViewState_1.ALL_ONBOARDING_STEPS;
|
|
221
228
|
const requiredStepsData = (accountingConnectionCreationMode === 'zeni_user' && isValidConnection) ||
|
|
222
|
-
|
|
223
|
-
!productSettings.isBookkeepingEnabled)
|
|
229
|
+
isCoreOnlyTenant
|
|
224
230
|
? onboardingCustomerViewState_1.ZENI_USER_REQUIRED_ONBOARDING_STEPS
|
|
225
231
|
: onboardingCustomerViewState_1.REQUIRED_ONBOARDING_STEPS;
|
|
226
232
|
return {
|
|
@@ -8,6 +8,7 @@ export declare const CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO: readonly ["con
|
|
|
8
8
|
export declare const REQUIRED_ONBOARDING_STEPS: readonly ["setup_billing", "connect_ledger"];
|
|
9
9
|
export declare const ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT: readonly ["verification"];
|
|
10
10
|
export declare const ALL_ZENI_USER_ONBOARDING_STEPS: readonly ["setup_billing", "verification"];
|
|
11
|
+
export declare const ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS: readonly ["setup_billing", "connect_data_source", "verification"];
|
|
11
12
|
export declare const ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO: readonly ["connect_ledger", "connect_data_source", "verification"];
|
|
12
13
|
export declare const ALL_ONBOARDING_STEPS: readonly ["setup_billing", "connect_ledger", "connect_data_source", "verification"];
|
|
13
14
|
export declare const toOnboardingStepType: (v: string) => "setup_billing" | "connect_ledger" | "verification" | "connect_data_source";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emptyAiAgentsActivationSubview = exports.emptyAiAgentsActivationCounts = exports.toOnboardingSubStepType = exports.ALL_ONBOARDING_SUB_STEPS = exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
|
|
3
|
+
exports.emptyAiAgentsActivationSubview = exports.emptyAiAgentsActivationCounts = exports.toOnboardingSubStepType = exports.ALL_ONBOARDING_SUB_STEPS = exports.toOnboardingStepType = exports.ALL_ONBOARDING_STEPS = exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = exports.ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS = exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT = exports.REQUIRED_ONBOARDING_STEPS = exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO = exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
5
|
// Onboarding steps are the 4 top-level surfaces. Officer + details verification
|
|
6
6
|
// live as sub-steps under `verification` (state machine in CustomerOnboardingPage).
|
|
@@ -21,6 +21,14 @@ exports.ALL_ZENI_USER_ONBOARDING_STEPS = [
|
|
|
21
21
|
...exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS,
|
|
22
22
|
...exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
|
|
23
23
|
];
|
|
24
|
+
// Zeni-team-connects-QBO bookkeeping tenants: skip the `connect_ledger` step
|
|
25
|
+
// (Zeni already did it) but keep `connect_data_source` so the customer can
|
|
26
|
+
// still wire up non-QBO integrations (Plaid, Stripe, HubSpot, email, etc.).
|
|
27
|
+
exports.ALL_ZENI_USER_BOOKKEEPING_ONBOARDING_STEPS = [
|
|
28
|
+
...exports.ZENI_USER_REQUIRED_ONBOARDING_STEPS,
|
|
29
|
+
'connect_data_source',
|
|
30
|
+
...exports.ALL_ZENI_USER_ONBOARDING_STEPS_WITHOUT_ACCOUNT,
|
|
31
|
+
];
|
|
24
32
|
exports.ALL_CUSTOMER_ONBOARDING_STEPS_WITH_QBO = [
|
|
25
33
|
...exports.CUSTOMER_REQUIRED_ONBOARDING_STEPS_WITH_QBO,
|
|
26
34
|
'connect_data_source',
|
|
@@ -14,7 +14,21 @@ const kycKybAutofill_1 = require("./types/kycKybAutofill");
|
|
|
14
14
|
exports.OFFICER_ADDRESS_AUTOFILL_FIELD = 'officerAddress';
|
|
15
15
|
// US driving licenses carry a US state in `address_state` but no country field;
|
|
16
16
|
// default the composed address to the US.
|
|
17
|
-
|
|
17
|
+
// Extend's driving-license parser is US-focused — its response shape
|
|
18
|
+
// (`ExtendDrivingLicenseParsed`) only returns `issuing_state`, no
|
|
19
|
+
// `issuing_country` / `country_of_issue`. So we default the address country
|
|
20
|
+
// to US for autofill purposes.
|
|
21
|
+
//
|
|
22
|
+
// `country` is the alpha-3 ISO code (matches the rest of the codebase's
|
|
23
|
+
// address payloads — e.g. `subscriptionBillingAddress.country = 'USA'`).
|
|
24
|
+
// The Edit Address form's country dropdown looks up the option by alpha-3,
|
|
25
|
+
// so using the country name here would leave the dropdown blank.
|
|
26
|
+
//
|
|
27
|
+
// To support non-US driving licenses later: (1) extend the document-service
|
|
28
|
+
// Extend workflow to return an issuing-country field, (2) add it to
|
|
29
|
+
// `ExtendDrivingLicenseParsed`, (3) read it here with this US value as the
|
|
30
|
+
// fallback when the parser couldn't determine the country.
|
|
31
|
+
const DRIVING_LICENSE_DEFAULT_COUNTRY = 'USA';
|
|
18
32
|
const DRIVING_LICENSE_DEFAULT_COUNTRY_CODE = 'US';
|
|
19
33
|
const emptyResult = () => ({
|
|
20
34
|
values: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.8",
|
|
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",
|