@zeniai/client-epic-state 5.1.85-betaRD1 → 5.1.85

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.
@@ -730,9 +730,7 @@ const aiCfo = (0, toolkit_1.createSlice)({
730
730
  },
731
731
  extraReducers: (builder) => {
732
732
  builder.addCase(rootActions_1.clearAll, (draft) => {
733
- draft.aiCfoByChatSessionId = {};
734
- draft.partialQuestionAnswers = {};
735
- draft.syntheticAnswersByChatSessionId = {};
733
+ Object.assign(draft, exports.initialAiCfoState);
736
734
  });
737
735
  },
738
736
  });
@@ -202,7 +202,10 @@ const company = (0, toolkit_1.createSlice)({
202
202
  },
203
203
  extraReducers: (builder) => {
204
204
  builder.addCase(rootActions_1.clearAll, (draft, action) => {
205
- if (!action.payload.keepTenantCompanyState) {
205
+ // `=== false` rather than `!`: the flag is required at the type level, but an
206
+ // untyped or stale-build caller doing `clearAll()` would send `undefined`,
207
+ // and defaulting that to "wipe" is the dangerous direction. Keep is safe.
208
+ if (action.payload.keepTenantCompanyState === false) {
206
209
  Object.assign(draft, exports.initialState);
207
210
  }
208
211
  });
@@ -33,7 +33,9 @@ const depositAccount = (0, toolkit_1.createSlice)({
33
33
  },
34
34
  extraReducers: (builder) => {
35
35
  builder.addCase(rootActions_1.clearAll, (draft) => {
36
- draft.depositAccountByID = {};
36
+ // Full reset rather than mirroring clearAllDepositAccounts, which leaves
37
+ // depositAccountLimitForChargeCardByID holding the previous tenant's limits.
38
+ Object.assign(draft, exports.initialState);
37
39
  });
38
40
  },
39
41
  });
@@ -921,7 +921,10 @@ const tenant = (0, toolkit_1.createSlice)({
921
921
  },
922
922
  extraReducers: (builder) => {
923
923
  builder.addCase(rootActions_1.clearAll, (draft, action) => {
924
- if (!action.payload.keepTenantCompanyState) {
924
+ // `=== false` rather than `!`: the flag is required at the type level, but an
925
+ // untyped or stale-build caller doing `clearAll()` would send `undefined`,
926
+ // and defaulting that to "wipe" is the dangerous direction. Keep is safe.
927
+ if (action.payload.keepTenantCompanyState === false) {
925
928
  Object.assign(draft, exports.initialState);
926
929
  }
927
930
  });
@@ -135,8 +135,9 @@ const transaction = (0, toolkit_1.createSlice)({
135
135
  },
136
136
  extraReducers: (builder) => {
137
137
  builder.addCase(rootActions_1.clearAll, (draft) => {
138
- draft.transactionById = {};
139
- draft.scheduleTransactionById = {};
138
+ // Full reset rather than mirroring clearAllTransactions, which leaves
139
+ // reconcileTransactionById holding the previous tenant's rows.
140
+ Object.assign(draft, exports.initialState);
140
141
  });
141
142
  },
142
143
  });
@@ -62,7 +62,9 @@ const vendor = (0, toolkit_1.createSlice)({
62
62
  },
63
63
  extraReducers: (builder) => {
64
64
  builder.addCase(rootActions_1.clearAll, (draft) => {
65
- draft.vendorExpenseTrendByPeriod = {};
65
+ // Full reset rather than mirroring clearAllVendorExpenseTrends, which leaves
66
+ // `spend` holding the previous tenant's totals.
67
+ Object.assign(draft, exports.initialState);
66
68
  });
67
69
  },
68
70
  });
@@ -725,9 +725,7 @@ const aiCfo = createSlice({
725
725
  },
726
726
  extraReducers: (builder) => {
727
727
  builder.addCase(clearAll, (draft) => {
728
- draft.aiCfoByChatSessionId = {};
729
- draft.partialQuestionAnswers = {};
730
- draft.syntheticAnswersByChatSessionId = {};
728
+ Object.assign(draft, initialAiCfoState);
731
729
  });
732
730
  },
733
731
  });
@@ -195,7 +195,10 @@ const company = createSlice({
195
195
  },
196
196
  extraReducers: (builder) => {
197
197
  builder.addCase(clearAll, (draft, action) => {
198
- if (!action.payload.keepTenantCompanyState) {
198
+ // `=== false` rather than `!`: the flag is required at the type level, but an
199
+ // untyped or stale-build caller doing `clearAll()` would send `undefined`,
200
+ // and defaulting that to "wipe" is the dangerous direction. Keep is safe.
201
+ if (action.payload.keepTenantCompanyState === false) {
199
202
  Object.assign(draft, initialState);
200
203
  }
201
204
  });
@@ -29,7 +29,9 @@ const depositAccount = createSlice({
29
29
  },
30
30
  extraReducers: (builder) => {
31
31
  builder.addCase(clearAll, (draft) => {
32
- draft.depositAccountByID = {};
32
+ // Full reset rather than mirroring clearAllDepositAccounts, which leaves
33
+ // depositAccountLimitForChargeCardByID holding the previous tenant's limits.
34
+ Object.assign(draft, initialState);
33
35
  });
34
36
  },
35
37
  });
@@ -909,7 +909,10 @@ const tenant = createSlice({
909
909
  },
910
910
  extraReducers: (builder) => {
911
911
  builder.addCase(clearAll, (draft, action) => {
912
- if (!action.payload.keepTenantCompanyState) {
912
+ // `=== false` rather than `!`: the flag is required at the type level, but an
913
+ // untyped or stale-build caller doing `clearAll()` would send `undefined`,
914
+ // and defaulting that to "wipe" is the dangerous direction. Keep is safe.
915
+ if (action.payload.keepTenantCompanyState === false) {
913
916
  Object.assign(draft, initialState);
914
917
  }
915
918
  });
@@ -128,8 +128,9 @@ const transaction = createSlice({
128
128
  },
129
129
  extraReducers: (builder) => {
130
130
  builder.addCase(clearAll, (draft) => {
131
- draft.transactionById = {};
132
- draft.scheduleTransactionById = {};
131
+ // Full reset rather than mirroring clearAllTransactions, which leaves
132
+ // reconcileTransactionById holding the previous tenant's rows.
133
+ Object.assign(draft, initialState);
133
134
  });
134
135
  },
135
136
  });
@@ -58,7 +58,9 @@ const vendor = createSlice({
58
58
  },
59
59
  extraReducers: (builder) => {
60
60
  builder.addCase(clearAll, (draft) => {
61
- draft.vendorExpenseTrendByPeriod = {};
61
+ // Full reset rather than mirroring clearAllVendorExpenseTrends, which leaves
62
+ // `spend` holding the previous tenant's totals.
63
+ Object.assign(draft, initialState);
62
64
  });
63
65
  },
64
66
  });
@@ -200,8 +200,9 @@ const auditReportView = createSlice({
200
200
  },
201
201
  extraReducers: (builder) => {
202
202
  builder.addCase(clearAll, (draft) => {
203
+ // Covers auditRuleGroupView too — clearAuditRuleGroupView only exists to
204
+ // reset that sub-object on its own.
203
205
  Object.assign(draft, initialState);
204
- draft.auditRuleGroupView = Object.assign(draft.auditRuleGroupView, initialState.auditRuleGroupView);
205
206
  });
206
207
  },
207
208
  });
@@ -204,8 +204,9 @@ const auditReportView = (0, toolkit_1.createSlice)({
204
204
  },
205
205
  extraReducers: (builder) => {
206
206
  builder.addCase(rootActions_1.clearAll, (draft) => {
207
+ // Covers auditRuleGroupView too — clearAuditRuleGroupView only exists to
208
+ // reset that sub-object on its own.
207
209
  Object.assign(draft, exports.initialState);
208
- draft.auditRuleGroupView = Object.assign(draft.auditRuleGroupView, exports.initialState.auditRuleGroupView);
209
210
  });
210
211
  },
211
212
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.85-betaRD1",
3
+ "version": "5.1.85",
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",