gotrip-fx-transaction-form 1.0.192-dev → 1.0.194-dev

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gotrip-fx-transaction-form",
3
- "version": "1.0.192-dev",
3
+ "version": "1.0.194-dev",
4
4
  "description": "FX Transaction Form ES6 module",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -1,31 +1,32 @@
1
1
  import { ITenant } from '../../types/response.dto';
2
- import { ECommissionPolicyCalculationType } from '../../types/enum';
2
+ import { EPolicyActionType } from '../../constants/policy-enums';
3
3
  export type ICommissionPolicySettings = {
4
4
  [key: string]: {
5
5
  [currency: string]: {
6
6
  [method: string]: {
7
- type: ECommissionPolicyCalculationType;
7
+ type: EPolicyActionType;
8
8
  value: string;
9
9
  };
10
10
  };
11
11
  };
12
12
  };
13
- type Props = {
14
- id: string;
15
- bank: ITenant;
16
- curr: string;
17
- method: string;
18
- type: ECommissionPolicyCalculationType;
19
- value: string;
20
- canEdit: boolean;
21
- };
22
13
  export type RefMethod = {
23
14
  getId: () => string;
24
15
  getCurrency: () => string;
25
16
  getMethod: () => string;
26
17
  getBank: () => ITenant;
27
18
  getValue: () => string;
28
- getType: () => ECommissionPolicyCalculationType;
19
+ getType: () => EPolicyActionType;
20
+ };
21
+ type UpdateTenantCommissionInputCellProps = {
22
+ id: string;
23
+ bank: ITenant;
24
+ curr: string;
25
+ method: string;
26
+ type: EPolicyActionType;
27
+ value: string;
28
+ canEdit: boolean;
29
+ forceDisplay?: boolean;
29
30
  };
30
- declare const _default: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Props & import('react').RefAttributes<RefMethod>>>;
31
+ declare const _default: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<UpdateTenantCommissionInputCellProps & import('react').RefAttributes<RefMethod>>>;
31
32
  export default _default;
@@ -0,0 +1,16 @@
1
+ import { PolicyGroupFormData } from './PolicyTypes';
2
+ interface Props {
3
+ isOpen: boolean;
4
+ onClose: () => void;
5
+ onSubmit: (payload: any) => Promise<boolean>;
6
+ editingGroup: any | null;
7
+ loading: boolean;
8
+ tenants: any[];
9
+ initialData?: PolicyGroupFormData;
10
+ contextTenantId?: number;
11
+ contextDepartmentId?: number;
12
+ contextUserId?: number;
13
+ canEditOverride?: boolean;
14
+ }
15
+ export declare const CommissionPolicyGroupFormDialog: ({ isOpen, onClose, onSubmit, editingGroup, loading, tenants, initialData, contextTenantId, contextDepartmentId, contextUserId, canEditOverride, }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ tenantId: number;
5
+ departmentId?: number;
6
+ userId?: number;
7
+ canEdit?: boolean;
8
+ onSuccess?: () => void;
9
+ }
10
+ export declare const CommissionPolicyGroupListView: ({ isOpen, onClose, tenantId, departmentId, userId, canEdit, onSuccess, }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,54 @@
1
+ import { EPolicyActionType } from '../../constants/policy-enums';
2
+ import { PolicyFormData } from './PolicyTypes';
3
+ export interface PolicyRulesConfig {
4
+ name: string;
5
+ conditionOperators: Array<{
6
+ value: string;
7
+ label: string;
8
+ }>;
9
+ actionDirections: Array<{
10
+ value: string;
11
+ label: string;
12
+ }>;
13
+ actionTypes: Array<{
14
+ value: EPolicyActionType;
15
+ label: string;
16
+ }>;
17
+ commissionTypes?: Array<{
18
+ value: 'direct' | 'indirect' | 'viaref';
19
+ label: string;
20
+ }>;
21
+ bankCodes?: Array<{
22
+ value: string;
23
+ label: string;
24
+ }>;
25
+ currencyCodes?: Array<{
26
+ value: string;
27
+ label: string;
28
+ }>;
29
+ labels?: {
30
+ conditionPrefix?: string;
31
+ actionPrefix?: string;
32
+ addRuleButton?: string;
33
+ ruleLabel?: string;
34
+ conditionValuePlaceholder?: string;
35
+ commissionTypeLabel?: string;
36
+ bankCodeLabel?: string;
37
+ currencyCodeLabel?: string;
38
+ commissionDirectLabel?: string;
39
+ commissionIndirectLabel?: string;
40
+ commissionViaRefLabel?: string;
41
+ };
42
+ mode?: 'pricing' | 'commission';
43
+ }
44
+ interface Props {
45
+ policies: PolicyFormData[];
46
+ onPoliciesChange: (newPolicies: PolicyFormData[]) => void;
47
+ config: PolicyRulesConfig;
48
+ errors?: Record<number, string[]>;
49
+ showAddButton?: boolean;
50
+ onAddPolicy?: () => void;
51
+ readOnly?: boolean;
52
+ }
53
+ export declare const PolicyRulesEditor: ({ policies, onPoliciesChange, config, errors, showAddButton, onAddPolicy, readOnly, }: Props) => import("react/jsx-runtime").JSX.Element;
54
+ export {};
@@ -0,0 +1,41 @@
1
+ import { EPolicyType, EPolicyActionType, EPolicyCombineStrategy, EPolicyScopeType } from '../../constants/policy-enums';
2
+ export interface PolicyFormData {
3
+ name: string;
4
+ description?: string;
5
+ type: EPolicyType;
6
+ conditions: any;
7
+ actionType: EPolicyActionType;
8
+ actionValue: number;
9
+ combineStrategy: EPolicyCombineStrategy;
10
+ priority: number;
11
+ conditionOperator?: string;
12
+ conditionValue?: any;
13
+ bankCode?: string | string[];
14
+ currencyCode?: string | string[];
15
+ commissionDirect?: {
16
+ type: EPolicyActionType;
17
+ value: number;
18
+ };
19
+ commissionIndirect?: {
20
+ type: EPolicyActionType;
21
+ value: number;
22
+ };
23
+ commissionViaRef?: {
24
+ type: EPolicyActionType;
25
+ value: number;
26
+ };
27
+ }
28
+ export interface PolicyGroupFormData {
29
+ name: string;
30
+ description?: string;
31
+ scopeType: EPolicyScopeType | string;
32
+ selectedTenantIds?: number[];
33
+ selectedDepartmentIds?: number[];
34
+ selectedUserIds?: number[];
35
+ active?: boolean;
36
+ scheduleType?: 'all' | 'time_range';
37
+ activeFrom?: string;
38
+ activeTo?: string;
39
+ policies: PolicyFormData[];
40
+ config?: any;
41
+ }
@@ -0,0 +1,11 @@
1
+ import { PolicyGroup } from '../../hooks/usePolicyGroups';
2
+ interface Props {
3
+ policyGroups: PolicyGroup[];
4
+ loading?: boolean;
5
+ canEdit?: boolean;
6
+ tenants: any[];
7
+ onSubmit?: (payload: any) => Promise<boolean>;
8
+ onSuccess?: () => void;
9
+ }
10
+ export declare const PricingPolicyListView: ({ policyGroups, loading, canEdit, tenants, onSubmit, onSuccess, }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -143,16 +143,21 @@ export declare const ApiUrls: {
143
143
  calculateBookerCommission: string;
144
144
  };
145
145
  commissionPolicyHandlers: {
146
+ getDepartmentCommissionPolicies: (departmentId: number) => string;
147
+ createDepartmentCommissionPolicies: (departmentId: number) => string;
148
+ updateDepartmentCommissionPolicies: (departmentId: number, policyGroupId: number) => string;
149
+ getMemberCommissionPolicies: (departmentId: number, memberId: number) => string;
150
+ createMemberCommissionPolicies: (departmentId: number, memberId: number) => string;
151
+ updateMemberCommissionPolicies: (departmentId: number, memberId: number, policyGroupId: number) => string;
152
+ updateMemberCommissionPoliciesLegacy: (departmentId: number, memberId: number) => string;
146
153
  getCommissionPolicies: string;
147
154
  updateCommissionPolicies: string;
148
155
  getTenantCommissionPolicies: string;
149
156
  getTenantCommissionPoliciesByTenantId: (tenantId: number) => string;
150
- getDepartmentCommissionPolicies: (departmentId: number) => string;
151
- getMemberCommissionPolicies: (departmentId: number, memberId: number) => string;
157
+ createTenantCommissionPolicies: (tenantId: number) => string;
158
+ updateTenantCommissionPolicies: (tenantId: number, policyGroupId: number) => string;
159
+ updateTenantCommissionPoliciesLegacy: (tenantId: number) => string;
152
160
  getMemberCommissionPoliciesByMemberId: (memberId: number) => string;
153
- updateTenantCommissionPolicies: (tenantId: number) => string;
154
- updateDepartmentCommissionPolicies: (departmentId: number) => string;
155
- updateMemberCommissionPolicies: (departmentId: number, memberId: number) => string;
156
161
  updateMemberCommissionPoliciesByMemberId: (memberId: number) => string;
157
162
  };
158
163
  esimHandlers: {
@@ -0,0 +1,5 @@
1
+ import { EPolicyActionType } from './policy-enums';
2
+ export declare const COMMISSION_METHODS: readonly ["direct", "viaRef", "indirect"];
3
+ export declare const COMMISSION_METHODS_LABELS: Record<string, string>;
4
+ export declare const DEFAULT_COMMISSION_VALUE = "0";
5
+ export declare const DEFAULT_COMMISSION_TYPE = EPolicyActionType.PERCENT;
@@ -4,6 +4,11 @@ export declare enum EPolicyScopeType {
4
4
  DEPARTMENT = "department",
5
5
  USER = "user"
6
6
  }
7
+ export declare enum EPolicyScopeMode {
8
+ ALL = "all",
9
+ INCLUDE = "include",
10
+ EXCLUDE = "exclude"
11
+ }
7
12
  export declare enum EPolicyTargetType {
8
13
  FX = "fx",
9
14
  SIM = "sim",
@@ -12,7 +17,8 @@ export declare enum EPolicyTargetType {
12
17
  }
13
18
  export declare enum EPolicyActionType {
14
19
  PERCENT = "percent",
15
- FIXED = "fixed"
20
+ FIXED = "fixed",
21
+ FIXED_MULTIPLIER = "fixed_multiplier"
16
22
  }
17
23
  export declare enum EPolicyCombineStrategy {
18
24
  STACK = "stack",
@@ -1,13 +1,13 @@
1
- import { ICommissionPolicy } from '../types/response.dto';
1
+ import { IRemappedCommissionPolicy } from '../types/response.dto';
2
2
  export declare const useComissionPolicies: ({ isAdminView }?: {
3
3
  isAdminView?: boolean;
4
4
  }) => {
5
5
  loading: boolean;
6
- commissionPolicies: ICommissionPolicy[];
7
- getCommissionPoliciesByTenantId: (tenantId: number) => Promise<ICommissionPolicy[]>;
8
- getCommissionPoliciesByDepartmentId: (departmentId: number) => Promise<ICommissionPolicy[]>;
9
- getCommissionPoliciesByMemberId: (departmentId: number, memberId: number) => Promise<ICommissionPolicy[]>;
10
- getCommissionPoliciesByMemberIdOnly: (memberId: number) => Promise<ICommissionPolicy[]>;
6
+ commissionPolicies: IRemappedCommissionPolicy[];
7
+ getCommissionPoliciesByTenantId: (tenantId: number) => Promise<IRemappedCommissionPolicy[]>;
8
+ getCommissionPoliciesByDepartmentId: (departmentId: number) => Promise<IRemappedCommissionPolicy[]>;
9
+ getCommissionPoliciesByMemberId: (departmentId: number, memberId: number) => Promise<IRemappedCommissionPolicy[]>;
10
+ getCommissionPoliciesByMemberIdOnly: (memberId: number) => Promise<IRemappedCommissionPolicy[]>;
11
11
  clearCommissionPolicies: () => void;
12
12
  isAdmin: boolean;
13
13
  isAgency: boolean;
@@ -1,11 +1,25 @@
1
+ import { EPolicyActionType } from '../constants/policy-enums';
1
2
  export interface PolicyDto {
2
3
  name: string;
3
4
  description?: string;
4
5
  type: string;
5
6
  conditions: Record<string, any>;
6
7
  action: {
7
- type: 'percent' | 'fixed';
8
+ type: EPolicyActionType;
8
9
  value: number;
10
+ } | {
11
+ direct: {
12
+ type: EPolicyActionType;
13
+ value: number;
14
+ };
15
+ indirect: {
16
+ type: EPolicyActionType;
17
+ value: number;
18
+ };
19
+ viaRef: {
20
+ type: EPolicyActionType;
21
+ value: number;
22
+ };
9
23
  };
10
24
  combineStrategy: string;
11
25
  priority: number;
@@ -31,6 +45,7 @@ export interface CreatePolicyGroupPayload {
31
45
  targetType: string;
32
46
  scopeType: string;
33
47
  scopeIds?: number[];
48
+ scopeMode?: string;
34
49
  policies: PolicyDto[];
35
50
  active: boolean;
36
51
  }
@@ -1,5 +1,7 @@
1
1
  import { ITenant } from '../types/response.dto';
2
- export declare const useTenantList: () => {
2
+ export declare const useTenantList: (options?: {
3
+ skipFetch?: boolean;
4
+ }) => {
3
5
  tenants: ITenant[];
4
6
  loading: boolean;
5
7
  refetchData: () => void;
@@ -1,5 +1,7 @@
1
1
  import { IUser } from '../types/response.dto';
2
- export declare const useUserList: () => {
2
+ export declare const useUserList: (options?: {
3
+ skipAutoFetch?: boolean;
4
+ }) => {
3
5
  users: IUser[];
4
6
  total: number;
5
7
  loading: boolean;
@@ -1,4 +1,5 @@
1
- import { ECommissionPolicyCalculationType, ECommissionPolicyType, ESimDomesticServices, EsimTransactionStatus, ETenantType, EUseCaseses, TransactionStatus } from './enum';
1
+ import { ECommissionPolicyType, ESimDomesticServices, EsimTransactionStatus, ETenantType, EUseCaseses, TransactionStatus } from './enum';
2
+ import { EPolicyActionType } from '../constants/policy-enums';
2
3
  import { EPermissionKey, EUserRole, EUserStatus } from './user';
3
4
  export type LoginRespDto = {
4
5
  accessToken: string;
@@ -401,6 +402,27 @@ export type IPermission = {
401
402
  description: string;
402
403
  globalPermission: IGlobalPermission;
403
404
  };
405
+ export interface IRemappedCommissionPolicy {
406
+ userId: number | null;
407
+ tenantId: number;
408
+ departmentId: number | null;
409
+ bankCode: string;
410
+ currencyCode: string;
411
+ action: {
412
+ direct: {
413
+ type: string;
414
+ value: number;
415
+ };
416
+ viaRef: {
417
+ type: string;
418
+ value: number;
419
+ };
420
+ indirect: {
421
+ type: string;
422
+ value: number;
423
+ };
424
+ };
425
+ }
404
426
  export interface ICommissionPolicy {
405
427
  currencyCode?: string;
406
428
  userId?: number;
@@ -409,9 +431,9 @@ export interface ICommissionPolicy {
409
431
  memberId?: number;
410
432
  bankId?: number;
411
433
  type: ECommissionPolicyType;
412
- directType: ECommissionPolicyCalculationType;
413
- viaRefType: ECommissionPolicyCalculationType;
414
- indirectType: ECommissionPolicyCalculationType;
434
+ directType: EPolicyActionType;
435
+ viaRefType: EPolicyActionType;
436
+ indirectType: EPolicyActionType;
415
437
  byFixedAmountDirect?: number;
416
438
  byPercentDirect?: number;
417
439
  byFixedAmountViaRef?: number;