@zeniai/client-epic-state 4.14.67 → 4.14.69

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.
@@ -67,13 +67,33 @@ const updateOnboardingCustomerViewEpic = (actions$, state$, zeniAPI) => actions$
67
67
  };
68
68
  }
69
69
  }
70
- const messageSection = sendForVerification === true
71
- ? currentStep === 'company_officer'
72
- ? 'onboarding_customer_identity_verification_submit'
73
- : 'onboarding_customer_business_verification_submit'
74
- : currentStep === 'company_officer'
75
- ? 'onboarding_customer_identity_verification_save'
76
- : 'onboarding_customer_business_verification_save';
70
+ const messageSectionMapper = {
71
+ company_officer: {
72
+ sendForVerification: 'onboarding_customer_identity_verification_submit',
73
+ save: 'onboarding_customer_identity_verification_save',
74
+ },
75
+ company_details: {
76
+ sendForVerification: 'onboarding_customer_business_verification_submit',
77
+ save: 'onboarding_customer_business_verification_save',
78
+ },
79
+ link_payment_account: {
80
+ save: 'billing_address_view',
81
+ sendForVerification: 'billing_address_view',
82
+ },
83
+ };
84
+ let messageSection;
85
+ if (isBillingAddressUpdate === true) {
86
+ messageSection = messageSectionMapper[currentStep].save;
87
+ }
88
+ else {
89
+ if (sendForVerification === true) {
90
+ messageSection =
91
+ messageSectionMapper[currentStep].sendForVerification;
92
+ }
93
+ else {
94
+ messageSection = messageSectionMapper[currentStep].save;
95
+ }
96
+ }
77
97
  return zeniAPI
78
98
  .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
79
99
  .pipe((0, operators_1.mergeMap)((response) => {
@@ -49,17 +49,25 @@ function getOnboardingCustomerView(state, companyId) {
49
49
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
50
50
  const accountingConnectionCreationMode = (_e = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.onboardingInfo) === null || _e === void 0 ? void 0 : _e.accountingConnectionCreationMode;
51
51
  const companyOfficerIds = companyView === null || companyView === void 0 ? void 0 : companyView.companyOfficers.map((officer) => officer.user.userId);
52
- const subscriptionBillingAddress = (_g = (_f = addressViewState.newAddressState) === null || _f === void 0 ? void 0 : _f.subscription_billing_address) === null || _g === void 0 ? void 0 : _g.addressToCreate;
52
+ const subscriptionBillingAddress = (_f = addressViewState.newAddressState) === null || _f === void 0 ? void 0 : _f.subscription_billing_address;
53
53
  const companyOfficers = (0, userSelector_1.getUsersByUserIds)(userState, companyOfficerIds !== null && companyOfficerIds !== void 0 ? companyOfficerIds : []);
54
54
  const companyOfficerRoles = (0, userRoleSelector_1.getUserRoleByUserIds)(userRoleState, companyOfficerIds !== null && companyOfficerIds !== void 0 ? companyOfficerIds : []);
55
- const primaryContact = ((_h = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _h === void 0 ? void 0 : _h.user.userId) != null
56
- ? (0, userSelector_1.getUserByUserId)(userState, (_j = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _j === void 0 ? void 0 : _j.user.userId)
55
+ const primaryContact = ((_g = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _g === void 0 ? void 0 : _g.user.userId) != null
56
+ ? (0, userSelector_1.getUserByUserId)(userState, (_h = companyView === null || companyView === void 0 ? void 0 : companyView.primaryContact) === null || _h === void 0 ? void 0 : _h.user.userId)
57
57
  : undefined;
58
58
  const { companyDetailsLocalData, companyOfficerLocalData } = (0, setupViewSelector_1.getCompanyAndIdentityDetails)(state, companyId, {
59
59
  companyDetails,
60
60
  companyOfficerUpdateStatus,
61
61
  primaryContactDetails,
62
62
  });
63
+ const companyAddress = (_j = addressViewState.newAddressState) === null || _j === void 0 ? void 0 : _j.company_address;
64
+ if (companyAddress == null &&
65
+ (companyView === null || companyView === void 0 ? void 0 : companyView.company.company.managementInfo.companyAddressId) == null &&
66
+ (companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyOnboardingInfo.subscriptionBillingAddressId) != null &&
67
+ companyDetailsLocalData != null &&
68
+ subscriptionBillingAddress != null) {
69
+ companyDetailsLocalData.addressStatus = subscriptionBillingAddress;
70
+ }
63
71
  const completedSteps = [];
64
72
  if ((((_l = (_k = paymentAccount === null || paymentAccount === void 0 ? void 0 : paymentAccount.providerVerificationStatus) === null || _k === void 0 ? void 0 : _k.code) === null || _l === void 0 ? void 0 : _l.includes('verified')) ===
65
73
  true &&
@@ -101,7 +109,7 @@ function getOnboardingCustomerView(state, companyId) {
101
109
  return {
102
110
  companyDetailsLocalData,
103
111
  companyOfficerLocalData,
104
- subscriptionBillingAddress,
112
+ subscriptionBillingAddress: subscriptionBillingAddress === null || subscriptionBillingAddress === void 0 ? void 0 : subscriptionBillingAddress.addressToCreate,
105
113
  companyView,
106
114
  allNationalityCountries,
107
115
  pendingSaveDetails: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.14.67",
3
+ "version": "4.14.69",
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",