@explorins/pers-sdk 1.6.4 → 1.6.6

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 (207) hide show
  1. package/README.md +63 -37
  2. package/dist/analytics/index.d.ts +0 -16
  3. package/dist/analytics/index.d.ts.map +1 -1
  4. package/dist/analytics.cjs +5 -73
  5. package/dist/analytics.cjs.map +1 -1
  6. package/dist/analytics.js +1 -72
  7. package/dist/analytics.js.map +1 -1
  8. package/dist/business/index.d.ts +0 -24
  9. package/dist/business/index.d.ts.map +1 -1
  10. package/dist/business.cjs +5 -273
  11. package/dist/business.cjs.map +1 -1
  12. package/dist/business.js +1 -272
  13. package/dist/business.js.map +1 -1
  14. package/dist/campaign/api/campaign-api.d.ts +3 -3
  15. package/dist/campaign/api/campaign-api.d.ts.map +1 -1
  16. package/dist/campaign/index.d.ts +0 -34
  17. package/dist/campaign/index.d.ts.map +1 -1
  18. package/dist/campaign.cjs +5 -447
  19. package/dist/campaign.cjs.map +1 -1
  20. package/dist/campaign.js +1 -446
  21. package/dist/campaign.js.map +1 -1
  22. package/dist/chunks/analytics-service-CitlimKJ.cjs +49 -0
  23. package/dist/chunks/analytics-service-CitlimKJ.cjs.map +1 -0
  24. package/dist/chunks/analytics-service-CxyrOwel.js +46 -0
  25. package/dist/chunks/analytics-service-CxyrOwel.js.map +1 -0
  26. package/dist/chunks/{token-sdk-BW4kkJb3.js → base-token-service-BSXDwrcq.js} +138 -204
  27. package/dist/chunks/base-token-service-BSXDwrcq.js.map +1 -0
  28. package/dist/chunks/{token-sdk-CiAbOb6c.cjs → base-token-service-CYuqPPs0.cjs} +140 -207
  29. package/dist/chunks/base-token-service-CYuqPPs0.cjs.map +1 -0
  30. package/dist/chunks/business-service-Cq3-oksM.cjs +241 -0
  31. package/dist/chunks/business-service-Cq3-oksM.cjs.map +1 -0
  32. package/dist/chunks/business-service-DrC-TNGa.js +238 -0
  33. package/dist/chunks/business-service-DrC-TNGa.js.map +1 -0
  34. package/dist/chunks/campaign-service-CWK9I388.cjs +403 -0
  35. package/dist/chunks/campaign-service-CWK9I388.cjs.map +1 -0
  36. package/dist/chunks/campaign-service-Dd7gMjC9.js +400 -0
  37. package/dist/chunks/campaign-service-Dd7gMjC9.js.map +1 -0
  38. package/dist/chunks/donation-service-CyJS4DIZ.js +47 -0
  39. package/dist/chunks/donation-service-CyJS4DIZ.js.map +1 -0
  40. package/dist/chunks/donation-service-D-xFrONi.cjs +50 -0
  41. package/dist/chunks/donation-service-D-xFrONi.cjs.map +1 -0
  42. package/dist/chunks/{index-CJ9Jfa4A.js → explorer.utils-Ckll15ja.js} +108 -172
  43. package/dist/chunks/explorer.utils-Ckll15ja.js.map +1 -0
  44. package/dist/chunks/{index-CzEluQmf.cjs → explorer.utils-GpskbLl1.cjs} +106 -174
  45. package/dist/chunks/explorer.utils-GpskbLl1.cjs.map +1 -0
  46. package/dist/chunks/index-BtDNXaFq.js +13 -0
  47. package/dist/chunks/index-BtDNXaFq.js.map +1 -0
  48. package/dist/chunks/index-CMk3Aqkk.cjs +15 -0
  49. package/dist/chunks/index-CMk3Aqkk.cjs.map +1 -0
  50. package/dist/chunks/payment-service-B4qx0qiE.cjs +220 -0
  51. package/dist/chunks/payment-service-B4qx0qiE.cjs.map +1 -0
  52. package/dist/chunks/payment-service-DfCBFosx.js +217 -0
  53. package/dist/chunks/payment-service-DfCBFosx.js.map +1 -0
  54. package/dist/chunks/pers-sdk-CajYwGkL.cjs +5850 -0
  55. package/dist/chunks/pers-sdk-CajYwGkL.cjs.map +1 -0
  56. package/dist/chunks/pers-sdk-eO4XUi8w.js +5817 -0
  57. package/dist/chunks/pers-sdk-eO4XUi8w.js.map +1 -0
  58. package/dist/chunks/redemption-service-7qbeQxEM.cjs +330 -0
  59. package/dist/chunks/redemption-service-7qbeQxEM.cjs.map +1 -0
  60. package/dist/chunks/redemption-service-BT0J5Iy7.js +327 -0
  61. package/dist/chunks/redemption-service-BT0J5Iy7.js.map +1 -0
  62. package/dist/chunks/tenant-service-Ba7xrWED.cjs +171 -0
  63. package/dist/chunks/tenant-service-Ba7xrWED.cjs.map +1 -0
  64. package/dist/chunks/tenant-service-DELk412y.js +168 -0
  65. package/dist/chunks/tenant-service-DELk412y.js.map +1 -0
  66. package/dist/chunks/token-service-BWScn8Qa.cjs +208 -0
  67. package/dist/chunks/token-service-BWScn8Qa.cjs.map +1 -0
  68. package/dist/chunks/token-service-CpVwC5Eb.js +205 -0
  69. package/dist/chunks/token-service-CpVwC5Eb.js.map +1 -0
  70. package/dist/chunks/user-service-D1Rn4U8u.cjs +153 -0
  71. package/dist/chunks/user-service-D1Rn4U8u.cjs.map +1 -0
  72. package/dist/chunks/user-service-D6mTa_WZ.js +150 -0
  73. package/dist/chunks/user-service-D6mTa_WZ.js.map +1 -0
  74. package/dist/chunks/{index-BfOoX87y.cjs → web3-chain-service-BYkj61DN.cjs} +1 -33
  75. package/dist/chunks/web3-chain-service-BYkj61DN.cjs.map +1 -0
  76. package/dist/chunks/{index-CM21r58m.js → web3-chain-service-DN6tJmvK.js} +2 -31
  77. package/dist/chunks/web3-chain-service-DN6tJmvK.js.map +1 -0
  78. package/dist/core/auth/auth-provider.interface.d.ts +32 -69
  79. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -1
  80. package/dist/core/auth/default-auth-provider.d.ts +15 -58
  81. package/dist/core/auth/default-auth-provider.d.ts.map +1 -1
  82. package/dist/core/auth/index.d.ts +10 -12
  83. package/dist/core/auth/index.d.ts.map +1 -1
  84. package/dist/core/auth/refresh-manager.d.ts +18 -0
  85. package/dist/core/auth/refresh-manager.d.ts.map +1 -0
  86. package/dist/core/auth/services/auth-service.d.ts +11 -6
  87. package/dist/core/auth/services/auth-service.d.ts.map +1 -1
  88. package/dist/core/auth/token-storage.d.ts +27 -47
  89. package/dist/core/auth/token-storage.d.ts.map +1 -1
  90. package/dist/core/errors/index.d.ts +1 -5
  91. package/dist/core/errors/index.d.ts.map +1 -1
  92. package/dist/core/index.d.ts +4 -1
  93. package/dist/core/index.d.ts.map +1 -1
  94. package/dist/core/pers-api-client.d.ts +10 -126
  95. package/dist/core/pers-api-client.d.ts.map +1 -1
  96. package/dist/core/pers-config.d.ts +8 -3
  97. package/dist/core/pers-config.d.ts.map +1 -1
  98. package/dist/core/utils/jwt.function.d.ts.map +1 -1
  99. package/dist/core.cjs +22 -17
  100. package/dist/core.cjs.map +1 -1
  101. package/dist/core.js +13 -13
  102. package/dist/donation/index.d.ts +0 -15
  103. package/dist/donation/index.d.ts.map +1 -1
  104. package/dist/donation.cjs +5 -75
  105. package/dist/donation.cjs.map +1 -1
  106. package/dist/donation.js +1 -74
  107. package/dist/donation.js.map +1 -1
  108. package/dist/index.cjs +51 -56
  109. package/dist/index.cjs.map +1 -1
  110. package/dist/index.js +16 -15
  111. package/dist/index.js.map +1 -1
  112. package/dist/managers/analytics-manager.d.ts +290 -10
  113. package/dist/managers/analytics-manager.d.ts.map +1 -1
  114. package/dist/managers/auth-manager.d.ts +123 -23
  115. package/dist/managers/auth-manager.d.ts.map +1 -1
  116. package/dist/managers/business-manager.d.ts +273 -18
  117. package/dist/managers/business-manager.d.ts.map +1 -1
  118. package/dist/managers/campaign-manager.d.ts +585 -46
  119. package/dist/managers/campaign-manager.d.ts.map +1 -1
  120. package/dist/managers/donation-manager.d.ts +5 -5
  121. package/dist/managers/donation-manager.d.ts.map +1 -1
  122. package/dist/managers/file-manager.d.ts +430 -13
  123. package/dist/managers/file-manager.d.ts.map +1 -1
  124. package/dist/managers/purchase-manager.d.ts +340 -15
  125. package/dist/managers/purchase-manager.d.ts.map +1 -1
  126. package/dist/managers/redemption-manager.d.ts +450 -27
  127. package/dist/managers/redemption-manager.d.ts.map +1 -1
  128. package/dist/managers/tenant-manager.d.ts +5 -5
  129. package/dist/managers/tenant-manager.d.ts.map +1 -1
  130. package/dist/managers/token-manager.d.ts +245 -21
  131. package/dist/managers/token-manager.d.ts.map +1 -1
  132. package/dist/managers/transaction-manager.d.ts +447 -18
  133. package/dist/managers/transaction-manager.d.ts.map +1 -1
  134. package/dist/managers/user-manager.d.ts +216 -14
  135. package/dist/managers/user-manager.d.ts.map +1 -1
  136. package/dist/managers/web3-manager.d.ts +4 -4
  137. package/dist/managers/web3-manager.d.ts.map +1 -1
  138. package/dist/package.json +9 -2
  139. package/dist/payment/index.d.ts +0 -21
  140. package/dist/payment/index.d.ts.map +1 -1
  141. package/dist/payment.cjs +5 -255
  142. package/dist/payment.cjs.map +1 -1
  143. package/dist/payment.js +1 -254
  144. package/dist/payment.js.map +1 -1
  145. package/dist/pers-sdk.d.ts +141 -34
  146. package/dist/pers-sdk.d.ts.map +1 -1
  147. package/dist/redemption/index.d.ts +0 -25
  148. package/dist/redemption/index.d.ts.map +1 -1
  149. package/dist/redemption.cjs +5 -365
  150. package/dist/redemption.cjs.map +1 -1
  151. package/dist/redemption.js +1 -364
  152. package/dist/redemption.js.map +1 -1
  153. package/dist/tenant/index.d.ts +0 -22
  154. package/dist/tenant/index.d.ts.map +1 -1
  155. package/dist/tenant.cjs +5 -203
  156. package/dist/tenant.cjs.map +1 -1
  157. package/dist/tenant.js +1 -202
  158. package/dist/tenant.js.map +1 -1
  159. package/dist/token.cjs +6 -6
  160. package/dist/token.js +2 -2
  161. package/dist/transaction/index.d.ts +0 -22
  162. package/dist/transaction/index.d.ts.map +1 -1
  163. package/dist/transaction.cjs +0 -40
  164. package/dist/transaction.cjs.map +1 -1
  165. package/dist/transaction.js +1 -40
  166. package/dist/transaction.js.map +1 -1
  167. package/dist/user/index.d.ts +0 -25
  168. package/dist/user/index.d.ts.map +1 -1
  169. package/dist/user.cjs +5 -185
  170. package/dist/user.cjs.map +1 -1
  171. package/dist/user.js +1 -184
  172. package/dist/user.js.map +1 -1
  173. package/dist/web3/index.d.ts +0 -11
  174. package/dist/web3/index.d.ts.map +1 -1
  175. package/dist/web3-chain/index.d.ts +0 -9
  176. package/dist/web3-chain/index.d.ts.map +1 -1
  177. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -1
  178. package/dist/web3-chain.cjs +5 -5
  179. package/dist/web3-chain.js +2 -1
  180. package/dist/web3-chain.js.map +1 -1
  181. package/dist/web3.cjs +6 -10
  182. package/dist/web3.cjs.map +1 -1
  183. package/dist/web3.js +1 -4
  184. package/dist/web3.js.map +1 -1
  185. package/package.json +9 -2
  186. package/dist/chunks/base-token-service-D0KANDgM.js +0 -139
  187. package/dist/chunks/base-token-service-D0KANDgM.js.map +0 -1
  188. package/dist/chunks/base-token-service-zNfPjHRx.cjs +0 -141
  189. package/dist/chunks/base-token-service-zNfPjHRx.cjs.map +0 -1
  190. package/dist/chunks/index-BfOoX87y.cjs.map +0 -1
  191. package/dist/chunks/index-CJ9Jfa4A.js.map +0 -1
  192. package/dist/chunks/index-CM21r58m.js.map +0 -1
  193. package/dist/chunks/index-CzEluQmf.cjs.map +0 -1
  194. package/dist/chunks/pers-sdk-DbPwFKrf.cjs +0 -3378
  195. package/dist/chunks/pers-sdk-DbPwFKrf.cjs.map +0 -1
  196. package/dist/chunks/pers-sdk-Z6MKeFBX.js +0 -3353
  197. package/dist/chunks/pers-sdk-Z6MKeFBX.js.map +0 -1
  198. package/dist/chunks/token-sdk-BW4kkJb3.js.map +0 -1
  199. package/dist/chunks/token-sdk-CiAbOb6c.cjs.map +0 -1
  200. package/dist/core/auth/auth-constants.d.ts +0 -33
  201. package/dist/core/auth/auth-constants.d.ts.map +0 -1
  202. package/dist/core/auth/auth-errors.d.ts +0 -8
  203. package/dist/core/auth/auth-errors.d.ts.map +0 -1
  204. package/dist/core/auth/create-auth-provider.d.ts +0 -27
  205. package/dist/core/auth/create-auth-provider.d.ts.map +0 -1
  206. package/dist/core/auth/token-refresh.d.ts +0 -91
  207. package/dist/core/auth/token-refresh.d.ts.map +0 -1
@@ -1,62 +1,491 @@
1
1
  import { PersApiClient } from '../core/pers-api-client';
2
- import { TransactionSDK } from '../transaction';
2
+ import { TransactionService } from '../transaction';
3
3
  import type { TransactionDTO, TransactionRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
4
4
  import type { TransactionPaginationParams } from '../transaction/models';
5
5
  /**
6
6
  * Transaction Manager - Clean, high-level interface for transaction operations
7
7
  *
8
- * Provides a simplified API for common transaction management tasks while maintaining
9
- * access to the full transaction SDK for advanced use cases.
8
+ * Provides a comprehensive API for loyalty transaction management including transaction
9
+ * creation, history tracking, reporting, and administrative oversight. Transactions
10
+ * are the core financial operations that track token movements, purchases, rewards,
11
+ * and all value exchanges within the loyalty ecosystem.
12
+ *
13
+ * @group Managers
14
+ * @category Transaction Management
15
+ *
16
+ * @example Basic Transaction Operations
17
+ * ```typescript
18
+ * // Create a purchase transaction
19
+ * const transaction = await sdk.transactions.createTransaction({
20
+ * type: 'PURCHASE',
21
+ * amount: 100.00,
22
+ * currency: 'USD',
23
+ * businessId: 'partner-store-123',
24
+ * description: 'Coffee shop purchase'
25
+ * });
26
+ *
27
+ * // Get transaction details
28
+ * const details = await sdk.transactions.getTransactionById(transaction.id);
29
+ * console.log('Transaction:', details.description, details.status);
30
+ *
31
+ * // View transaction history
32
+ * const history = await sdk.transactions.getUserTransactionHistory('ALL');
33
+ * console.log(`Found ${history.length} transactions`);
34
+ * ```
35
+ *
36
+ * @example Transaction History Analysis
37
+ * ```typescript
38
+ * // Get different types of transactions
39
+ * const purchases = await sdk.transactions.getUserTransactionHistory('PURCHASE');
40
+ * const rewards = await sdk.transactions.getUserTransactionHistory('REWARD');
41
+ * const redemptions = await sdk.transactions.getUserTransactionHistory('REDEMPTION');
42
+ *
43
+ * console.log('Transaction Summary:');
44
+ * console.log(`Purchases: ${purchases.length}`);
45
+ * console.log(`Rewards: ${rewards.length}`);
46
+ * console.log(`Redemptions: ${redemptions.length}`);
47
+ * ```
48
+ *
49
+ * @example Administrative Reporting
50
+ * ```typescript
51
+ * // Admin: Get all tenant transactions for analysis
52
+ * const allTransactions = await sdk.transactions.getTenantTransactions();
53
+ *
54
+ * // Export transaction data
55
+ * const csvBlob = await sdk.transactions.exportTransactionsCSV();
56
+ * const downloadUrl = URL.createObjectURL(csvBlob);
57
+ * console.log('Download transaction report:', downloadUrl);
58
+ * ```
10
59
  */
11
60
  export declare class TransactionManager {
12
61
  private apiClient;
13
- private transactionSDK;
62
+ private transactionService;
14
63
  constructor(apiClient: PersApiClient);
15
64
  /**
16
65
  * Get transaction by ID
17
66
  *
18
- * @param transactionId - ID of the transaction
19
- * @returns Promise resolving to transaction data
67
+ * Retrieves detailed information for a specific transaction including status,
68
+ * amounts, participants, token transfers, and blockchain confirmations.
69
+ * Provides complete transaction audit trail and verification data.
70
+ *
71
+ * @param transactionId - Unique transaction identifier
72
+ * @returns Promise resolving to complete transaction data
73
+ * @throws {PersApiError} When transaction with specified ID is not found or access denied
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * try {
78
+ * const transaction = await sdk.transactions.getTransactionById('txn-abc123');
79
+ *
80
+ * console.log('📋 Transaction Details:');
81
+ * console.log('ID:', transaction.id);
82
+ * console.log('Type:', transaction.type);
83
+ * console.log('Status:', transaction.status);
84
+ * console.log('Amount:', transaction.amount, transaction.currency);
85
+ * console.log('Date:', new Date(transaction.createdAt).toLocaleString());
86
+ *
87
+ * if (transaction.description) {
88
+ * console.log('Description:', transaction.description);
89
+ * }
90
+ *
91
+ * if (transaction.business) {
92
+ * console.log('Business:', transaction.business.displayName);
93
+ * }
94
+ *
95
+ * // Show token movements
96
+ * if (transaction.tokenTransfers?.length) {
97
+ * console.log('\n💰 Token Transfers:');
98
+ * transaction.tokenTransfers.forEach(transfer => {
99
+ * console.log(`${transfer.amount} ${transfer.token.symbol} ${transfer.direction}`);
100
+ * });
101
+ * }
102
+ *
103
+ * // Show blockchain confirmation
104
+ * if (transaction.blockchainHash) {
105
+ * console.log('🔗 Blockchain:', transaction.blockchainHash);
106
+ * }
107
+ *
108
+ * } catch (error) {
109
+ * console.log('Transaction not found or access denied:', error.message);
110
+ * }
111
+ * ```
20
112
  */
21
113
  getTransactionById(transactionId: string): Promise<TransactionDTO>;
22
114
  /**
23
115
  * Create a new transaction
24
116
  *
25
- * @param transactionData - Transaction data
26
- * @returns Promise resolving to transaction response
117
+ * Creates a new transaction in the loyalty system, processing token transfers,
118
+ * applying rewards, and updating user balances. Supports various transaction
119
+ * types including purchases, rewards, redemptions, and transfers.
120
+ *
121
+ * @param transactionData - Transaction configuration including type, amounts, and context
122
+ * @returns Promise resolving to transaction creation response
123
+ * @throws {PersApiError} When validation fails or insufficient balance
124
+ *
125
+ * @example Purchase Transaction
126
+ * ```typescript
127
+ * try {
128
+ * const purchase = await sdk.transactions.createTransaction({
129
+ * type: 'PURCHASE',
130
+ * amount: 25.50,
131
+ * currency: 'USD',
132
+ * businessId: 'coffee-shop-123',
133
+ * description: 'Morning coffee and pastry',
134
+ * metadata: {
135
+ * items: ['Latte', 'Croissant'],
136
+ * location: 'Downtown Store'
137
+ * }
138
+ * });
139
+ *
140
+ * console.log('✅ Purchase completed!');
141
+ * console.log('Transaction ID:', purchase.id);
142
+ * console.log('Status:', purchase.status);
143
+ *
144
+ * if (purchase.tokensEarned?.length) {
145
+ * console.log('\n🎁 Loyalty rewards earned:');
146
+ * purchase.tokensEarned.forEach(reward => {
147
+ * console.log(`${reward.amount} ${reward.token.symbol}`);
148
+ * });
149
+ * }
150
+ *
151
+ * } catch (error) {
152
+ * console.log('Transaction failed:', error.message);
153
+ * }
154
+ * ```
155
+ *
156
+ * @example Reward Transaction
157
+ * ```typescript
158
+ * // Create reward transaction (typically triggered by campaigns)
159
+ * const reward = await sdk.transactions.createTransaction({
160
+ * type: 'REWARD',
161
+ * businessId: 'partner-hotel-456',
162
+ * description: 'Welcome bonus for new customer',
163
+ * tokenRewards: [
164
+ * {
165
+ * tokenId: 'loyalty-points',
166
+ * amount: 500
167
+ * }
168
+ * ]
169
+ * });
170
+ *
171
+ * console.log('Reward transaction created:', reward.id);
172
+ * ```
173
+ *
174
+ * @example Transfer Transaction
175
+ * ```typescript
176
+ * // Create token transfer between users
177
+ * const transfer = await sdk.transactions.createTransaction({
178
+ * type: 'TRANSFER',
179
+ * recipientUserId: 'user-789',
180
+ * description: 'Gift to friend',
181
+ * tokenTransfers: [
182
+ * {
183
+ * tokenId: 'loyalty-points',
184
+ * amount: 100,
185
+ * direction: 'OUTBOUND'
186
+ * }
187
+ * ]
188
+ * });
189
+ *
190
+ * console.log('Transfer initiated:', transfer.id);
191
+ * ```
27
192
  */
28
- createTransaction(transactionData: TransactionRequestDTO): Promise<import("@explorins/pers-shared").TransactionRequestResponseDTO>;
193
+ createTransaction(transactionData: TransactionRequestDTO): Promise<import("node_modules/@explorins/pers-shared/dist/cjs/shared-lib/dto/transaction/transaction.request.dto").TransactionRequestResponseDTO>;
29
194
  /**
30
195
  * Get user's transaction history
31
196
  *
32
- * @param type - Transaction type filter
197
+ * Retrieves transaction history for the authenticated user, filtered by
198
+ * transaction type. Provides chronological view of all user's loyalty
199
+ * activities including purchases, rewards, redemptions, and transfers.
200
+ *
201
+ * @param type - Transaction type filter ('ALL', 'PURCHASE', 'REWARD', 'REDEMPTION', 'TRANSFER', etc.)
33
202
  * @returns Promise resolving to array of user's transactions
203
+ *
204
+ * @example All Transactions
205
+ * ```typescript
206
+ * const allTransactions = await sdk.transactions.getUserTransactionHistory('ALL');
207
+ *
208
+ * console.log(`📜 Transaction History (${allTransactions.length} transactions):`);
209
+ *
210
+ * allTransactions.forEach((transaction, index) => {
211
+ * const date = new Date(transaction.createdAt).toLocaleDateString();
212
+ * console.log(`\n${index + 1}. ${transaction.type} - ${date}`);
213
+ * console.log(` ${transaction.description || 'No description'}`);
214
+ * console.log(` Status: ${transaction.status}`);
215
+ *
216
+ * if (transaction.amount && transaction.currency) {
217
+ * console.log(` Amount: ${transaction.amount} ${transaction.currency}`);
218
+ * }
219
+ *
220
+ * if (transaction.business) {
221
+ * console.log(` Business: ${transaction.business.displayName}`);
222
+ * }
223
+ * });
224
+ * ```
225
+ *
226
+ * @example Filtered by Type
227
+ * ```typescript
228
+ * // Get only purchase transactions
229
+ * const purchases = await sdk.transactions.getUserTransactionHistory('PURCHASE');
230
+ *
231
+ * let totalSpent = 0;
232
+ * let totalRewards = 0;
233
+ *
234
+ * purchases.forEach(purchase => {
235
+ * if (purchase.amount) {
236
+ * totalSpent += purchase.amount;
237
+ * }
238
+ *
239
+ * if (purchase.tokensEarned?.length) {
240
+ * purchase.tokensEarned.forEach(reward => {
241
+ * totalRewards += reward.amount;
242
+ * });
243
+ * }
244
+ * });
245
+ *
246
+ * console.log('💳 Purchase Summary:');
247
+ * console.log(`Total purchases: ${purchases.length}`);
248
+ * console.log(`Total spent: $${totalSpent.toFixed(2)}`);
249
+ * console.log(`Total rewards earned: ${totalRewards} points`);
250
+ * ```
251
+ *
252
+ * @example Recent Activity
253
+ * ```typescript
254
+ * const recentTransactions = await sdk.transactions.getUserTransactionHistory('ALL');
255
+ *
256
+ * // Filter to last 30 days
257
+ * const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
258
+ * const recentActivity = recentTransactions.filter(t =>
259
+ * new Date(t.createdAt) > thirtyDaysAgo
260
+ * );
261
+ *
262
+ * console.log(`📅 Recent Activity (${recentActivity.length} transactions in last 30 days):`);
263
+ *
264
+ * // Group by type
265
+ * const activityByType = recentActivity.reduce((acc, t) => {
266
+ * acc[t.type] = (acc[t.type] || 0) + 1;
267
+ * return acc;
268
+ * }, {});
269
+ *
270
+ * Object.entries(activityByType).forEach(([type, count]) => {
271
+ * console.log(`${type}: ${count} transactions`);
272
+ * });
273
+ * ```
34
274
  */
35
275
  getUserTransactionHistory(type: string): Promise<TransactionDTO[]>;
36
276
  /**
37
277
  * Admin: Get all tenant transactions
38
278
  *
39
- * @returns Promise resolving to array of tenant transactions
279
+ * Retrieves all transactions across the entire tenant/organization for
280
+ * comprehensive reporting and analysis. This operation requires administrator
281
+ * privileges and provides system-wide transaction visibility.
282
+ *
283
+ * @returns Promise resolving to array of all tenant transactions
284
+ * @throws {PersApiError} When not authenticated as administrator
285
+ *
286
+ * @example
287
+ * ```typescript
288
+ * // Admin operation - comprehensive transaction analysis
289
+ * const allTransactions = await sdk.transactions.getTenantTransactions();
290
+ *
291
+ * console.log(`📊 Tenant Transaction Overview:`);
292
+ * console.log(`Total transactions: ${allTransactions.length}`);
293
+ *
294
+ * // Analyze by status
295
+ * const statusCounts = allTransactions.reduce((acc, t) => {
296
+ * acc[t.status] = (acc[t.status] || 0) + 1;
297
+ * return acc;
298
+ * }, {});
299
+ *
300
+ * console.log('\n📈 By status:');
301
+ * Object.entries(statusCounts).forEach(([status, count]) => {
302
+ * console.log(`${status}: ${count} transactions`);
303
+ * });
304
+ *
305
+ * // Analyze by type
306
+ * const typeCounts = allTransactions.reduce((acc, t) => {
307
+ * acc[t.type] = (acc[t.type] || 0) + 1;
308
+ * return acc;
309
+ * }, {});
310
+ *
311
+ * console.log('\n🏷️ By type:');
312
+ * Object.entries(typeCounts).forEach(([type, count]) => {
313
+ * console.log(`${type}: ${count} transactions`);
314
+ * });
315
+ *
316
+ * // Calculate volume metrics
317
+ * const totalVolume = allTransactions.reduce((sum, t) =>
318
+ * sum + (t.amount || 0), 0
319
+ * );
320
+ *
321
+ * const avgTransactionSize = totalVolume / allTransactions.length;
322
+ *
323
+ * console.log('\n💰 Volume metrics:');
324
+ * console.log(`Total volume: $${totalVolume.toFixed(2)}`);
325
+ * console.log(`Average transaction: $${avgTransactionSize.toFixed(2)}`);
326
+ *
327
+ * // Recent activity analysis
328
+ * const last24Hours = allTransactions.filter(t =>
329
+ * new Date(t.createdAt) > new Date(Date.now() - 24 * 60 * 60 * 1000)
330
+ * );
331
+ *
332
+ * console.log(`\n⏰ Last 24 hours: ${last24Hours.length} transactions`);
333
+ * ```
40
334
  */
41
335
  getTenantTransactions(): Promise<TransactionDTO[]>;
42
336
  /**
43
337
  * Admin: Get paginated transactions
44
338
  *
45
- * @param params - Pagination parameters
46
- * @returns Promise resolving to paginated transaction results
339
+ * Retrieves transactions with pagination support for efficient large dataset
340
+ * handling. This operation requires administrator privileges and is used for
341
+ * detailed transaction analysis and reporting interfaces.
342
+ *
343
+ * @param params - Pagination and filtering parameters
344
+ * @returns Promise resolving to paginated transaction results with metadata
345
+ * @throws {PersApiError} When not authenticated as administrator
346
+ *
347
+ * @example Basic Pagination
348
+ * ```typescript
349
+ * // Admin operation - paginated transaction retrieval
350
+ * const result = await sdk.transactions.getPaginatedTransactions({
351
+ * page: 1,
352
+ * limit: 50,
353
+ * sortBy: 'createdAt',
354
+ * sortOrder: 'DESC'
355
+ * });
356
+ *
357
+ * console.log(`📄 Page ${result.page} of ${result.totalPages}`);
358
+ * console.log(`Showing ${result.data.length} of ${result.total} transactions`);
359
+ *
360
+ * result.data.forEach((transaction, index) => {
361
+ * console.log(`${index + 1}. ${transaction.type} - ${transaction.status}`);
362
+ * console.log(` ${new Date(transaction.createdAt).toLocaleDateString()}`);
363
+ * });
364
+ *
365
+ * // Continue pagination if needed
366
+ * if (result.hasNextPage) {
367
+ * const nextPage = await sdk.transactions.getPaginatedTransactions({
368
+ * page: result.page + 1,
369
+ * limit: 50
370
+ * });
371
+ * }
372
+ * ```
373
+ *
374
+ * @example Filtered Pagination
375
+ * ```typescript
376
+ * // Admin operation - filter transactions by criteria
377
+ * const filteredResult = await sdk.transactions.getPaginatedTransactions({
378
+ * page: 1,
379
+ * limit: 25,
380
+ * filters: {
381
+ * type: 'PURCHASE',
382
+ * status: 'COMPLETED',
383
+ * businessId: 'partner-store-123',
384
+ * dateFrom: '2024-01-01',
385
+ * dateTo: '2024-12-31'
386
+ * },
387
+ * sortBy: 'amount',
388
+ * sortOrder: 'DESC'
389
+ * });
390
+ *
391
+ * console.log('🔍 Filtered Results:');
392
+ * console.log(`Found ${filteredResult.total} matching transactions`);
393
+ *
394
+ * filteredResult.data.forEach(transaction => {
395
+ * console.log(`$${transaction.amount} - ${transaction.business?.displayName}`);
396
+ * });
397
+ * ```
47
398
  */
48
- getPaginatedTransactions(params: TransactionPaginationParams): Promise<import("..").TransactionPaginationResponse>;
399
+ getPaginatedTransactions(params: TransactionPaginationParams): Promise<import("../transaction").TransactionPaginationResponse>;
49
400
  /**
50
401
  * Admin: Export transactions as CSV
51
402
  *
52
- * @returns Promise resolving to CSV blob
403
+ * Generates a comprehensive CSV export of all tenant transactions for
404
+ * external analysis, reporting, or compliance purposes. This operation
405
+ * requires administrator privileges and creates a downloadable file.
406
+ *
407
+ * @returns Promise resolving to CSV blob for download
408
+ * @throws {PersApiError} When not authenticated as administrator or export fails
409
+ *
410
+ * @example
411
+ * ```typescript
412
+ * // Admin operation - export transaction data
413
+ * try {
414
+ * const csvBlob = await sdk.transactions.exportTransactionsCSV();
415
+ *
416
+ * // Create download link
417
+ * const downloadUrl = URL.createObjectURL(csvBlob);
418
+ * const link = document.createElement('a');
419
+ * link.href = downloadUrl;
420
+ * link.download = `transactions-${new Date().toISOString().split('T')[0]}.csv`;
421
+ *
422
+ * // Trigger download
423
+ * document.body.appendChild(link);
424
+ * link.click();
425
+ * document.body.removeChild(link);
426
+ *
427
+ * // Clean up object URL
428
+ * URL.revokeObjectURL(downloadUrl);
429
+ *
430
+ * console.log('✅ Transaction export downloaded successfully');
431
+ *
432
+ * } catch (error) {
433
+ * console.log('❌ Export failed:', error.message);
434
+ * }
435
+ * ```
436
+ *
437
+ * @example Server-side Export (Node.js)
438
+ * ```typescript
439
+ * // Admin operation - server-side CSV export
440
+ * const csvBlob = await sdk.transactions.exportTransactionsCSV();
441
+ *
442
+ * // Convert blob to buffer for Node.js
443
+ * const buffer = Buffer.from(await csvBlob.arrayBuffer());
444
+ *
445
+ * // Save to file system
446
+ * const fs = require('fs');
447
+ * const filename = `transactions-export-${Date.now()}.csv`;
448
+ * fs.writeFileSync(filename, buffer);
449
+ *
450
+ * console.log(`Transaction data exported to ${filename}`);
451
+ * ```
53
452
  */
54
453
  exportTransactionsCSV(): Promise<Blob>;
55
454
  /**
56
- * Get the full transaction SDK for advanced operations
455
+ * Get the full transaction service for advanced operations
456
+ *
457
+ * Provides access to the complete TransactionService instance for advanced
458
+ * transaction operations, custom analytics, blockchain interactions, and
459
+ * operations not covered by the high-level manager methods.
460
+ *
461
+ * @returns TransactionService instance with full API access
462
+ *
463
+ * @example Advanced Operations
464
+ * ```typescript
465
+ * const transactionService = sdk.transactions.getTransactionService();
466
+ *
467
+ * // Access advanced transaction analytics
468
+ * const analytics = await transactionService.getTransactionAnalytics({
469
+ * timeframe: 'last-30-days',
470
+ * groupBy: 'business'
471
+ * });
472
+ *
473
+ * // Access blockchain transaction monitoring
474
+ * const blockchainStatus = await transactionService.getBlockchainTransactionStatus('txn-123');
475
+ *
476
+ * // Access transaction API directly
477
+ * const transactionApi = transactionService.api;
478
+ *
479
+ * // Use advanced validation and verification
480
+ * const verification = await transactionService.verifyTransactionIntegrity('txn-456');
57
481
  *
58
- * @returns TransactionSDK instance
482
+ * // Access real-time transaction streaming
483
+ * const stream = transactionService.subscribeToTransactionUpdates();
484
+ * stream.on('transaction', (transaction) => {
485
+ * console.log('New transaction:', transaction.id);
486
+ * });
487
+ * ```
59
488
  */
60
- getTransactionSDK(): TransactionSDK;
489
+ getTransactionService(): TransactionService;
61
490
  }
62
491
  //# sourceMappingURL=transaction-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transaction-manager.d.ts","sourceRoot":"","sources":["../../src/managers/transaction-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAwB,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE;;;;;GAKG;AACH,qBAAa,kBAAkB;IAGjB,OAAO,CAAC,SAAS;IAF7B,OAAO,CAAC,cAAc,CAAiB;gBAEnB,SAAS,EAAE,aAAa;IAI5C;;;;;OAKG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxE;;;;;OAKG;IACG,iBAAiB,CAAC,eAAe,EAAE,qBAAqB;IAI9D;;;;;OAKG;IACG,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxE;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxD;;;;;OAKG;IACG,wBAAwB,CAAC,MAAM,EAAE,2BAA2B;IAIlE;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;OAIG;IACH,iBAAiB,IAAI,cAAc;CAGpC"}
1
+ {"version":3,"file":"transaction-manager.d.ts","sourceRoot":"","sources":["../../src/managers/transaction-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAkB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,qBAAa,kBAAkB;IAGjB,OAAO,CAAC,SAAS;IAF7B,OAAO,CAAC,kBAAkB,CAAqB;gBAE3B,SAAS,EAAE,aAAa;IAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACG,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAIxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8EG;IACG,iBAAiB,CAAC,eAAe,EAAE,qBAAqB;IAI9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgFG;IACG,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0DG;IACG,qBAAqB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8DG;IACG,wBAAwB,CAAC,MAAM,EAAE,2BAA2B;IAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACG,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,qBAAqB,IAAI,kBAAkB;CAG5C"}