@zeniai/client-epic-state 5.0.77-betaAR2 → 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 (34) 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/epic/deleteBillPayApprovalRuleEpic.js +1 -3
  10. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +1 -3
  11. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +7 -11
  12. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +1 -3
  13. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -61
  14. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -7
  15. package/lib/esm/view/spendManagement/commonHistoryView/commonHistoryPayload.js +2 -2
  16. package/lib/esm/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +7 -11
  17. package/lib/index.d.ts +2 -3
  18. package/lib/index.js +16 -22
  19. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  20. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  21. package/lib/view/people/peopleTypes.d.ts +1 -1
  22. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/deleteBillPayApprovalRuleEpic.js +1 -3
  23. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPaySetupApproverViewEpic.js +1 -3
  24. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/initializeBillPaySetupApproverViewUpdateDataEpic.js +6 -10
  25. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/saveBillPaySetupApproverViewUpdatesEpic.js +1 -3
  26. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.d.ts +1 -9
  27. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonPayload.js +16 -61
  28. package/lib/view/spendManagement/billPay/billPaySetupApproverView/types/commonState.d.ts +5 -31
  29. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -7
  30. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  31. package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +1 -1
  32. package/lib/view/spendManagement/reimbursement/remiSetupApproverView/epic/initializeRemiSetupApproverViewUpdateDataEpic.js +6 -10
  33. package/lib/view/taskManager/taskListView/taskList.d.ts +3 -3
  34. package/package.json +1 -1
@@ -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
  });
@@ -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
  }
@@ -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-betaAR2",
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",