@cranberry-money/shared-services 1.6.0 → 1.7.0

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 (43) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/services/cash_accounts/transactions/index.d.ts +3 -2
  5. package/dist/services/cash_accounts/transactions/index.d.ts.map +1 -1
  6. package/dist/services/cash_accounts/transactions/index.js +3 -1
  7. package/dist/services/cash_accounts/transactions/service.d.ts +1 -0
  8. package/dist/services/cash_accounts/transactions/service.d.ts.map +1 -1
  9. package/dist/services/cash_accounts/transactions/service.js +9 -0
  10. package/dist/services/withdrawals/constants.d.ts +67 -0
  11. package/dist/services/withdrawals/constants.d.ts.map +1 -0
  12. package/dist/services/withdrawals/constants.js +91 -0
  13. package/dist/services/withdrawals/index.d.ts +6 -0
  14. package/dist/services/withdrawals/index.d.ts.map +1 -0
  15. package/dist/services/withdrawals/index.js +7 -0
  16. package/dist/services/withdrawals/service.d.ts +4 -0
  17. package/dist/services/withdrawals/service.d.ts.map +1 -0
  18. package/dist/services/withdrawals/service.js +5 -0
  19. package/dist/services/withdrawals/types.d.ts +81 -0
  20. package/dist/services/withdrawals/types.d.ts.map +1 -0
  21. package/dist/services/withdrawals/types.js +1 -0
  22. package/dist/services/withdrawals/utils.d.ts +20 -0
  23. package/dist/services/withdrawals/utils.d.ts.map +1 -0
  24. package/dist/services/withdrawals/utils.js +110 -0
  25. package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts +3 -0
  26. package/dist/services/withdrawals/withdrawal_liquidations/index.d.ts.map +1 -0
  27. package/dist/services/withdrawals/withdrawal_liquidations/index.js +2 -0
  28. package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts +8 -0
  29. package/dist/services/withdrawals/withdrawal_liquidations/service.d.ts.map +1 -0
  30. package/dist/services/withdrawals/withdrawal_liquidations/service.js +68 -0
  31. package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts +2 -0
  32. package/dist/services/withdrawals/withdrawal_liquidations/types.d.ts.map +1 -0
  33. package/dist/services/withdrawals/withdrawal_liquidations/types.js +1 -0
  34. package/dist/services/withdrawals/withdrawal_requests/index.d.ts +3 -0
  35. package/dist/services/withdrawals/withdrawal_requests/index.d.ts.map +1 -0
  36. package/dist/services/withdrawals/withdrawal_requests/index.js +2 -0
  37. package/dist/services/withdrawals/withdrawal_requests/service.d.ts +7 -0
  38. package/dist/services/withdrawals/withdrawal_requests/service.d.ts.map +1 -0
  39. package/dist/services/withdrawals/withdrawal_requests/service.js +55 -0
  40. package/dist/services/withdrawals/withdrawal_requests/types.d.ts +2 -0
  41. package/dist/services/withdrawals/withdrawal_requests/types.d.ts.map +1 -0
  42. package/dist/services/withdrawals/withdrawal_requests/types.js +1 -0
  43. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * as CashAccountsService from './services/cash_accounts';
18
18
  export * as PortfoliosService from './services/portfolios';
19
19
  export * as UsersService from './services/users';
20
20
  export * as TradesService from './services/trades';
21
+ export * as WithdrawalsService from './services/withdrawals';
21
22
  export * from './query/QueryClient';
22
23
  export * from './query/useAuth';
23
24
  export * from './query/usePortfolios';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAG3C,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAGrB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AY,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,kBAAkB,MAAM,wBAAwB,CAAC;AAG7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export * as CashAccountsService from './services/cash_accounts';
22
22
  export * as PortfoliosService from './services/portfolios';
23
23
  export * as UsersService from './services/users';
24
24
  export * as TradesService from './services/trades';
25
+ export * as WithdrawalsService from './services/withdrawals';
25
26
  // React Query integration
26
27
  export * from './query/QueryClient';
27
28
  export * from './query/useAuth';
@@ -1,4 +1,5 @@
1
- export type { CashAccountTransaction, CashAccountTransactionQueryParams, TransactionSummary, TransactionType, PaginatedCashAccountTransactions, TRANSACTION_TYPE_DEPOSIT, TRANSACTION_TYPE_WITHDRAWAL, TRANSACTION_TYPE_TRADE_SETTLEMENT, TRANSACTION_TYPE_DISTRIBUTION, TRANSACTION_TYPE_FEE, TRANSACTION_TYPE_INTEREST, TRANSACTION_TYPE_OTHER, } from './types';
2
- export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
1
+ export type { CashAccountTransaction, CashAccountTransactionQueryParams, TransactionSummary, TransactionType, PaginatedCashAccountTransactions, } from './types';
2
+ export { TRANSACTION_TYPE_DEPOSIT, TRANSACTION_TYPE_WITHDRAWAL, TRANSACTION_TYPE_TRADE_SETTLEMENT, TRANSACTION_TYPE_DISTRIBUTION, TRANSACTION_TYPE_FEE, TRANSACTION_TYPE_INTEREST, TRANSACTION_TYPE_OTHER, } from './types';
3
+ export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, formatTransactionAmount, } from './service';
3
4
  export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,EAClB,eAAe,EACf,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,uCAAuC,EACvC,mCAAmC,EACnC,0BAA0B,EAC1B,+BAA+B,EAC/B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,sBAAsB,EACtB,iCAAiC,EACjC,kBAAkB,EAClB,eAAe,EACf,gCAAgC,GACjC,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,mCAAmC,EACnC,0BAA0B,EAC1B,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,8BAA8B,EAC9B,iCAAiC,EACjC,uCAAuC,EACvC,mCAAmC,EACnC,0BAA0B,EAC1B,+BAA+B,EAC/B,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,aAAa,CAAC"}
@@ -1,4 +1,6 @@
1
+ // Export type constants as values
2
+ export { TRANSACTION_TYPE_DEPOSIT, TRANSACTION_TYPE_WITHDRAWAL, TRANSACTION_TYPE_TRADE_SETTLEMENT, TRANSACTION_TYPE_DISTRIBUTION, TRANSACTION_TYPE_FEE, TRANSACTION_TYPE_INTEREST, TRANSACTION_TYPE_OTHER, } from './types';
1
3
  // Export service functions
2
- export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, } from './service';
4
+ export { getCashAccountTransactions, getCashAccountTransactionByUuid, getCashAccountTransactionsByAccount, getTransactionsByDateRange, getRecentTransactions, getTransactionTypeLabel, formatTransactionAmount, } from './service';
3
5
  // Export constants
4
6
  export { TRANSACTION_TYPE_LABEL_DEPOSIT, TRANSACTION_TYPE_LABEL_WITHDRAWAL, TRANSACTION_TYPE_LABEL_TRADE_SETTLEMENT, TRANSACTION_TYPE_LABEL_DISTRIBUTION, TRANSACTION_TYPE_LABEL_FEE, TRANSACTION_TYPE_LABEL_INTEREST, TRANSACTION_TYPE_LABEL_OTHER, TRANSACTION_TYPE_OPTIONS, } from './constants';
@@ -9,4 +9,5 @@ export declare const getTransactionsByDateRange: (startDate: string, endDate: st
9
9
  export declare const getRecentTransactions: (days?: number, // Default to 30 days for recent transactions
10
10
  params?: CashAccountTransactionQueryParams) => Promise<import("axios").AxiosResponse<PaginatedCashAccountTransactions, any>>;
11
11
  export declare const getTransactionTypeLabel: (transactionType: TransactionType) => string;
12
+ export declare const formatTransactionAmount: (amount: string | number) => string;
12
13
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,0BAA0B,GAAI,SAAS,iCAAiC,kFA4BpF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,MAAM,MAAM,wEAE3D,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,iBAAiB,MAAM,EACvB,SAAS,IAAI,CAAC,iCAAiC,EAAE,aAAa,CAAC,kFAMhE,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,SAAS,IAAI,CAAC,iCAAiC,EAAE,WAAW,GAAG,SAAS,CAAC,kFAO1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAM,MAAW,EAAE,6CAA6C;AAChE,SAAS,iCAAiC,kFAM3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,eAAe,KAAG,MAY1E,CAAC"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/cash_accounts/transactions/service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,gCAAgC,EAChC,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,0BAA0B,GAAI,SAAS,iCAAiC,kFA4BpF,CAAC;AAEF,eAAO,MAAM,+BAA+B,GAAI,MAAM,MAAM,wEAE3D,CAAC;AAEF,eAAO,MAAM,mCAAmC,GAC9C,iBAAiB,MAAM,EACvB,SAAS,IAAI,CAAC,iCAAiC,EAAE,aAAa,CAAC,kFAMhE,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,WAAW,MAAM,EACjB,SAAS,MAAM,EACf,SAAS,IAAI,CAAC,iCAAiC,EAAE,WAAW,GAAG,SAAS,CAAC,kFAO1E,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,OAAM,MAAW,EAAE,6CAA6C;AAChE,SAAS,iCAAiC,kFAM3C,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,iBAAiB,eAAe,KAAG,MAY1E,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,QAAQ,MAAM,GAAG,MAAM,KAAG,MAQjE,CAAC"}
@@ -64,3 +64,12 @@ export const getTransactionTypeLabel = (transactionType) => {
64
64
  };
65
65
  return labels[transactionType];
66
66
  };
67
+ export const formatTransactionAmount = (amount) => {
68
+ const numAmount = typeof amount === 'string' ? parseFloat(amount) : amount;
69
+ // Using simple formatting for now - could be enhanced with proper currency formatting
70
+ return new Intl.NumberFormat('en-AU', {
71
+ style: 'currency',
72
+ currency: 'AUD',
73
+ signDisplay: 'exceptZero',
74
+ }).format(numAmount);
75
+ };
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Withdrawal-related constants for the shared services package.
3
+ *
4
+ * These constants should match the backend constants in bilberry/withdrawals/constants.py
5
+ * to ensure consistency across the application stack.
6
+ */
7
+ export declare const WITHDRAWAL_STATUS_PENDING_REVIEW = "PENDING_REVIEW";
8
+ export declare const WITHDRAWAL_STATUS_APPROVED = "APPROVED";
9
+ export declare const WITHDRAWAL_STATUS_REJECTED = "REJECTED";
10
+ export declare const WITHDRAWAL_STATUS_PROCESSING = "PROCESSING";
11
+ export declare const WITHDRAWAL_STATUS_AWAITING_LIQUIDATION = "AWAITING_LIQUIDATION";
12
+ export declare const WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS = "LIQUIDATION_IN_PROGRESS";
13
+ export declare const WITHDRAWAL_STATUS_COMPLETED = "COMPLETED";
14
+ export declare const WITHDRAWAL_STATUS_CANCELLED = "CANCELLED";
15
+ export declare const WITHDRAWAL_STATUS_FAILED = "FAILED";
16
+ export declare const WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW = "Pending Review";
17
+ export declare const WITHDRAWAL_STATUS_LABEL_APPROVED = "Approved";
18
+ export declare const WITHDRAWAL_STATUS_LABEL_REJECTED = "Rejected";
19
+ export declare const WITHDRAWAL_STATUS_LABEL_PROCESSING = "Processing";
20
+ export declare const WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION = "Awaiting Asset Liquidation";
21
+ export declare const WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS = "Liquidation in Progress";
22
+ export declare const WITHDRAWAL_STATUS_LABEL_COMPLETED = "Completed";
23
+ export declare const WITHDRAWAL_STATUS_LABEL_CANCELLED = "Cancelled";
24
+ export declare const WITHDRAWAL_STATUS_LABEL_FAILED = "Failed";
25
+ export declare const WITHDRAWAL_STATUS_OPTIONS: {
26
+ value: string;
27
+ label: string;
28
+ }[];
29
+ export declare const LIQUIDATION_STATUS_PENDING = "PENDING";
30
+ export declare const LIQUIDATION_STATUS_TRADES_CREATED = "TRADES_CREATED";
31
+ export declare const LIQUIDATION_STATUS_EXECUTED = "EXECUTED";
32
+ export declare const LIQUIDATION_STATUS_SETTLED = "SETTLED";
33
+ export declare const LIQUIDATION_STATUS_FAILED = "FAILED";
34
+ export declare const LIQUIDATION_STATUS_LABEL_PENDING = "Pending";
35
+ export declare const LIQUIDATION_STATUS_LABEL_TRADES_CREATED = "Trades Created";
36
+ export declare const LIQUIDATION_STATUS_LABEL_EXECUTED = "Executed";
37
+ export declare const LIQUIDATION_STATUS_LABEL_SETTLED = "Settled";
38
+ export declare const LIQUIDATION_STATUS_LABEL_FAILED = "Failed";
39
+ export declare const LIQUIDATION_STATUS_OPTIONS: {
40
+ value: string;
41
+ label: string;
42
+ }[];
43
+ export declare const WITHDRAWAL_TYPE_FULL_CASH = "FULL_CASH";
44
+ export declare const WITHDRAWAL_TYPE_PARTIAL_CASH = "PARTIAL_CASH";
45
+ export declare const WITHDRAWAL_TYPE_LABEL_FULL_CASH = "Full Cash Withdrawal";
46
+ export declare const WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH = "Partial Cash Withdrawal";
47
+ export declare const WITHDRAWAL_TYPE_OPTIONS: {
48
+ value: string;
49
+ label: string;
50
+ }[];
51
+ export declare const WITHDRAWAL_REASON_INVESTMENT_STRATEGY = "INVESTMENT_STRATEGY";
52
+ export declare const WITHDRAWAL_REASON_PERSONAL_EXPENSES = "PERSONAL_EXPENSES";
53
+ export declare const WITHDRAWAL_REASON_EMERGENCY = "EMERGENCY";
54
+ export declare const WITHDRAWAL_REASON_OTHER = "OTHER";
55
+ export declare const WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY = "Investment Strategy Change";
56
+ export declare const WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES = "Personal Expenses";
57
+ export declare const WITHDRAWAL_REASON_LABEL_EMERGENCY = "Emergency";
58
+ export declare const WITHDRAWAL_REASON_LABEL_OTHER = "Other";
59
+ export declare const WITHDRAWAL_REASON_OPTIONS: {
60
+ value: string;
61
+ label: string;
62
+ }[];
63
+ export declare const API_ENDPOINTS: {
64
+ readonly WITHDRAWAL_REQUESTS: "/api/withdrawal-requests/";
65
+ readonly WITHDRAWAL_LIQUIDATIONS: "/api/withdrawal-liquidations/";
66
+ };
67
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/services/withdrawals/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,MAAM,gCAAgC,mBAAmB,CAAC;AACjE,eAAO,MAAM,0BAA0B,aAAa,CAAC;AACrD,eAAO,MAAM,0BAA0B,aAAa,CAAC;AACrD,eAAO,MAAM,4BAA4B,eAAe,CAAC;AACzD,eAAO,MAAM,sCAAsC,yBAAyB,C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AqC,wBAAwB,CAAC;AAC3E,eAAO,MAAM,mCAAmC,sBAAsB,CAAC;AACvE,eAAO,MAAM,2BAA2B,cAAc,CAAC;AACvD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAG/C,eAAO,MAAM,2CAA2C,+BAA+B,CAAC;AACxF,eAAO,MAAM,yCAAyC,sBAAsB,CAAC;AAC7E,eAAO,MAAM,iCAAiC,cAAc,CAAC;AAC7D,eAAO,MAAM,6BAA6B,UAAU,CAAC;AAGrD,eAAO,MAAM,yBAAyB;;;GAKrC,CAAC;AAGF,eAAO,MAAM,aAAa;;;CAGhB,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Withdrawal-related constants for the shared services package.
3
+ *
4
+ * These constants should match the backend constants in bilberry/withdrawals/constants.py
5
+ * to ensure consistency across the application stack.
6
+ */
7
+ // Withdrawal status constants
8
+ export const WITHDRAWAL_STATUS_PENDING_REVIEW = 'PENDING_REVIEW';
9
+ export const WITHDRAWAL_STATUS_APPROVED = 'APPROVED';
10
+ export const WITHDRAWAL_STATUS_REJECTED = 'REJECTED';
11
+ export const WITHDRAWAL_STATUS_PROCESSING = 'PROCESSING';
12
+ export const WITHDRAWAL_STATUS_AWAITING_LIQUIDATION = 'AWAITING_LIQUIDATION';
13
+ export const WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS = 'LIQUIDATION_IN_PROGRESS';
14
+ export const WITHDRAWAL_STATUS_COMPLETED = 'COMPLETED';
15
+ export const WITHDRAWAL_STATUS_CANCELLED = 'CANCELLED';
16
+ export const WITHDRAWAL_STATUS_FAILED = 'FAILED';
17
+ // Withdrawal status label constants
18
+ export const WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW = 'Pending Review';
19
+ export const WITHDRAWAL_STATUS_LABEL_APPROVED = 'Approved';
20
+ export const WITHDRAWAL_STATUS_LABEL_REJECTED = 'Rejected';
21
+ export const WITHDRAWAL_STATUS_LABEL_PROCESSING = 'Processing';
22
+ export const WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION = 'Awaiting Asset Liquidation';
23
+ export const WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS = 'Liquidation in Progress';
24
+ export const WITHDRAWAL_STATUS_LABEL_COMPLETED = 'Completed';
25
+ export const WITHDRAWAL_STATUS_LABEL_CANCELLED = 'Cancelled';
26
+ export const WITHDRAWAL_STATUS_LABEL_FAILED = 'Failed';
27
+ // Withdrawal status options
28
+ export const WITHDRAWAL_STATUS_OPTIONS = [
29
+ { value: WITHDRAWAL_STATUS_PENDING_REVIEW, label: WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW },
30
+ { value: WITHDRAWAL_STATUS_APPROVED, label: WITHDRAWAL_STATUS_LABEL_APPROVED },
31
+ { value: WITHDRAWAL_STATUS_REJECTED, label: WITHDRAWAL_STATUS_LABEL_REJECTED },
32
+ { value: WITHDRAWAL_STATUS_PROCESSING, label: WITHDRAWAL_STATUS_LABEL_PROCESSING },
33
+ { value: WITHDRAWAL_STATUS_AWAITING_LIQUIDATION, label: WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION },
34
+ { value: WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS, label: WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS },
35
+ { value: WITHDRAWAL_STATUS_COMPLETED, label: WITHDRAWAL_STATUS_LABEL_COMPLETED },
36
+ { value: WITHDRAWAL_STATUS_CANCELLED, label: WITHDRAWAL_STATUS_LABEL_CANCELLED },
37
+ { value: WITHDRAWAL_STATUS_FAILED, label: WITHDRAWAL_STATUS_LABEL_FAILED },
38
+ ];
39
+ // Liquidation status constants
40
+ export const LIQUIDATION_STATUS_PENDING = 'PENDING';
41
+ export const LIQUIDATION_STATUS_TRADES_CREATED = 'TRADES_CREATED';
42
+ export const LIQUIDATION_STATUS_EXECUTED = 'EXECUTED';
43
+ export const LIQUIDATION_STATUS_SETTLED = 'SETTLED';
44
+ export const LIQUIDATION_STATUS_FAILED = 'FAILED';
45
+ // Liquidation status label constants
46
+ export const LIQUIDATION_STATUS_LABEL_PENDING = 'Pending';
47
+ export const LIQUIDATION_STATUS_LABEL_TRADES_CREATED = 'Trades Created';
48
+ export const LIQUIDATION_STATUS_LABEL_EXECUTED = 'Executed';
49
+ export const LIQUIDATION_STATUS_LABEL_SETTLED = 'Settled';
50
+ export const LIQUIDATION_STATUS_LABEL_FAILED = 'Failed';
51
+ // Liquidation status options
52
+ export const LIQUIDATION_STATUS_OPTIONS = [
53
+ { value: LIQUIDATION_STATUS_PENDING, label: LIQUIDATION_STATUS_LABEL_PENDING },
54
+ { value: LIQUIDATION_STATUS_TRADES_CREATED, label: LIQUIDATION_STATUS_LABEL_TRADES_CREATED },
55
+ { value: LIQUIDATION_STATUS_EXECUTED, label: LIQUIDATION_STATUS_LABEL_EXECUTED },
56
+ { value: LIQUIDATION_STATUS_SETTLED, label: LIQUIDATION_STATUS_LABEL_SETTLED },
57
+ { value: LIQUIDATION_STATUS_FAILED, label: LIQUIDATION_STATUS_LABEL_FAILED },
58
+ ];
59
+ // Withdrawal Type constants
60
+ export const WITHDRAWAL_TYPE_FULL_CASH = 'FULL_CASH';
61
+ export const WITHDRAWAL_TYPE_PARTIAL_CASH = 'PARTIAL_CASH';
62
+ // Withdrawal Type label constants
63
+ export const WITHDRAWAL_TYPE_LABEL_FULL_CASH = 'Full Cash Withdrawal';
64
+ export const WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH = 'Partial Cash Withdrawal';
65
+ // Withdrawal Type options
66
+ export const WITHDRAWAL_TYPE_OPTIONS = [
67
+ { value: WITHDRAWAL_TYPE_FULL_CASH, label: WITHDRAWAL_TYPE_LABEL_FULL_CASH },
68
+ { value: WITHDRAWAL_TYPE_PARTIAL_CASH, label: WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH },
69
+ ];
70
+ // Withdrawal Reason constants
71
+ export const WITHDRAWAL_REASON_INVESTMENT_STRATEGY = 'INVESTMENT_STRATEGY';
72
+ export const WITHDRAWAL_REASON_PERSONAL_EXPENSES = 'PERSONAL_EXPENSES';
73
+ export const WITHDRAWAL_REASON_EMERGENCY = 'EMERGENCY';
74
+ export const WITHDRAWAL_REASON_OTHER = 'OTHER';
75
+ // Withdrawal Reason label constants
76
+ export const WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY = 'Investment Strategy Change';
77
+ export const WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES = 'Personal Expenses';
78
+ export const WITHDRAWAL_REASON_LABEL_EMERGENCY = 'Emergency';
79
+ export const WITHDRAWAL_REASON_LABEL_OTHER = 'Other';
80
+ // Withdrawal Reason options
81
+ export const WITHDRAWAL_REASON_OPTIONS = [
82
+ { value: WITHDRAWAL_REASON_INVESTMENT_STRATEGY, label: WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY },
83
+ { value: WITHDRAWAL_REASON_PERSONAL_EXPENSES, label: WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES },
84
+ { value: WITHDRAWAL_REASON_EMERGENCY, label: WITHDRAWAL_REASON_LABEL_EMERGENCY },
85
+ { value: WITHDRAWAL_REASON_OTHER, label: WITHDRAWAL_REASON_LABEL_OTHER },
86
+ ];
87
+ // API Endpoints
88
+ export const API_ENDPOINTS = {
89
+ WITHDRAWAL_REQUESTS: '/api/withdrawal-requests/',
90
+ WITHDRAWAL_LIQUIDATIONS: '/api/withdrawal-liquidations/',
91
+ };
@@ -0,0 +1,6 @@
1
+ export type { WithdrawalRequest, WithdrawalAssetLiquidation, WithdrawalRequestPayload, WithdrawalAssetLiquidationPayload, WithdrawalRequestQueryParams, WithdrawalAssetLiquidationQueryParams, PaginatedWithdrawalRequests, PaginatedWithdrawalAssetLiquidations, WithdrawalStatus, WithdrawalType, WithdrawalReason, WithdrawalLiquidationStatus, } from './types';
2
+ export * as WithdrawalRequests from './withdrawal_requests';
3
+ export * as WithdrawalLiquidations from './withdrawal_liquidations';
4
+ export { formatWithdrawalAmount, getStatusColor, getStatusLabel, getWithdrawalTypeLabel, getReasonLabel, formatLiquidationValue, getLiquidationStatusColor, getLiquidationStatusLabel, calculateLiquidationProgress, getTotalEstimatedValue, formatSharesQuantity, } from './utils';
5
+ export { WITHDRAWAL_STATUS_PENDING_REVIEW, WITHDRAWAL_STATUS_APPROVED, WITHDRAWAL_STATUS_REJECTED, WITHDRAWAL_STATUS_PROCESSING, WITHDRAWAL_STATUS_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_COMPLETED, WITHDRAWAL_STATUS_CANCELLED, WITHDRAWAL_STATUS_FAILED, WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW, WITHDRAWAL_STATUS_LABEL_APPROVED, WITHDRAWAL_STATUS_LABEL_REJECTED, WITHDRAWAL_STATUS_LABEL_PROCESSING, WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_LABEL_COMPLETED, WITHDRAWAL_STATUS_LABEL_CANCELLED, WITHDRAWAL_STATUS_LABEL_FAILED, WITHDRAWAL_STATUS_OPTIONS, LIQUIDATION_STATUS_PENDING, LIQUIDATION_STATUS_TRADES_CREATED, LIQUIDATION_STATUS_EXECUTED, LIQUIDATION_STATUS_SETTLED, LIQUIDATION_STATUS_FAILED, LIQUIDATION_STATUS_LABEL_PENDING, LIQUIDATION_STATUS_LABEL_TRADES_CREATED, LIQUIDATION_STATUS_LABEL_EXECUTED, LIQUIDATION_STATUS_LABEL_SETTLED, LIQUIDATION_STATUS_LABEL_FAILED, LIQUIDATION_STATUS_OPTIONS, WITHDRAWAL_TYPE_FULL_CASH, WITHDRAWAL_TYPE_PARTIAL_CASH, WITHDRAWAL_TYPE_LABEL_FULL_CASH, WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH, WITHDRAWAL_TYPE_OPTIONS, WITHDRAWAL_REASON_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_PERSONAL_EXPENSES, WITHDRAWAL_REASON_EMERGENCY, WITHDRAWAL_REASON_OTHER, WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES, WITHDRAWAL_REASON_LABEL_EMERGENCY, WITHDRAWAL_REASON_LABEL_OTHER, WITHDRAWAL_REASON_OPTIONS, } from './constants';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/withdrawals/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EACjC,4BAA4B,EAC5B,qCAAqC,EACrC,2BAA2B,EAC3B,oCAAoC,EACpC,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,sBAAsB,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,sCAAsC,EACtC,yCAAyC,EACzC,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,sCAAsC,EACtC,gCAAgC,EAChC,gCAAgC,EAChC,kCAAkC,EAClC,4CAA4C,EAC5C,+CAA+C,EAC/C,iCAAiC,EACjC,iCAAiC,EACjC,8BAA8B,EAC9B,yBAAyB,EACzB,0BAA0B,EAC1B,iCAAiC,EACjC,2BAA2B,EAC3B,0BAA0B,EAC1B,yBAAyB,EACzB,gCAAgC,EAChC,uCAAuC,EACvC,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,EAC5B,+BAA+B,EAC/B,kCAAkC,EAClC,uBAAuB,EACvB,qCAAqC,EACrC,mCAAmC,EACnC,2BAA2B,EAC3B,uBAAuB,EACvB,2CAA2C,EAC3C,yCAAyC,EACzC,iCAAiC,EACjC,6BAA6B,EAC7B,yBAAyB,GAC1B,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ // Export sub-services
2
+ export * as WithdrawalRequests from './withdrawal_requests';
3
+ export * as WithdrawalLiquidations from './withdrawal_liquidations';
4
+ // Export utility functions
5
+ export { formatWithdrawalAmount, getStatusColor, getStatusLabel, getWithdrawalTypeLabel, getReasonLabel, formatLiquidationValue, getLiquidationStatusColor, getLiquidationStatusLabel, calculateLiquidationProgress, getTotalEstimatedValue, formatSharesQuantity, } from './utils';
6
+ // Export constants as values
7
+ export { WITHDRAWAL_STATUS_PENDING_REVIEW, WITHDRAWAL_STATUS_APPROVED, WITHDRAWAL_STATUS_REJECTED, WITHDRAWAL_STATUS_PROCESSING, WITHDRAWAL_STATUS_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_COMPLETED, WITHDRAWAL_STATUS_CANCELLED, WITHDRAWAL_STATUS_FAILED, WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW, WITHDRAWAL_STATUS_LABEL_APPROVED, WITHDRAWAL_STATUS_LABEL_REJECTED, WITHDRAWAL_STATUS_LABEL_PROCESSING, WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_LABEL_COMPLETED, WITHDRAWAL_STATUS_LABEL_CANCELLED, WITHDRAWAL_STATUS_LABEL_FAILED, WITHDRAWAL_STATUS_OPTIONS, LIQUIDATION_STATUS_PENDING, LIQUIDATION_STATUS_TRADES_CREATED, LIQUIDATION_STATUS_EXECUTED, LIQUIDATION_STATUS_SETTLED, LIQUIDATION_STATUS_FAILED, LIQUIDATION_STATUS_LABEL_PENDING, LIQUIDATION_STATUS_LABEL_TRADES_CREATED, LIQUIDATION_STATUS_LABEL_EXECUTED, LIQUIDATION_STATUS_LABEL_SETTLED, LIQUIDATION_STATUS_LABEL_FAILED, LIQUIDATION_STATUS_OPTIONS, WITHDRAWAL_TYPE_FULL_CASH, WITHDRAWAL_TYPE_PARTIAL_CASH, WITHDRAWAL_TYPE_LABEL_FULL_CASH, WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH, WITHDRAWAL_TYPE_OPTIONS, WITHDRAWAL_REASON_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_PERSONAL_EXPENSES, WITHDRAWAL_REASON_EMERGENCY, WITHDRAWAL_REASON_OTHER, WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES, WITHDRAWAL_REASON_LABEL_EMERGENCY, WITHDRAWAL_REASON_LABEL_OTHER, WITHDRAWAL_REASON_OPTIONS, } from './constants';
@@ -0,0 +1,4 @@
1
+ export * as WithdrawalRequests from './withdrawal_requests';
2
+ export * as WithdrawalLiquidations from './withdrawal_liquidations';
3
+ export { formatWithdrawalAmount, getStatusColor, getStatusLabel, getWithdrawalTypeLabel, getReasonLabel, formatLiquidationValue, getLiquidationStatusColor, getLiquidationStatusLabel, calculateLiquidationProgress, getTotalEstimatedValue, formatSharesQuantity, } from './utils';
4
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/withdrawals/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,kBAAkB,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,sBAAsB,MAAM,2BAA2B,CAAC;AAGpE,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Main service functions combining withdrawal requests and liquidations
2
+ export * as WithdrawalRequests from './withdrawal_requests';
3
+ export * as WithdrawalLiquidations from './withdrawal_liquidations';
4
+ // Re-export utility functions at the top level for convenience
5
+ export { formatWithdrawalAmount, getStatusColor, getStatusLabel, getWithdrawalTypeLabel, getReasonLabel, formatLiquidationValue, getLiquidationStatusColor, getLiquidationStatusLabel, calculateLiquidationProgress, getTotalEstimatedValue, formatSharesQuantity, } from './utils';
@@ -0,0 +1,81 @@
1
+ import type { PaginatedResponse } from '../../api/types';
2
+ export type WithdrawalStatus = 'PENDING_REVIEW' | 'APPROVED' | 'REJECTED' | 'PROCESSING' | 'AWAITING_LIQUIDATION' | 'LIQUIDATION_IN_PROGRESS' | 'COMPLETED' | 'CANCELLED' | 'FAILED';
3
+ export type WithdrawalType = 'FULL_CASH' | 'PARTIAL_CASH';
4
+ export type WithdrawalReason = 'INVESTMENT_STRATEGY' | 'PERSONAL_EXPENSES' | 'EMERGENCY' | 'OTHER';
5
+ export type WithdrawalLiquidationStatus = 'PENDING' | 'TRADES_CREATED' | 'EXECUTED' | 'SETTLED' | 'FAILED';
6
+ export interface WithdrawalRequest {
7
+ uuid: string;
8
+ account: string;
9
+ requestedBy: string;
10
+ requestedAmount: string;
11
+ withdrawalType: WithdrawalType;
12
+ status: WithdrawalStatus;
13
+ requestedDate: string;
14
+ targetTradeSheet: string | null;
15
+ reason: WithdrawalReason | null;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ }
19
+ export interface WithdrawalAssetLiquidation {
20
+ uuid: string;
21
+ withdrawalRequest: string;
22
+ assetHolding: string;
23
+ sharesToLiquidate: number;
24
+ estimatedValue: string;
25
+ targetCompletionDate: string | null;
26
+ expectedSettlementDate: string | null;
27
+ liquidationStatus: WithdrawalLiquidationStatus;
28
+ targetTrade: string | null;
29
+ instrumentName: string;
30
+ instrumentSymbol: string;
31
+ instrumentCurrency: string | null;
32
+ createdAt: string;
33
+ updatedAt: string;
34
+ }
35
+ export interface WithdrawalRequestPayload {
36
+ account: string;
37
+ requestedAmount: string;
38
+ withdrawalType?: WithdrawalType;
39
+ targetTradeSheet?: string | null;
40
+ reason?: WithdrawalReason | null;
41
+ }
42
+ export interface WithdrawalAssetLiquidationPayload {
43
+ withdrawalRequest: string;
44
+ assetHolding: string;
45
+ sharesToLiquidate: number;
46
+ estimatedValue: string;
47
+ targetCompletionDate?: string | null;
48
+ expectedSettlementDate?: string | null;
49
+ liquidationStatus?: WithdrawalLiquidationStatus;
50
+ targetTrade?: string | null;
51
+ }
52
+ export interface WithdrawalRequestQueryParams {
53
+ account?: string;
54
+ status?: string;
55
+ withdrawal_type?: string;
56
+ start_date?: string;
57
+ end_date?: string;
58
+ min_amount?: string;
59
+ max_amount?: string;
60
+ order_by?: string;
61
+ page?: number;
62
+ page_size?: number;
63
+ }
64
+ export interface WithdrawalAssetLiquidationQueryParams {
65
+ withdrawal_request?: string;
66
+ asset_holding?: string;
67
+ liquidation_status?: string;
68
+ target_completion_start_date?: string;
69
+ target_completion_end_date?: string;
70
+ expected_settlement_start_date?: string;
71
+ expected_settlement_end_date?: string;
72
+ target_trade?: string;
73
+ min_value?: string;
74
+ max_value?: string;
75
+ order_by?: string;
76
+ page?: number;
77
+ page_size?: number;
78
+ }
79
+ export type PaginatedWithdrawalRequests = PaginatedResponse<WithdrawalRequest>;
80
+ export type PaginatedWithdrawalAssetLiquidations = PaginatedResponse<WithdrawalAssetLiquidation>;
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/withdrawals/types.ts"],"names":[],"mappings":"AAAA,O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AM,CAAC;IAC5B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAGD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;AAC/E,MAAM,MAAM,oCAAoC,GAAG,iBAAiB,CAAC,0BAA0B,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { WithdrawalRequest, WithdrawalAssetLiquidation } from './types';
2
+ export declare const formatWithdrawalAmount: (amount: string | number) => string;
3
+ export declare const getStatusColor: (status: WithdrawalRequest["status"]) => string;
4
+ export declare const getStatusLabel: (status: WithdrawalRequest["status"]) => string;
5
+ export declare const getWithdrawalTypeLabel: (type: WithdrawalRequest["withdrawalType"]) => string;
6
+ export declare const getReasonLabel: (reason: WithdrawalRequest["reason"]) => string;
7
+ export declare const formatLiquidationValue: (value: string | number) => string;
8
+ export declare const getLiquidationStatusColor: (status: WithdrawalAssetLiquidation["liquidationStatus"]) => string;
9
+ export declare const getLiquidationStatusLabel: (status: WithdrawalAssetLiquidation["liquidationStatus"]) => string;
10
+ export declare const calculateLiquidationProgress: (liquidations: WithdrawalAssetLiquidation[]) => {
11
+ total: number;
12
+ pending: number;
13
+ inProgress: number;
14
+ completed: number;
15
+ failed: number;
16
+ completionRate: number;
17
+ };
18
+ export declare const getTotalEstimatedValue: (liquidations: WithdrawalAssetLiquidation[]) => number;
19
+ export declare const formatSharesQuantity: (shares: number)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M,KAAG,MAKrD,CAAC"}
@@ -0,0 +1,110 @@
1
+ import { WITHDRAWAL_STATUS_PENDING_REVIEW, WITHDRAWAL_STATUS_APPROVED, WITHDRAWAL_STATUS_REJECTED, WITHDRAWAL_STATUS_PROCESSING, WITHDRAWAL_STATUS_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_COMPLETED, WITHDRAWAL_STATUS_CANCELLED, WITHDRAWAL_STATUS_FAILED, WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW, WITHDRAWAL_STATUS_LABEL_APPROVED, WITHDRAWAL_STATUS_LABEL_REJECTED, WITHDRAWAL_STATUS_LABEL_PROCESSING, WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION, WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS, WITHDRAWAL_STATUS_LABEL_COMPLETED, WITHDRAWAL_STATUS_LABEL_CANCELLED, WITHDRAWAL_STATUS_LABEL_FAILED, WITHDRAWAL_TYPE_FULL_CASH, WITHDRAWAL_TYPE_PARTIAL_CASH, WITHDRAWAL_TYPE_LABEL_FULL_CASH, WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH, WITHDRAWAL_REASON_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_PERSONAL_EXPENSES, WITHDRAWAL_REASON_EMERGENCY, WITHDRAWAL_REASON_OTHER, WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY, WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES, WITHDRAWAL_REASON_LABEL_EMERGENCY, WITHDRAWAL_REASON_LABEL_OTHER, LIQUIDATION_STATUS_PENDING, LIQUIDATION_STATUS_TRADES_CREATED, LIQUIDATION_STATUS_EXECUTED, LIQUIDATION_STATUS_SETTLED, LIQUIDATION_STATUS_FAILED, LIQUIDATION_STATUS_LABEL_PENDING, LIQUIDATION_STATUS_LABEL_TRADES_CREATED, LIQUIDATION_STATUS_LABEL_EXECUTED, LIQUIDATION_STATUS_LABEL_SETTLED, LIQUIDATION_STATUS_LABEL_FAILED, } from './constants';
2
+ // Withdrawal request formatting utilities
3
+ export const formatWithdrawalAmount = (amount) => {
4
+ const numValue = typeof amount === 'string' ? parseFloat(amount) : amount;
5
+ return new Intl.NumberFormat('en-AU', {
6
+ style: 'currency',
7
+ currency: 'AUD',
8
+ }).format(numValue);
9
+ };
10
+ export const getStatusColor = (status) => {
11
+ const statusColors = {
12
+ [WITHDRAWAL_STATUS_PENDING_REVIEW]: 'text-warning-600',
13
+ [WITHDRAWAL_STATUS_APPROVED]: 'text-success-600',
14
+ [WITHDRAWAL_STATUS_REJECTED]: 'text-error-600',
15
+ [WITHDRAWAL_STATUS_PROCESSING]: 'text-primary-600',
16
+ [WITHDRAWAL_STATUS_AWAITING_LIQUIDATION]: 'text-warning-600',
17
+ [WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS]: 'text-primary-600',
18
+ [WITHDRAWAL_STATUS_COMPLETED]: 'text-success-600',
19
+ [WITHDRAWAL_STATUS_CANCELLED]: 'text-content-muted',
20
+ [WITHDRAWAL_STATUS_FAILED]: 'text-error-600',
21
+ };
22
+ return statusColors[status] || 'text-content-muted';
23
+ };
24
+ export const getStatusLabel = (status) => {
25
+ const statusLabels = {
26
+ [WITHDRAWAL_STATUS_PENDING_REVIEW]: WITHDRAWAL_STATUS_LABEL_PENDING_REVIEW,
27
+ [WITHDRAWAL_STATUS_APPROVED]: WITHDRAWAL_STATUS_LABEL_APPROVED,
28
+ [WITHDRAWAL_STATUS_REJECTED]: WITHDRAWAL_STATUS_LABEL_REJECTED,
29
+ [WITHDRAWAL_STATUS_PROCESSING]: WITHDRAWAL_STATUS_LABEL_PROCESSING,
30
+ [WITHDRAWAL_STATUS_AWAITING_LIQUIDATION]: WITHDRAWAL_STATUS_LABEL_AWAITING_LIQUIDATION,
31
+ [WITHDRAWAL_STATUS_LIQUIDATION_IN_PROGRESS]: WITHDRAWAL_STATUS_LABEL_LIQUIDATION_IN_PROGRESS,
32
+ [WITHDRAWAL_STATUS_COMPLETED]: WITHDRAWAL_STATUS_LABEL_COMPLETED,
33
+ [WITHDRAWAL_STATUS_CANCELLED]: WITHDRAWAL_STATUS_LABEL_CANCELLED,
34
+ [WITHDRAWAL_STATUS_FAILED]: WITHDRAWAL_STATUS_LABEL_FAILED,
35
+ };
36
+ return statusLabels[status] || status;
37
+ };
38
+ export const getWithdrawalTypeLabel = (type) => {
39
+ const typeLabels = {
40
+ [WITHDRAWAL_TYPE_FULL_CASH]: WITHDRAWAL_TYPE_LABEL_FULL_CASH,
41
+ [WITHDRAWAL_TYPE_PARTIAL_CASH]: WITHDRAWAL_TYPE_LABEL_PARTIAL_CASH,
42
+ };
43
+ return typeLabels[type] || type;
44
+ };
45
+ export const getReasonLabel = (reason) => {
46
+ if (!reason)
47
+ return 'Not specified';
48
+ const reasonLabels = {
49
+ [WITHDRAWAL_REASON_INVESTMENT_STRATEGY]: WITHDRAWAL_REASON_LABEL_INVESTMENT_STRATEGY,
50
+ [WITHDRAWAL_REASON_PERSONAL_EXPENSES]: WITHDRAWAL_REASON_LABEL_PERSONAL_EXPENSES,
51
+ [WITHDRAWAL_REASON_EMERGENCY]: WITHDRAWAL_REASON_LABEL_EMERGENCY,
52
+ [WITHDRAWAL_REASON_OTHER]: WITHDRAWAL_REASON_LABEL_OTHER,
53
+ };
54
+ return reasonLabels[reason] || reason;
55
+ };
56
+ // Withdrawal liquidation formatting utilities
57
+ export const formatLiquidationValue = (value) => {
58
+ const numValue = typeof value === 'string' ? parseFloat(value) : value;
59
+ return new Intl.NumberFormat('en-AU', {
60
+ style: 'currency',
61
+ currency: 'AUD',
62
+ }).format(numValue);
63
+ };
64
+ export const getLiquidationStatusColor = (status) => {
65
+ const statusColors = {
66
+ [LIQUIDATION_STATUS_PENDING]: 'text-warning-600',
67
+ [LIQUIDATION_STATUS_TRADES_CREATED]: 'text-primary-600',
68
+ [LIQUIDATION_STATUS_EXECUTED]: 'text-accent-secondary',
69
+ [LIQUIDATION_STATUS_SETTLED]: 'text-success-600',
70
+ [LIQUIDATION_STATUS_FAILED]: 'text-error-600',
71
+ };
72
+ return statusColors[status] || 'text-content-muted';
73
+ };
74
+ export const getLiquidationStatusLabel = (status) => {
75
+ const statusLabels = {
76
+ [LIQUIDATION_STATUS_PENDING]: LIQUIDATION_STATUS_LABEL_PENDING,
77
+ [LIQUIDATION_STATUS_TRADES_CREATED]: LIQUIDATION_STATUS_LABEL_TRADES_CREATED,
78
+ [LIQUIDATION_STATUS_EXECUTED]: LIQUIDATION_STATUS_LABEL_EXECUTED,
79
+ [LIQUIDATION_STATUS_SETTLED]: LIQUIDATION_STATUS_LABEL_SETTLED,
80
+ [LIQUIDATION_STATUS_FAILED]: LIQUIDATION_STATUS_LABEL_FAILED,
81
+ };
82
+ return statusLabels[status] || status;
83
+ };
84
+ export const calculateLiquidationProgress = (liquidations) => {
85
+ const total = liquidations.length;
86
+ const pending = liquidations.filter((l) => l.liquidationStatus === LIQUIDATION_STATUS_PENDING).length;
87
+ const inProgress = liquidations.filter((l) => [LIQUIDATION_STATUS_TRADES_CREATED, LIQUIDATION_STATUS_EXECUTED].includes(l.liquidationStatus)).length;
88
+ const completed = liquidations.filter((l) => l.liquidationStatus === LIQUIDATION_STATUS_SETTLED).length;
89
+ const failed = liquidations.filter((l) => l.liquidationStatus === LIQUIDATION_STATUS_FAILED).length;
90
+ const completionRate = total > 0 ? (completed / total) * 100 : 0;
91
+ return {
92
+ total,
93
+ pending,
94
+ inProgress,
95
+ completed,
96
+ failed,
97
+ completionRate,
98
+ };
99
+ };
100
+ export const getTotalEstimatedValue = (liquidations) => {
101
+ return liquidations.reduce((total, liquidation) => {
102
+ return total + parseFloat(liquidation.estimatedValue || '0');
103
+ }, 0);
104
+ };
105
+ export const formatSharesQuantity = (shares) => {
106
+ return new Intl.NumberFormat('en-AU', {
107
+ minimumFractionDigits: 0,
108
+ maximumFractionDigits: 0,
109
+ }).format(shares);
110
+ };
@@ -0,0 +1,3 @@
1
+ export type { WithdrawalAssetLiquidation, WithdrawalAssetLiquidationPayload, WithdrawalAssetLiquidationQueryParams, PaginatedWithdrawalAssetLiquidations, WithdrawalLiquidationStatus, } from './types';
2
+ export { getWithdrawalAssetLiquidations, createWithdrawalAssetLiquidation, updateWithdrawalAssetLiquidation, getWithdrawalAssetLiquidationByUuid, deleteWithdrawalAssetLiquidation, getAssetLiquidationsByWithdrawalRequest, } from './service';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_liquidations/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,0BAA0B,EAC1B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,gCAAgC,EAChC,mCAAmC,EACnC,gCAAgC,EAChC,uCAAuC,GACxC,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ // Export service functions
2
+ export { getWithdrawalAssetLiquidations, createWithdrawalAssetLiquidation, updateWithdrawalAssetLiquidation, getWithdrawalAssetLiquidationByUuid, deleteWithdrawalAssetLiquidation, getAssetLiquidationsByWithdrawalRequest, } from './service';
@@ -0,0 +1,8 @@
1
+ import type { WithdrawalAssetLiquidation, WithdrawalAssetLiquidationPayload, WithdrawalAssetLiquidationQueryParams, PaginatedWithdrawalAssetLiquidations } from './types';
2
+ export declare const getWithdrawalAssetLiquidations: (params?: WithdrawalAssetLiquidationQueryParams) => Promise<import("axios").AxiosResponse<PaginatedWithdrawalAssetLiquidations, any>>;
3
+ export declare const createWithdrawalAssetLiquidation: (data: WithdrawalAssetLiquidationPayload) => Promise<import("axios").AxiosResponse<WithdrawalAssetLiquidation, any>>;
4
+ export declare const updateWithdrawalAssetLiquidation: (uuid: string, data: Partial<WithdrawalAssetLiquidationPayload>) => Promise<import("axios").AxiosResponse<WithdrawalAssetLiquidation, any>>;
5
+ export declare const getWithdrawalAssetLiquidationByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<WithdrawalAssetLiquidation, any>>;
6
+ export declare const deleteWithdrawalAssetLiquidation: (uuid: string) => Promise<import("axios").AxiosResponse<void, any>>;
7
+ export declare const getAssetLiquidationsByWithdrawalRequest: (withdrawalRequestUuid: string) => Promise<import("axios").AxiosResponse<PaginatedWithdrawalAssetLiquidations, any>>;
8
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_liquidations/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAC1B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACrC,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,8BAA8B,GAAI,SAAS,qCAAqC,sFA8C5F,CAAC;AAGF,eAAO,MAAM,gCAAgC,GAAI,MAAM,iCAAiC,4EAEvF,CAAC;AAGF,eAAO,MAAM,gCAAgC,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC,iCAAiC,CAAC,4EAE9G,CAAC;AAGF,eAAO,MAAM,mCAAmC,GAAI,MAAM,MAAM,4EAE/D,CAAC;AAGF,eAAO,MAAM,gCAAgC,GAAI,MAAM,MAAM,sDAE5D,CAAC;AAGF,eAAO,MAAM,uCAAuC,GAAI,uBAAuB,MAAM,sFAEpF,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { webApiClient } from '../../../api/apiClient';
2
+ import { API_ENDPOINTS } from '../constants';
3
+ // Fetch withdrawal asset liquidations with optional filtering
4
+ export const getWithdrawalAssetLiquidations = (params) => {
5
+ const queryParams = {};
6
+ if (params?.withdrawal_request) {
7
+ queryParams.withdrawal_request = params.withdrawal_request;
8
+ }
9
+ if (params?.asset_holding) {
10
+ queryParams.asset_holding = params.asset_holding;
11
+ }
12
+ if (params?.liquidation_status) {
13
+ queryParams.liquidation_status = params.liquidation_status;
14
+ }
15
+ if (params?.target_completion_start_date) {
16
+ queryParams.target_completion_start_date = params.target_completion_start_date;
17
+ }
18
+ if (params?.target_completion_end_date) {
19
+ queryParams.target_completion_end_date = params.target_completion_end_date;
20
+ }
21
+ if (params?.expected_settlement_start_date) {
22
+ queryParams.expected_settlement_start_date = params.expected_settlement_start_date;
23
+ }
24
+ if (params?.expected_settlement_end_date) {
25
+ queryParams.expected_settlement_end_date = params.expected_settlement_end_date;
26
+ }
27
+ if (params?.target_trade) {
28
+ queryParams.target_trade = params.target_trade;
29
+ }
30
+ if (params?.min_value) {
31
+ queryParams.min_value = params.min_value;
32
+ }
33
+ if (params?.max_value) {
34
+ queryParams.max_value = params.max_value;
35
+ }
36
+ if (params?.order_by) {
37
+ queryParams.order_by = params.order_by;
38
+ }
39
+ if (params?.page) {
40
+ queryParams.page = params.page;
41
+ }
42
+ if (params?.page_size) {
43
+ queryParams.page_size = params.page_size;
44
+ }
45
+ return webApiClient.get(API_ENDPOINTS.WITHDRAWAL_LIQUIDATIONS, {
46
+ params: queryParams,
47
+ });
48
+ };
49
+ // Create a new withdrawal asset liquidation
50
+ export const createWithdrawalAssetLiquidation = (data) => {
51
+ return webApiClient.post(API_ENDPOINTS.WITHDRAWAL_LIQUIDATIONS, data);
52
+ };
53
+ // Update an existing withdrawal asset liquidation by UUID
54
+ export const updateWithdrawalAssetLiquidation = (uuid, data) => {
55
+ return webApiClient.patch(`${API_ENDPOINTS.WITHDRAWAL_LIQUIDATIONS}${uuid}/`, data);
56
+ };
57
+ // Get withdrawal asset liquidation by UUID
58
+ export const getWithdrawalAssetLiquidationByUuid = (uuid) => {
59
+ return webApiClient.get(`${API_ENDPOINTS.WITHDRAWAL_LIQUIDATIONS}${uuid}/`);
60
+ };
61
+ // Delete a withdrawal asset liquidation by UUID
62
+ export const deleteWithdrawalAssetLiquidation = (uuid) => {
63
+ return webApiClient.delete(`${API_ENDPOINTS.WITHDRAWAL_LIQUIDATIONS}${uuid}/`);
64
+ };
65
+ // Get asset liquidations for a specific withdrawal request
66
+ export const getAssetLiquidationsByWithdrawalRequest = (withdrawalRequestUuid) => {
67
+ return getWithdrawalAssetLiquidations({ withdrawal_request: withdrawalRequestUuid });
68
+ };
@@ -0,0 +1,2 @@
1
+ export type { WithdrawalAssetLiquidation, WithdrawalAssetLiquidationPayload, WithdrawalAssetLiquidationQueryParams, PaginatedWithdrawalAssetLiquidations, WithdrawalLiquidationStatus, } from '../types';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_liquidations/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,0BAA0B,EAC1B,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type { WithdrawalRequest, WithdrawalRequestPayload, WithdrawalRequestQueryParams, PaginatedWithdrawalRequests, WithdrawalStatus, WithdrawalType, WithdrawalReason, } from './types';
2
+ export { getWithdrawalRequests, createWithdrawalRequest, updateWithdrawalRequest, getWithdrawalRequestByUuid, deleteWithdrawalRequest, } from './service';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_requests/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ // Export service functions
2
+ export { getWithdrawalRequests, createWithdrawalRequest, updateWithdrawalRequest, getWithdrawalRequestByUuid, deleteWithdrawalRequest, } from './service';
@@ -0,0 +1,7 @@
1
+ import type { WithdrawalRequest, WithdrawalRequestPayload, WithdrawalRequestQueryParams, PaginatedWithdrawalRequests } from './types';
2
+ export declare const getWithdrawalRequests: (params?: WithdrawalRequestQueryParams) => Promise<import("axios").AxiosResponse<PaginatedWithdrawalRequests, any>>;
3
+ export declare const createWithdrawalRequest: (data: WithdrawalRequestPayload) => Promise<import("axios").AxiosResponse<WithdrawalRequest, any>>;
4
+ export declare const updateWithdrawalRequest: (uuid: string, data: Partial<WithdrawalRequestPayload>) => Promise<import("axios").AxiosResponse<WithdrawalRequest, any>>;
5
+ export declare const getWithdrawalRequestByUuid: (uuid: string) => Promise<import("axios").AxiosResponse<WithdrawalRequest, any>>;
6
+ export declare const deleteWithdrawalRequest: (uuid: string) => Promise<import("axios").AxiosResponse<void, any>>;
7
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_requests/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,qBAAqB,GAAI,SAAS,4BAA4B,6EAqC1E,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAI,MAAM,wBAAwB,mEAErE,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,EAAE,MAAM,OAAO,CAAC,wBAAwB,CAAC,mEAE5F,CAAC;AAGF,eAAO,MAAM,0BAA0B,GAAI,MAAM,MAAM,mEAEtD,CAAC;AAGF,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,sDAEnD,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { webApiClient } from '../../../api/apiClient';
2
+ import { API_ENDPOINTS } from '../constants';
3
+ // Fetch withdrawal requests with optional filtering
4
+ export const getWithdrawalRequests = (params) => {
5
+ const queryParams = {};
6
+ if (params?.account) {
7
+ queryParams.account = params.account;
8
+ }
9
+ if (params?.status) {
10
+ queryParams.status = params.status;
11
+ }
12
+ if (params?.withdrawal_type) {
13
+ queryParams.withdrawal_type = params.withdrawal_type;
14
+ }
15
+ if (params?.start_date) {
16
+ queryParams.start_date = params.start_date;
17
+ }
18
+ if (params?.end_date) {
19
+ queryParams.end_date = params.end_date;
20
+ }
21
+ if (params?.min_amount) {
22
+ queryParams.min_amount = params.min_amount;
23
+ }
24
+ if (params?.max_amount) {
25
+ queryParams.max_amount = params.max_amount;
26
+ }
27
+ if (params?.order_by) {
28
+ queryParams.order_by = params.order_by;
29
+ }
30
+ if (params?.page) {
31
+ queryParams.page = params.page;
32
+ }
33
+ if (params?.page_size) {
34
+ queryParams.page_size = params.page_size;
35
+ }
36
+ return webApiClient.get(API_ENDPOINTS.WITHDRAWAL_REQUESTS, {
37
+ params: queryParams,
38
+ });
39
+ };
40
+ // Create a new withdrawal request
41
+ export const createWithdrawalRequest = (data) => {
42
+ return webApiClient.post(API_ENDPOINTS.WITHDRAWAL_REQUESTS, data);
43
+ };
44
+ // Update an existing withdrawal request by UUID
45
+ export const updateWithdrawalRequest = (uuid, data) => {
46
+ return webApiClient.patch(`${API_ENDPOINTS.WITHDRAWAL_REQUESTS}${uuid}/`, data);
47
+ };
48
+ // Get withdrawal request by UUID
49
+ export const getWithdrawalRequestByUuid = (uuid) => {
50
+ return webApiClient.get(`${API_ENDPOINTS.WITHDRAWAL_REQUESTS}${uuid}/`);
51
+ };
52
+ // Delete a withdrawal request by UUID
53
+ export const deleteWithdrawalRequest = (uuid) => {
54
+ return webApiClient.delete(`${API_ENDPOINTS.WITHDRAWAL_REQUESTS}${uuid}/`);
55
+ };
@@ -0,0 +1,2 @@
1
+ export type { WithdrawalRequest, WithdrawalRequestPayload, WithdrawalRequestQueryParams, PaginatedWithdrawalRequests, WithdrawalStatus, WithdrawalType, WithdrawalReason, } from '../types';
2
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/services/withdrawals/withdrawal_requests/types.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,gBAAgB,GACjB,MAAM,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-services",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Shared API services and client for MyPortfolio platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",