@zeniai/client-epic-state 5.0.77-betaAR3 → 5.0.77-betaAS1

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.
Files changed (46) hide show
  1. package/lib/entity/approvalRule/approvalRulePayload.d.ts +5 -27
  2. package/lib/entity/approvalRule/approvalRulePayload.js +10 -131
  3. package/lib/entity/approvalRule/approvalRuleSelector.d.ts +1 -25
  4. package/lib/entity/approvalRule/approvalRuleSelector.js +0 -40
  5. package/lib/entity/approvalRule/approvalRuleState.d.ts +7 -48
  6. package/lib/esm/entity/approvalRule/approvalRulePayload.js +10 -131
  7. package/lib/esm/entity/approvalRule/approvalRuleSelector.js +0 -35
  8. package/lib/esm/index.js +1 -2
  9. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +11 -26
  10. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -9
  11. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -7
  12. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +7 -11
  13. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +4 -14
  14. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -121
  15. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -7
  16. package/lib/esm/view/spendManagement/commonHistoryView/commonHistoryPayload.js +2 -2
  17. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -8
  18. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -6
  19. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +7 -11
  20. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +4 -13
  21. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +10 -25
  22. package/lib/index.d.ts +2 -3
  23. package/lib/index.js +16 -22
  24. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  25. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  26. package/lib/view/people/peopleTypes.d.ts +1 -1
  27. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.d.ts +3 -7
  28. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewReducer.js +11 -26
  29. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +2 -9
  30. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +4 -7
  31. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +6 -10
  32. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +3 -13
  33. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -48
  34. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +17 -123
  35. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +5 -31
  36. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -7
  37. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  38. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +1 -1
  39. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/deleteRemiApprovalRuleEpic.js +2 -8
  40. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/fetchRemiSetupApproverViewEpic.js +2 -6
  41. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +6 -10
  42. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/saveRemiSetupApproverViewUpdatesEpic.js +3 -12
  43. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.d.ts +3 -7
  44. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/remiSetupApproverViewReducer.js +10 -25
  45. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  46. package/package.json +1 -1
@@ -1,51 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toApprovalChangableInfoPayloadV1 = exports.toApprovalChangableInfoPayload = void 0;
3
+ exports.toApprovalChangableInfoPayload = void 0;
4
4
  const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
5
- // Form-side criteria is a structured object with optional slots for
6
- // amount / vendor / department; flatten it into the wire format's
7
- // `conditions[]` array.
8
- let criteriaPayload;
5
+ let criteriaPayload = [];
9
6
  if (approverViewUpdateData.criteria != null) {
10
- const { amount, vendor, department } = approverViewUpdateData.criteria;
11
- const conditions = [];
12
- if (amount?.min != null) {
13
- conditions.push({
14
- field: 'amount',
15
- type: 'gte',
16
- value: amount.min.amount,
17
- });
18
- }
19
- if (amount?.max != null) {
20
- conditions.push({
21
- field: 'amount',
22
- type: 'lte',
23
- value: amount.max.amount,
24
- });
25
- }
26
- if (vendor != null && vendor.vendorIds.length > 0) {
27
- conditions.push({
28
- field: 'vendor_id',
29
- type: vendor.operator === 'is_not' ? 'not_in' : 'in',
30
- value: vendor.vendorIds,
31
- });
32
- }
33
- if (department != null && department.departmentIds.length > 0) {
34
- conditions.push({
35
- field: 'department_id',
36
- type: department.operator === 'is_not' ? 'not_in' : 'in',
37
- value: department.departmentIds,
38
- });
39
- }
40
- if (conditions.length > 0) {
41
- const currency = amount?.min ?? amount?.max ?? null;
42
- criteriaPayload = {
43
- conditions,
44
- criteria_operator: 'and',
45
- currency_code: currency?.currencyCode ?? 'USD',
46
- currency_symbol: currency?.currencySymbol ?? '$',
47
- };
48
- }
7
+ const criteria = approverViewUpdateData.criteria;
8
+ const { rangeType, rangeEntity, range } = criteria;
9
+ const { min, max } = range;
10
+ const { currencyCode, currencySymbol } = min;
11
+ criteriaPayload = [
12
+ {
13
+ type: rangeType,
14
+ range_entity: rangeEntity,
15
+ min: min.amount,
16
+ max: max?.amount ?? null,
17
+ currency_code: currencyCode,
18
+ currency_symbol: currencySymbol,
19
+ },
20
+ ];
49
21
  }
50
22
  const steps = approverViewUpdateData.steps.map((step) => {
51
23
  return {
@@ -66,91 +38,13 @@ const toApprovalChangableInfoPayload = (approverViewUpdateData) => {
66
38
  });
67
39
  const isUpdate = approverViewUpdateData.approvalRuleId != null;
68
40
  const payload = {
41
+ criteria: criteriaPayload,
69
42
  steps,
70
43
  is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
71
44
  };
72
- if (criteriaPayload != null) {
73
- payload.criteria = criteriaPayload;
74
- }
75
- // Approval Rules 3.0 — surface rule-level fields when the form set them.
76
- // Send only what the user actually entered: an undefined value means
77
- // "no opinion" and stays off the wire.
78
- if (approverViewUpdateData.name != null) {
79
- payload.name = approverViewUpdateData.name;
80
- }
81
- if (approverViewUpdateData.description != null) {
82
- payload.description = approverViewUpdateData.description;
83
- }
84
- if (approverViewUpdateData.separationOfDuties != null) {
85
- payload.separation_of_duties = approverViewUpdateData.separationOfDuties;
86
- }
87
- if (approverViewUpdateData.isFallback != null) {
88
- payload.is_fallback = approverViewUpdateData.isFallback;
89
- }
90
45
  if (isUpdate) {
91
46
  payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
92
47
  }
93
48
  return payload;
94
49
  };
95
50
  exports.toApprovalChangableInfoPayload = toApprovalChangableInfoPayload;
96
- /**
97
- * V1 wire mapper — used when `approval_rule_v3_config` resolves to OFF
98
- * for the current tenant. Translates the form-side amount criteria into
99
- * the legacy `{rangeType, rangeEntity, range: {min, max}}` shape. The
100
- * V1 backend does not understand vendor / department criteria or the
101
- * rule-level 3.0 fields, so those are dropped on the wire.
102
- *
103
- * The form-side amount slot is always read as a `range`-style criteria
104
- * here: V1 schemas only supported ranges, so an absent `min` or `max`
105
- * falls back to `0` / `Number.MAX_SAFE_INTEGER`.
106
- */
107
- const toApprovalChangableInfoPayloadV1 = (approverViewUpdateData) => {
108
- const amount = approverViewUpdateData.criteria?.amount;
109
- const minAmount = amount?.min;
110
- const maxAmount = amount?.max;
111
- const currencyCode = minAmount?.currencyCode ?? maxAmount?.currencyCode ?? 'USD';
112
- const currencySymbol = minAmount?.currencySymbol ?? maxAmount?.currencySymbol ?? '$';
113
- const steps = approverViewUpdateData.steps.map((step) => {
114
- return {
115
- action: step.action,
116
- operator: step.operator,
117
- actors: step.actors
118
- .filter((actor) => actor.subType !== 'admin')
119
- .map((actor) => {
120
- return {
121
- type: actor.type,
122
- id: actor.userId ?? null,
123
- sub_type: actor.subType ?? null,
124
- id_type: actor.idType ?? null,
125
- is_implicit_actor: actor.isImplicitActor ?? false,
126
- };
127
- }),
128
- };
129
- });
130
- const isUpdate = approverViewUpdateData.approvalRuleId != null;
131
- const payload = {
132
- steps,
133
- is_applicable_on_pending_approval_entity: approverViewUpdateData.isApplicableOnPendingApprovalEntity ?? true,
134
- criteria: {
135
- rangeType: 'range',
136
- rangeEntity: 'currency',
137
- range: {
138
- min: {
139
- amount: minAmount?.amount ?? 0,
140
- currencyCode,
141
- currencySymbol,
142
- },
143
- max: {
144
- amount: maxAmount?.amount ?? Number.MAX_SAFE_INTEGER,
145
- currencyCode,
146
- currencySymbol,
147
- },
148
- },
149
- },
150
- };
151
- if (isUpdate) {
152
- payload.approval_rule_id = approverViewUpdateData.approvalRuleId;
153
- }
154
- return payload;
155
- };
156
- exports.toApprovalChangableInfoPayloadV1 = toApprovalChangableInfoPayloadV1;
@@ -1,45 +1,19 @@
1
1
  import { FetchStateAndError, ID } from '../../../../../commonStateTypes/common';
2
- import { AmountCriteria, DepartmentCriteria, Step, VendorCriteria } from '../../../../../entity/approvalRule/approvalRuleState';
2
+ import { Criteria, Step } from '../../../../../entity/approvalRule/approvalRuleState';
3
3
  export type ApprovalUpdateActionType = 'approval_create' | 'approval_update';
4
4
  export interface ApproverViewUpdateData {
5
5
  type: ApprovalUpdateActionType;
6
6
  updateStatus: FetchStateAndError;
7
7
  data?: ApprovalRuleUpdateData | ApprovalRuleCreateData;
8
8
  }
9
- /**
10
- * Form-side criteria shape used by the rule create/edit form.
11
- *
12
- * Each condition kind gets its own optional slot, mirroring how the UI
13
- * edits them as distinct rows. At most one of each kind is present; this
14
- * matches the design constraint that each condition type can be added once.
15
- */
16
- export interface ApprovalRuleFormCriteria {
17
- amount?: AmountCriteria;
18
- department?: DepartmentCriteria;
19
- vendor?: VendorCriteria;
20
- }
21
- /**
22
- * Rule-level fields shared by both create and update flows.
23
- *
24
- * These come from the 3.0 design: the form now owns a name, an optional
25
- * description, an optional Separation-of-Duties toggle, and a flag that
26
- * marks the rule as the org-wide fallback rule. They live alongside
27
- * criteria/steps but are not part of either.
28
- */
29
- export interface ApprovalRuleFormBase {
30
- description?: string;
31
- isFallback?: boolean;
32
- name?: string;
33
- separationOfDuties?: boolean;
34
- }
35
- export interface ApprovalRuleUpdateData extends ApprovalRuleFormBase {
9
+ export interface ApprovalRuleUpdateData {
36
10
  approvalRuleId: ID;
37
- criteria: ApprovalRuleFormCriteria;
11
+ criteria: Criteria;
38
12
  steps: Step[];
39
13
  isApplicableOnPendingApprovalEntity?: boolean;
40
14
  }
41
- export interface ApprovalRuleCreateData extends ApprovalRuleFormBase {
42
- criteria: ApprovalRuleFormCriteria;
15
+ export interface ApprovalRuleCreateData {
16
+ criteria: Criteria;
43
17
  steps: Step[];
44
18
  isApplicableOnPendingApprovalEntity?: boolean;
45
19
  }
@@ -9,7 +9,6 @@ exports.getPaymentSection = getPaymentSection;
9
9
  exports.toPaymentToOption = toPaymentToOption;
10
10
  const get_1 = __importDefault(require("lodash/get"));
11
11
  const has_1 = __importDefault(require("lodash/has"));
12
- const approvalRuleSelector_1 = require("../../../../entity/approvalRule/approvalRuleSelector");
13
12
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
14
13
  const bankAccountSelector_1 = require("../../../../entity/bankAccount/bankAccountSelector");
15
14
  const contactSelector_1 = require("../../../../entity/billPay/contact/contactSelector");
@@ -699,13 +698,9 @@ exports.getDefaultWithdrawFromAccount = getDefaultWithdrawFromAccount;
699
698
  const checkIfCreatorIsApprover = (billAmount, approvalRules, signedInUser) => {
700
699
  let isCreatorAlsoApprover = false;
701
700
  const approvalRule = approvalRules.find((rule) => {
702
- const amountCriteria = (0, approvalRuleSelector_1.getAmountCriteria)(rule.criteria);
703
- if (amountCriteria?.min == null) {
704
- return false;
705
- }
706
- const { min, max } = amountCriteria;
701
+ const { max, min } = rule.criteria[0].range;
707
702
  return (billAmount > min.amount &&
708
- (max?.amount != null ? billAmount <= max.amount : true));
703
+ (max?.amount != null ? billAmount <= max?.amount : true));
709
704
  });
710
705
  if (approvalRule != null) {
711
706
  const requireApprovalSteps = approvalRule.steps.filter((step) => step.action === 'require_approval');
@@ -61,7 +61,7 @@ export declare const initialCreditAcc: CreditAccount;
61
61
  export declare const initialDebitCardSummaries: DebitCardSummaries;
62
62
  export declare const initialResendRevokeCardInvite: ResendRevokeCardInvite;
63
63
  export declare const initialCreditAccountRepayment: CreditAccountRepayment;
64
- export declare const toChargeCardSortKeyType: (v: string) => "status" | "department" | "accountType" | "owner" | "cardName" | "limit" | "cardType" | "utilisation";
64
+ export declare const toChargeCardSortKeyType: (v: string) => "status" | "accountType" | "owner" | "cardName" | "limit" | "department" | "cardType" | "utilisation";
65
65
  export declare type ChargeCardViewSortKey = ReturnType<typeof toChargeCardSortKeyType>;
66
66
  export declare const ALL_CASHBACK_SORT_KEYS: readonly ["month", "cashback"];
67
67
  export declare const toCashbackSortKeyType: (v: string) => "month" | "cashback";
@@ -6,7 +6,7 @@ const commonHistory_1 = require("./commonHistory");
6
6
  const toHistoricEvent = (payload) => ({
7
7
  eventText: payload.event_text,
8
8
  eventSubText: payload.event_sub_text ?? [],
9
- timestamp: payload.timestamp != null ? (0, zeniDayJS_1.dateLocal)(payload.timestamp) : undefined,
9
+ timestamp: payload.timestamp != null ? (0, zeniDayJS_1.date)(payload.timestamp) : undefined,
10
10
  updates: payload.updates.map((eventUpdatePayload) => toHistoricEventUpdate(eventUpdatePayload)),
11
11
  paymentTraceId: payload.metadata?.payment_trace_id ?? null,
12
12
  });
@@ -9,15 +9,9 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
9
9
  const responsePayload_1 = require("../../../../../responsePayload");
10
10
  const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
11
11
  const deleteRemiApprovalRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.deleteRemiApprovalRule.match), (0, operators_1.switchMap)((action) => {
12
- const { approvalRuleId, useV3 } = action.payload;
13
- // Approval Rules 3.0 — flag-gated endpoint selection.
14
- const endpoint = useV3
15
- ? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
16
- : `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
12
+ const { approvalRuleId } = action.payload;
17
13
  return zeniAPI
18
- .deleteAndGetJSON(endpoint, {
19
- approval_rule_id: approvalRuleId,
20
- })
14
+ .deleteAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`, { approval_rule_id: approvalRuleId })
21
15
  .pipe((0, operators_1.mergeMap)((response) => {
22
16
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
23
17
  const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
@@ -9,7 +9,7 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
9
9
  const responsePayload_1 = require("../../../../../responsePayload");
10
10
  const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
11
11
  const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.fetchRemiSetupApproverView.match), (0, operators_1.switchMap)((action) => {
12
- const { cacheOverride, resolveAttributeToUser, includeImplicitActors, useV3, } = action.payload;
12
+ const { cacheOverride, resolveAttributeToUser, includeImplicitActors } = action.payload;
13
13
  const { remiSetupApproverViewState, approvalRuleState } = state$.value;
14
14
  const approvalRules = (0, approvalRuleSelector_1.getApprovalRulesByIds)(approvalRuleState, remiSetupApproverViewState.approvalRuleIds);
15
15
  if (cacheOverride === true ||
@@ -17,12 +17,8 @@ const fetchRemiSetupApproverViewEpic = (actions$, state$, zeniAPI) => actions$.p
17
17
  remiSetupApproverViewState.approvalRuleIds.length ||
18
18
  (remiSetupApproverViewState.hasValidState() === false &&
19
19
  remiSetupApproverViewState.fetchState !== 'In-Progress')) {
20
- // Approval Rules 3.0 — flag-gated endpoint selection.
21
- const basePath = useV3
22
- ? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
23
- : `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
24
20
  return zeniAPI
25
- .getJSON(`${basePath}?query={"is_include_implicit_actors": ${includeImplicitActors}, "is_resolve_attribute_to_user":${resolveAttributeToUser}}`)
21
+ .getJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules?query={"is_include_implicit_actors": ${includeImplicitActors}, "is_resolve_attribute_to_user":${resolveAttributeToUser}}`)
26
22
  .pipe((0, operators_1.mergeMap)((response) => {
27
23
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
28
24
  const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
@@ -11,20 +11,16 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
11
11
  if (approvalRuleId != null) {
12
12
  const approvalRule = (0, approvalRuleSelector_1.getApprovalRuleById)(state$.value.approvalRuleState, approvalRuleId);
13
13
  if (approvalRule != null) {
14
+ const criteria = approvalRule.criteria[0];
15
+ const range = criteria?.range;
14
16
  const remiSetupApproverViewUpdateData = {
15
17
  approvalRuleId,
16
18
  steps: approvalRule.steps,
17
19
  criteria: {
18
- amount: (0, approvalRuleSelector_1.getAmountCriteria)(approvalRule.criteria),
19
- vendor: (0, approvalRuleSelector_1.getVendorCriteria)(approvalRule.criteria),
20
- department: (0, approvalRuleSelector_1.getDepartmentCriteria)(approvalRule.criteria),
20
+ rangeType: criteria?.rangeType,
21
+ rangeEntity: criteria?.rangeEntity,
22
+ range,
21
23
  },
22
- // Approval Rules 3.0 — seed rule-level fields so the form can
23
- // round-trip them on edit. Each may be undefined on legacy rules.
24
- name: approvalRule.name,
25
- description: approvalRule.description,
26
- separationOfDuties: approvalRule.separationOfDuties,
27
- isFallback: approvalRule.isFallback,
28
24
  };
29
25
  fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewUpdateData));
30
26
  }
@@ -32,7 +28,7 @@ const initializeRemiSetupApproverViewUpdateDataEpic = (actions$, state$) => acti
32
28
  else {
33
29
  const remiSetupApproverViewCreateData = {
34
30
  steps: [],
35
- criteria: {},
31
+ criteria: undefined,
36
32
  };
37
33
  fetchActions.push((0, remiSetupApproverViewReducer_1.clearRemiSetupApproverViewUpdateData)(), (0, remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdateData)(remiSetupApproverViewCreateData));
38
34
  }
@@ -9,23 +9,14 @@ const userReducer_1 = require("../../../../../entity/user/userReducer");
9
9
  const responsePayload_1 = require("../../../../../responsePayload");
10
10
  const commonPayload_1 = require("../../../billPay/billPaySetupApproverView/types/commonPayload");
11
11
  const remiSetupApproverViewReducer_1 = require("../remiSetupApproverViewReducer");
12
- const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdates.match), (0, operators_1.switchMap)((action) => {
12
+ const saveRemiSetupApproverViewUpdatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(remiSetupApproverViewReducer_1.saveRemiSetupApproverViewUpdates.match), (0, operators_1.switchMap)(() => {
13
13
  const { remiSetupApproverViewState } = state$.value;
14
14
  const remiSetupApproverViewUpdateData = remiSetupApproverViewState.remiSetupApproverViewUpdateData;
15
15
  if (remiSetupApproverViewUpdateData != null &&
16
16
  remiSetupApproverViewUpdateData.data != null) {
17
- // Approval Rules 3.0 — gate URL + write-side payload mapper on
18
- // the `approval_rule_v3_config` dynamic config. `useV3` arrives
19
- // on the action payload from the screen connector.
20
- const { useV3 } = action.payload;
21
- const payload = useV3
22
- ? (0, commonPayload_1.toApprovalChangableInfoPayload)(remiSetupApproverViewUpdateData.data)
23
- : (0, commonPayload_1.toApprovalChangableInfoPayloadV1)(remiSetupApproverViewUpdateData.data);
24
- const endpoint = useV3
25
- ? `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules-v2`
26
- : `${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`;
17
+ const payload = (0, commonPayload_1.toApprovalChangableInfoPayload)(remiSetupApproverViewUpdateData.data);
27
18
  return zeniAPI
28
- .postAndGetJSON(endpoint, payload)
19
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.approvalMicroServiceBaseUrl}/1.0/reimbursements/approval-rules`, payload)
29
20
  .pipe((0, operators_1.mergeMap)((response) => {
30
21
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
31
22
  const approvalRuleIds = response.data.approval_rules.map((approvalRule) => approvalRule.approval_rule_id);
@@ -2,11 +2,10 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
2
2
  import { ApprovalRuleCreateData, ApprovalRuleUpdateData } from '../../billPay/billPaySetupApproverView/types/commonState';
3
3
  import { RemiSetupApproverViewState } from './remiSetupApproverViewState';
4
4
  export declare const initialState: RemiSetupApproverViewState;
5
- export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, resolveAttributeToUser?: any, includeImplicitActors?: any, useV3?: any], {
5
+ export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, resolveAttributeToUser?: any, includeImplicitActors?: any], {
6
6
  cacheOverride: any;
7
7
  resolveAttributeToUser: any;
8
8
  includeImplicitActors: any;
9
- useV3: any;
10
9
  }, "remiSetupApproverView/fetchRemiSetupApproverView", never, never>, fetchRemiSetupApproverViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[]], {
11
10
  approvalRuleIds: string[];
12
11
  }, "remiSetupApproverView/fetchRemiSetupApproverViewSuccess", never, never>, fetchRemiSetupApproverViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "remiSetupApproverView/fetchRemiSetupApproverViewFailure", never, never>, fetchRemiApproversDetails: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any, includeUserRoles?: any, includeAttributesUserIds?: any, lastUpdatedByUserId?: any], {
@@ -25,18 +24,15 @@ export declare const fetchRemiSetupApproverView: import("@reduxjs/toolkit").Acti
25
24
  attributeSubTypeToUserIdMapping: Record<"manager" | "vendor_owner" | "manager_of_manager", string> | undefined;
26
25
  }, "remiSetupApproverView/fetchRemiApproversListSuccess", never, never>, fetchRemiApproversListFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[status: ZeniAPIStatus<Record<string, unknown>>], {
27
26
  status: ZeniAPIStatus<Record<string, unknown>>;
28
- }, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, useV3?: any], {
27
+ }, "remiSetupApproverView/fetchRemiApproversListFailure", never, never>, deleteRemiApprovalRule: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string], {
29
28
  approvalRuleId: string;
30
- useV3: any;
31
29
  }, "remiSetupApproverView/deleteRemiApprovalRule", never, never>, deleteRemiApprovalRuleSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[deletedApprovalRuleId: string, approvalRuleIds: string[]], {
32
30
  deletedApprovalRuleId: string;
33
31
  approvalRuleIds: string[];
34
32
  }, "remiSetupApproverView/deleteRemiApprovalRuleSuccess", never, never>, deleteRemiApprovalRuleFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
35
33
  approvalRuleId: string;
36
34
  status: ZeniAPIStatus<Record<string, unknown>>;
37
- }, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>, saveRemiSetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[useV3: boolean], {
38
- useV3: boolean;
39
- }, "remiSetupApproverView/saveRemiSetupApproverViewUpdates", never, never>, saveRemiSetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
35
+ }, "remiSetupApproverView/deleteRemiApprovalRuleFailure", never, never>, saveRemiSetupApproverViewUpdates: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"remiSetupApproverView/saveRemiSetupApproverViewUpdates">, saveRemiSetupApproverViewUpdatesSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[approvalRuleIds: string[], affectedEntityIds?: string[] | undefined, newApprovalRuleId?: string | undefined], {
40
36
  approvalRuleIds: string[];
41
37
  affectedEntityIds: string[] | undefined;
42
38
  newApprovalRuleId: string | undefined;
@@ -30,16 +30,12 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
30
30
  draft.fetchState = 'In-Progress';
31
31
  draft.error = undefined;
32
32
  },
33
- // Approval Rules 3.0 `useV3` arrives from the screen connector
34
- // (`approval_rule_v3_config` dynamic config) and picks v1 vs v2
35
- // endpoint in the fetch epic.
36
- prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false, useV3 = false) {
33
+ prepare(cacheOverride = false, resolveAttributeToUser = false, includeImplicitActors = false) {
37
34
  return {
38
35
  payload: {
39
36
  cacheOverride,
40
37
  resolveAttributeToUser,
41
38
  includeImplicitActors,
42
- useV3,
43
39
  },
44
40
  };
45
41
  },
@@ -142,11 +138,8 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
142
138
  error: undefined,
143
139
  };
144
140
  },
145
- // Approval Rules 3.0 — `useV3` flows from the screen connector
146
- // (`approval_rule_v3_config` dynamic config) so the delete epic
147
- // can pick the v1 vs v2 endpoint.
148
- prepare(approvalRuleId, useV3 = false) {
149
- return { payload: { approvalRuleId, useV3 } };
141
+ prepare(approvalRuleId) {
142
+ return { payload: { approvalRuleId } };
150
143
  },
151
144
  },
152
145
  deleteRemiApprovalRuleSuccess: {
@@ -178,21 +171,13 @@ const remiSetupApproverView = (0, toolkit_1.createSlice)({
178
171
  };
179
172
  },
180
173
  },
181
- saveRemiSetupApproverViewUpdates: {
182
- // Approval Rules 3.0 `useV3` sourced from
183
- // `approval_rule_v3_config` dynamic config in the screen
184
- // connector; epic uses it to pick v1 vs v2 URL + mapper.
185
- reducer(draft, _action) {
186
- if (draft.remiSetupApproverViewUpdateData != null) {
187
- draft.remiSetupApproverViewUpdateData.updateStatus = {
188
- fetchState: 'In-Progress',
189
- error: undefined,
190
- };
191
- }
192
- },
193
- prepare(useV3) {
194
- return { payload: { useV3 } };
195
- },
174
+ saveRemiSetupApproverViewUpdates(draft) {
175
+ if (draft.remiSetupApproverViewUpdateData != null) {
176
+ draft.remiSetupApproverViewUpdateData.updateStatus = {
177
+ fetchState: 'In-Progress',
178
+ error: undefined,
179
+ };
180
+ }
196
181
  },
197
182
  saveRemiSetupApproverViewUpdatesSuccess: {
198
183
  reducer(draft, action) {
@@ -50,15 +50,15 @@ export interface TaskFilterCategory {
50
50
  }
51
51
  export type TaskListFilterCategoryField = 'status' | 'dueDate' | 'assignee' | 'creationDate' | 'priority' | 'tag';
52
52
  export declare const TASK_LIST_GROUP_BY_KEYS: readonly ["groupName", "status", "dueDate", "assignee", "priority", "tag"];
53
- export declare const toTaskListGroupByKeyType: (v: string) => "status" | "priority" | "dueDate" | "groupName" | "tag" | "assignee";
54
- export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "priority" | "dueDate" | "groupName" | "tag" | "assignee" | undefined;
53
+ export declare const toTaskListGroupByKeyType: (v: string) => "status" | "dueDate" | "groupName" | "tag" | "priority" | "assignee";
54
+ export declare const toTaskListGroupByKeyTypeStrict: (v: string) => "status" | "dueDate" | "groupName" | "tag" | "priority" | "assignee" | undefined;
55
55
  export declare type TaskGroupKey = ReturnType<typeof toTaskListGroupByKeyType>;
56
56
  export interface TaskListUIState extends SpendManagementUIState {
57
57
  groupByKey: TaskGroupKey;
58
58
  searchText: string;
59
59
  sortKey: TaskListViewSortKey;
60
60
  }
61
- declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "priority" | "dueDate" | "tag" | "timeSpent" | "assignee" | "creationDate" | "visibility";
61
+ declare const toTaskListSortKeyType: (v: string) => "status" | "name" | "dueDate" | "tag" | "priority" | "timeSpent" | "assignee" | "creationDate" | "visibility";
62
62
  export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
63
63
  export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
64
64
  interface TaskListFilterCategoryOption {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.77-betaAR3",
3
+ "version": "5.0.77-betaAS1",
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",