@explorins/pers-sdk 1.1.2 → 1.2.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 (276) hide show
  1. package/dist/analytics/api/analytics-api.d.ts +17 -0
  2. package/dist/analytics/api/analytics-api.d.ts.map +1 -0
  3. package/{src/analytics/index.ts → dist/analytics/index.d.ts} +28 -52
  4. package/dist/analytics/index.d.ts.map +1 -0
  5. package/dist/analytics/models/index.d.ts +61 -0
  6. package/dist/analytics/models/index.d.ts.map +1 -0
  7. package/dist/analytics/services/analytics-service.d.ts +19 -0
  8. package/dist/analytics/services/analytics-service.d.ts.map +1 -0
  9. package/dist/analytics.cjs +76 -0
  10. package/dist/analytics.cjs.map +1 -0
  11. package/dist/analytics.js +72 -0
  12. package/dist/analytics.js.map +1 -0
  13. package/dist/auth-admin/api/auth-admin-api.d.ts +27 -0
  14. package/dist/auth-admin/api/auth-admin-api.d.ts.map +1 -0
  15. package/dist/auth-admin/index.d.ts +26 -0
  16. package/dist/auth-admin/index.d.ts.map +1 -0
  17. package/dist/auth-admin/services/auth-admin-service.d.ts +23 -0
  18. package/dist/auth-admin/services/auth-admin-service.d.ts.map +1 -0
  19. package/dist/auth-admin.cjs +96 -0
  20. package/dist/auth-admin.cjs.map +1 -0
  21. package/dist/auth-admin.js +92 -0
  22. package/dist/auth-admin.js.map +1 -0
  23. package/dist/business/api/business-api.d.ts +133 -0
  24. package/dist/business/api/business-api.d.ts.map +1 -0
  25. package/dist/business/index.d.ts +34 -0
  26. package/dist/business/index.d.ts.map +1 -0
  27. package/dist/business/models/index.d.ts +8 -0
  28. package/dist/business/models/index.d.ts.map +1 -0
  29. package/dist/business/services/business-service.d.ts +51 -0
  30. package/dist/business/services/business-service.d.ts.map +1 -0
  31. package/dist/business.cjs +303 -0
  32. package/dist/business.cjs.map +1 -0
  33. package/dist/business.js +299 -0
  34. package/dist/business.js.map +1 -0
  35. package/dist/campaign/api/campaign-api.d.ts +213 -0
  36. package/dist/campaign/api/campaign-api.d.ts.map +1 -0
  37. package/dist/campaign/index.d.ts +44 -0
  38. package/dist/campaign/index.d.ts.map +1 -0
  39. package/dist/campaign/services/campaign-service.d.ts +88 -0
  40. package/dist/campaign/services/campaign-service.d.ts.map +1 -0
  41. package/dist/campaign.cjs +506 -0
  42. package/dist/campaign.cjs.map +1 -0
  43. package/dist/campaign.js +502 -0
  44. package/dist/campaign.js.map +1 -0
  45. package/dist/core/abstractions/http-client.d.ts +22 -0
  46. package/dist/core/abstractions/http-client.d.ts.map +1 -0
  47. package/dist/core/auth/auth-provider.interface.d.ts +12 -0
  48. package/dist/core/auth/auth-provider.interface.d.ts.map +1 -0
  49. package/dist/core/auth/create-auth-provider.d.ts +27 -0
  50. package/dist/core/auth/create-auth-provider.d.ts.map +1 -0
  51. package/dist/core/auth/simple-auth-config.interface.d.ts +15 -0
  52. package/dist/core/auth/simple-auth-config.interface.d.ts.map +1 -0
  53. package/dist/core/index.d.ts +13 -0
  54. package/dist/core/index.d.ts.map +1 -0
  55. package/dist/core/pers-api-client.d.ts +54 -0
  56. package/dist/core/pers-api-client.d.ts.map +1 -0
  57. package/dist/core/pers-config.d.ts +38 -0
  58. package/dist/core/pers-config.d.ts.map +1 -0
  59. package/dist/core/utils/jwt.function.d.ts +2 -0
  60. package/dist/core/utils/jwt.function.d.ts.map +1 -0
  61. package/dist/core.cjs +506 -0
  62. package/dist/core.cjs.map +1 -0
  63. package/dist/core.js +497 -0
  64. package/dist/core.js.map +1 -0
  65. package/dist/donation/api/donation-api.d.ts +18 -0
  66. package/dist/donation/api/donation-api.d.ts.map +1 -0
  67. package/dist/donation/index.d.ts +25 -0
  68. package/dist/donation/index.d.ts.map +1 -0
  69. package/{src/donation/models/index.ts → dist/donation/models/index.d.ts} +8 -11
  70. package/dist/donation/models/index.d.ts.map +1 -0
  71. package/dist/donation/services/donation-service.d.ts +19 -0
  72. package/dist/donation/services/donation-service.d.ts.map +1 -0
  73. package/dist/donation.cjs +78 -0
  74. package/dist/donation.cjs.map +1 -0
  75. package/dist/donation.js +74 -0
  76. package/dist/donation.js.map +1 -0
  77. package/dist/index.cjs +4217 -0
  78. package/dist/index.cjs.map +1 -0
  79. package/dist/index.d.ts +21 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +4164 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/package.json +129 -0
  84. package/dist/payment/api/payment-api.d.ts +105 -0
  85. package/dist/payment/api/payment-api.d.ts.map +1 -0
  86. package/dist/payment/index.d.ts +36 -0
  87. package/dist/payment/index.d.ts.map +1 -0
  88. package/dist/payment/models/index.d.ts +12 -0
  89. package/dist/payment/models/index.d.ts.map +1 -0
  90. package/dist/payment/services/payment-service.d.ts +40 -0
  91. package/dist/payment/services/payment-service.d.ts.map +1 -0
  92. package/dist/payment.cjs +258 -0
  93. package/dist/payment.cjs.map +1 -0
  94. package/dist/payment.js +254 -0
  95. package/dist/payment.js.map +1 -0
  96. package/dist/pers-sdk.d.ts +29 -0
  97. package/dist/pers-sdk.d.ts.map +1 -0
  98. package/dist/redemption/api/redemption-api.d.ts +147 -0
  99. package/dist/redemption/api/redemption-api.d.ts.map +1 -0
  100. package/dist/redemption/index.d.ts +35 -0
  101. package/dist/redemption/index.d.ts.map +1 -0
  102. package/dist/redemption/models/index.d.ts +8 -0
  103. package/dist/redemption/models/index.d.ts.map +1 -0
  104. package/dist/redemption/services/redemption-service.d.ts +56 -0
  105. package/dist/redemption/services/redemption-service.d.ts.map +1 -0
  106. package/dist/redemption.cjs +333 -0
  107. package/dist/redemption.cjs.map +1 -0
  108. package/dist/redemption.js +329 -0
  109. package/dist/redemption.js.map +1 -0
  110. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +18 -0
  111. package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -0
  112. package/dist/tenant/api/tenant-api.d.ts +56 -0
  113. package/dist/tenant/api/tenant-api.d.ts.map +1 -0
  114. package/dist/tenant/index.d.ts +34 -0
  115. package/dist/tenant/index.d.ts.map +1 -0
  116. package/dist/tenant/models/index.d.ts +11 -0
  117. package/dist/tenant/models/index.d.ts.map +1 -0
  118. package/dist/tenant/services/tenant-service.d.ts +46 -0
  119. package/dist/tenant/services/tenant-service.d.ts.map +1 -0
  120. package/dist/tenant.cjs +177 -0
  121. package/dist/tenant.cjs.map +1 -0
  122. package/dist/tenant.js +173 -0
  123. package/dist/tenant.js.map +1 -0
  124. package/dist/token/api/token-api.d.ts +64 -0
  125. package/dist/token/api/token-api.d.ts.map +1 -0
  126. package/dist/token/base/base-token-service.d.ts +87 -0
  127. package/dist/token/base/base-token-service.d.ts.map +1 -0
  128. package/dist/token/index.d.ts +13 -0
  129. package/dist/token/index.d.ts.map +1 -0
  130. package/dist/token/models/index.d.ts +18 -0
  131. package/dist/token/models/index.d.ts.map +1 -0
  132. package/dist/token/services/token-service.d.ts +68 -0
  133. package/dist/token/services/token-service.d.ts.map +1 -0
  134. package/dist/token/token-sdk.d.ts +140 -0
  135. package/dist/token/token-sdk.d.ts.map +1 -0
  136. package/dist/token.cjs +537 -0
  137. package/dist/token.cjs.map +1 -0
  138. package/dist/token.js +532 -0
  139. package/dist/token.js.map +1 -0
  140. package/dist/transaction/api/transaction-api.d.ts +133 -0
  141. package/dist/transaction/api/transaction-api.d.ts.map +1 -0
  142. package/dist/transaction/index.d.ts +38 -0
  143. package/dist/transaction/index.d.ts.map +1 -0
  144. package/dist/transaction/models/index.d.ts +42 -0
  145. package/dist/transaction/models/index.d.ts.map +1 -0
  146. package/dist/transaction/services/transaction-service.d.ts +56 -0
  147. package/dist/transaction/services/transaction-service.d.ts.map +1 -0
  148. package/dist/transaction.cjs +394 -0
  149. package/dist/transaction.cjs.map +1 -0
  150. package/dist/transaction.js +390 -0
  151. package/dist/transaction.js.map +1 -0
  152. package/dist/user/api/user-api.d.ts +56 -0
  153. package/dist/user/api/user-api.d.ts.map +1 -0
  154. package/dist/user/index.d.ts +36 -0
  155. package/dist/user/index.d.ts.map +1 -0
  156. package/{src/user/models/index.ts → dist/user/models/index.d.ts} +12 -10
  157. package/dist/user/models/index.d.ts.map +1 -0
  158. package/dist/user/services/user-service.d.ts +46 -0
  159. package/dist/user/services/user-service.d.ts.map +1 -0
  160. package/dist/user-status/api/user-status-api.d.ts +37 -0
  161. package/dist/user-status/api/user-status-api.d.ts.map +1 -0
  162. package/dist/user-status/index.d.ts +28 -0
  163. package/dist/user-status/index.d.ts.map +1 -0
  164. package/{src/user-status/models/index.ts → dist/user-status/models/index.d.ts} +8 -11
  165. package/dist/user-status/models/index.d.ts.map +1 -0
  166. package/dist/user-status/services/user-status-service.d.ts +26 -0
  167. package/dist/user-status/services/user-status-service.d.ts.map +1 -0
  168. package/dist/user-status.cjs +147 -0
  169. package/dist/user-status.cjs.map +1 -0
  170. package/dist/user-status.js +143 -0
  171. package/dist/user-status.js.map +1 -0
  172. package/dist/user.cjs +188 -0
  173. package/dist/user.cjs.map +1 -0
  174. package/dist/user.js +184 -0
  175. package/dist/user.js.map +1 -0
  176. package/dist/web3/api/web3-api.d.ts +27 -0
  177. package/dist/web3/api/web3-api.d.ts.map +1 -0
  178. package/dist/web3/index.d.ts +16 -0
  179. package/dist/web3/index.d.ts.map +1 -0
  180. package/dist/web3/models/index.d.ts +92 -0
  181. package/dist/web3/models/index.d.ts.map +1 -0
  182. package/dist/web3/services/web3-service.d.ts +21 -0
  183. package/dist/web3/services/web3-service.d.ts.map +1 -0
  184. package/dist/web3-chain/api/web3-chain-api.d.ts +19 -0
  185. package/dist/web3-chain/api/web3-chain-api.d.ts.map +1 -0
  186. package/dist/web3-chain/index.d.ts +17 -0
  187. package/dist/web3-chain/index.d.ts.map +1 -0
  188. package/{src/web3-chain/models/index.ts → dist/web3-chain/models/index.d.ts} +38 -45
  189. package/dist/web3-chain/models/index.d.ts.map +1 -0
  190. package/dist/web3-chain/services/getWeb3FCD.service.d.ts +8 -0
  191. package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -0
  192. package/dist/web3-chain/services/provider.service.d.ts +15 -0
  193. package/dist/web3-chain/services/provider.service.d.ts.map +1 -0
  194. package/dist/web3-chain/services/public-http-provider.service.d.ts +8 -0
  195. package/dist/web3-chain/services/public-http-provider.service.d.ts.map +1 -0
  196. package/dist/web3-chain/services/web3-chain-service.d.ts +17 -0
  197. package/dist/web3-chain/services/web3-chain-service.d.ts.map +1 -0
  198. package/dist/web3-chain.cjs +316 -0
  199. package/dist/web3-chain.cjs.map +1 -0
  200. package/dist/web3-chain.js +310 -0
  201. package/dist/web3-chain.js.map +1 -0
  202. package/dist/web3.cjs +516 -0
  203. package/dist/web3.cjs.map +1 -0
  204. package/dist/web3.js +513 -0
  205. package/dist/web3.js.map +1 -0
  206. package/package.json +56 -72
  207. package/config/domains.js +0 -22
  208. package/explorins-pers-sdk-1.0.0-alpha.1.tgz +0 -0
  209. package/rollup.config.js +0 -74
  210. package/scripts/copy-declarations.js +0 -147
  211. package/src/analytics/api/analytics-api.ts +0 -24
  212. package/src/analytics/models/index.ts +0 -74
  213. package/src/analytics/services/analytics-service.ts +0 -28
  214. package/src/auth-admin/api/auth-admin-api.ts +0 -42
  215. package/src/auth-admin/index.ts +0 -47
  216. package/src/auth-admin/services/auth-admin-service.ts +0 -36
  217. package/src/business/api/business-api.ts +0 -234
  218. package/src/business/index.ts +0 -53
  219. package/src/business/models/index.ts +0 -13
  220. package/src/business/services/business-service.ts +0 -88
  221. package/src/campaign/api/campaign-api.ts +0 -376
  222. package/src/campaign/index.ts +0 -67
  223. package/src/campaign/services/campaign-service.ts +0 -164
  224. package/src/core/abstractions/http-client.ts +0 -24
  225. package/src/core/auth/auth-provider.interface.ts +0 -16
  226. package/src/core/auth/create-auth-provider.ts +0 -136
  227. package/src/core/auth/simple-auth-config.interface.ts +0 -15
  228. package/src/core/index.ts +0 -33
  229. package/src/core/pers-api-client.ts +0 -343
  230. package/src/core/pers-config.ts +0 -65
  231. package/src/core/utils/jwt.function.ts +0 -24
  232. package/src/donation/api/donation-api.ts +0 -24
  233. package/src/donation/index.ts +0 -47
  234. package/src/donation/services/donation-service.ts +0 -25
  235. package/src/index.ts +0 -55
  236. package/src/payment/api/payment-api.ts +0 -185
  237. package/src/payment/index.ts +0 -64
  238. package/src/payment/models/index.ts +0 -29
  239. package/src/payment/services/payment-service.ts +0 -70
  240. package/src/pers-sdk.ts +0 -45
  241. package/src/redemption/api/redemption-api.ts +0 -241
  242. package/src/redemption/index.ts +0 -60
  243. package/src/redemption/models/index.ts +0 -17
  244. package/src/redemption/services/redemption-service.ts +0 -103
  245. package/src/shared/interfaces/pers-shared-lib.interfaces.ts +0 -99
  246. package/src/tenant/api/tenant-api.ts +0 -92
  247. package/src/tenant/index.ts +0 -61
  248. package/src/tenant/models/index.ts +0 -20
  249. package/src/tenant/services/tenant-service.ts +0 -78
  250. package/src/token/api/token-api.ts +0 -129
  251. package/src/token/base/base-token-service.ts +0 -167
  252. package/src/token/index.ts +0 -38
  253. package/src/token/models/index.ts +0 -30
  254. package/src/token/services/token-service.ts +0 -125
  255. package/src/token/token-sdk.ts +0 -231
  256. package/src/transaction/api/transaction-api.ts +0 -296
  257. package/src/transaction/index.ts +0 -65
  258. package/src/transaction/models/index.ts +0 -60
  259. package/src/transaction/services/transaction-service.ts +0 -104
  260. package/src/user/api/user-api.ts +0 -98
  261. package/src/user/index.ts +0 -62
  262. package/src/user/services/user-service.ts +0 -75
  263. package/src/user-status/api/user-status-api.ts +0 -78
  264. package/src/user-status/index.ts +0 -55
  265. package/src/user-status/services/user-status-service.ts +0 -51
  266. package/src/web3/api/web3-api.ts +0 -68
  267. package/src/web3/index.ts +0 -38
  268. package/src/web3/models/index.ts +0 -150
  269. package/src/web3/services/web3-service.ts +0 -338
  270. package/src/web3-chain/api/web3-chain-api.ts +0 -42
  271. package/src/web3-chain/index.ts +0 -27
  272. package/src/web3-chain/services/getWeb3FCD.service.ts +0 -47
  273. package/src/web3-chain/services/provider.service.ts +0 -123
  274. package/src/web3-chain/services/public-http-provider.service.ts +0 -26
  275. package/src/web3-chain/services/web3-chain-service.ts +0 -131
  276. package/tsconfig.json +0 -28
@@ -1,241 +0,0 @@
1
- import { TokenUnitCreateRequestDTO, RedemptionTypeCreateRequestDTO } from '../../shared/interfaces/pers-shared-lib.interfaces';
2
- import { PersApiClient } from '../../core/pers-api-client';
3
- import {
4
- RedemptionDTO,
5
- RedemptionCreateRequestDTO,
6
- RedemptionRedeemRequestDTO,
7
- RedemptionTypeDTO,
8
- RedemptionUserRedeemDTO,
9
- RedemptionUserRedeemDetailedDTO
10
- } from '../../shared/interfaces/pers-shared-lib.interfaces';
11
-
12
- /**
13
- * Platform-Agnostic Redemption API Client (UPDATED - RESTful Design)
14
- *
15
- * Updated to work with the new RESTful /redemptions endpoints.
16
- * Handles redemption operations using the PERS backend with intelligent access detection.
17
- * Uses @explorins/pers-shared DTOs for consistency with backend.
18
- *
19
- * Migration Update: Updated all endpoints from /redemption to /redemptions
20
- * - Removed role revelation from URLs (no more /admin, /auth paths)
21
- * - Added intelligent access detection for unified endpoints
22
- * - Updated toggle endpoint to follow /status pattern
23
- * - Enhanced redemption process with path-based IDs
24
- */
25
- export class RedemptionApi {
26
- constructor(private apiClient: PersApiClient) {}
27
-
28
- private readonly basePath = '/redemptions';
29
-
30
- // ==========================================
31
- // PUBLIC OPERATIONS (Project Key)
32
- // ==========================================
33
-
34
- /**
35
- * PUBLIC: Get redemptions (intelligent access)
36
- *
37
- * NEW: Intelligent endpoint that adapts based on authentication
38
- * - Public users: Get active redemptions only
39
- * - Admin users: Get all redemptions with optional filtering
40
- *
41
- * Replaces: getActiveRedemptions() + getRedemptionsAsAdmin()
42
- */
43
- async getRedemptions(active?: boolean): Promise<RedemptionDTO[]> {
44
- let url = `${this.basePath}`;
45
- if (active !== undefined) {
46
- url += `?active=${active}`;
47
- }
48
- return this.apiClient.get<RedemptionDTO[]>(url);
49
- }
50
-
51
- /**
52
- * PUBLIC: Get active redemptions
53
- *
54
- * Updated: Now uses unified endpoint (backward compatibility)
55
- */
56
- async getActiveRedemptions(): Promise<RedemptionDTO[]> {
57
- return this.getRedemptions(); // Will return active only for public access
58
- }
59
-
60
- /**
61
- * PUBLIC: Get redemption types
62
- *
63
- * Updated: /redemption/type → /redemptions/types
64
- */
65
- async getRedemptionTypes(): Promise<RedemptionTypeDTO[]> {
66
- return this.apiClient.get<RedemptionTypeDTO[]>(`${this.basePath}/types`);
67
- }
68
-
69
- /**
70
- * PUBLIC: Get redemption by ID
71
- *
72
- * Updated: /redemption/:id → /redemptions/:id
73
- */
74
- async getRedemptionById(id: string): Promise<RedemptionDTO> {
75
- return this.apiClient.get<RedemptionDTO>(`${this.basePath}/${id}`);
76
- }
77
-
78
- /**
79
- * PUBLIC: Get available supply for redemption
80
- *
81
- * Updated: /redemption/:id/available-supply → /redemptions/:id/available-supply
82
- */
83
- async getRedemptionAvailableSupply(id: string): Promise<number> {
84
- return this.apiClient.get<number>(`${this.basePath}/${id}/available-supply`);
85
- }
86
-
87
- // ==========================================
88
- // USER OPERATIONS (JWT + Project Key)
89
- // ==========================================
90
-
91
- /**
92
- * USER: Redeem a redemption
93
- *
94
- * Updated: /redemption/auth/redeem → /redemptions/:id/redeem
95
- * Enhanced: Path-based redemption ID for better RESTful design
96
- */
97
- async redeemRedemption(redemptionId: string): Promise<RedemptionUserRedeemDetailedDTO> {
98
- const body: RedemptionRedeemRequestDTO = {
99
- redemptionId: redemptionId,
100
- };
101
- return this.apiClient.post<RedemptionUserRedeemDetailedDTO>(`${this.basePath}/${redemptionId}/redeem`, body);
102
- }
103
-
104
- /**
105
- * USER: Get user redemption history
106
- *
107
- * Updated: /redemption/auth/redeem → /redemptions/me/history
108
- */
109
- async getUserRedemptionHistory(): Promise<RedemptionUserRedeemDTO[]> {
110
- return this.apiClient.get<RedemptionUserRedeemDTO[]>(`${this.basePath}/me/history`);
111
- }
112
-
113
- /**
114
- * USER: Get user redemptions (backward compatibility)
115
- *
116
- * Deprecated: Use getUserRedemptionHistory() instead
117
- */
118
- async getUserRedeems(): Promise<RedemptionUserRedeemDTO[]> {
119
- return this.getUserRedemptionHistory();
120
- }
121
-
122
- // ==========================================
123
- // ADMIN OPERATIONS (Tenant Admin JWT)
124
- // ==========================================
125
-
126
- /**
127
- * ADMIN: Get redemptions with filtering (using intelligent endpoint)
128
- *
129
- * Updated: /redemption/admin → /redemptions (intelligent access detection)
130
- * The unified endpoint will detect admin privileges and allow filtering
131
- */
132
- async getRedemptionsAsAdmin(active?: boolean): Promise<RedemptionDTO[]> {
133
- return this.getRedemptions(active); // Uses intelligent endpoint
134
- }
135
-
136
- /**
137
- * ADMIN: Create redemption
138
- *
139
- * Updated: /redemption/admin → /redemptions
140
- */
141
- async createRedemption(redemption: RedemptionCreateRequestDTO): Promise<RedemptionDTO> {
142
- return this.apiClient.post<RedemptionDTO>(`${this.basePath}`, redemption);
143
- }
144
-
145
- /**
146
- * ADMIN: Update redemption
147
- *
148
- * Updated: /redemption/admin/:id → /redemptions/:id
149
- */
150
- async updateRedemption(id: string, redemptionCreateRequest: RedemptionCreateRequestDTO): Promise<RedemptionDTO> {
151
- return this.apiClient.put<RedemptionDTO>(`${this.basePath}/${id}`, redemptionCreateRequest);
152
- }
153
-
154
- /**
155
- * ADMIN: Toggle redemption status
156
- *
157
- * Updated: /redemption/admin/:id/toggle-active → /redemptions/:id/status
158
- * Following standard /status pattern used across domains
159
- */
160
- async toggleRedemptionStatus(redemptionId: string): Promise<RedemptionDTO> {
161
- return this.apiClient.put<RedemptionDTO>(`${this.basePath}/${redemptionId}/status`, {});
162
- }
163
-
164
- /**
165
- * ADMIN: Toggle redemption active (backward compatibility)
166
- *
167
- * Deprecated: Use toggleRedemptionStatus() instead
168
- */
169
- async toggleRedemptionActive(redemptionId: string): Promise<RedemptionDTO> {
170
- return this.toggleRedemptionStatus(redemptionId);
171
- }
172
-
173
- /**
174
- * ADMIN: Delete redemption
175
- *
176
- * Updated: /redemption/admin/:id → /redemptions/:id
177
- */
178
- async deleteRedemption(id: string): Promise<boolean> {
179
- return this.apiClient.delete<boolean>(`${this.basePath}/${id}`);
180
- }
181
-
182
- /**
183
- * ADMIN: Create redemption type
184
- *
185
- * Updated: /redemption/admin/type → /redemptions/types
186
- */
187
- async createRedemptionType(redemptionType: RedemptionTypeCreateRequestDTO): Promise<RedemptionTypeDTO> {
188
- return this.apiClient.post<RedemptionTypeDTO>(`${this.basePath}/types`, redemptionType);
189
- }
190
-
191
- // ==========================================
192
- // TOKEN UNIT MANAGEMENT (Admin)
193
- // ==========================================
194
-
195
- /**
196
- * ADMIN: Create redemption token unit
197
- *
198
- * Updated: /redemption/admin/:id/token-units → /redemptions/:id/token-units
199
- */
200
- async createRedemptionTokenUnit(redemptionId: string, redemptionTokenUnit: TokenUnitCreateRequestDTO): Promise<RedemptionDTO> {
201
- return this.apiClient.post<RedemptionDTO>(`${this.basePath}/${redemptionId}/token-units`, redemptionTokenUnit);
202
- }
203
-
204
- /**
205
- * ADMIN: Update redemption token unit
206
- *
207
- * Updated: /redemption/admin/:id/token-units/:tokenUnitId → /redemptions/:id/token-units/:tokenUnitId
208
- */
209
- async updateRedemptionTokenUnit(redemptionId: string, tokenUnitId: string, redemptionTokenUnit: TokenUnitCreateRequestDTO): Promise<RedemptionDTO> {
210
- return this.apiClient.put<RedemptionDTO>(`${this.basePath}/${redemptionId}/token-units/${tokenUnitId}`, redemptionTokenUnit);
211
- }
212
-
213
- /**
214
- * ADMIN: Delete redemption token unit
215
- *
216
- * Updated: /redemption/admin/:id/token-units/:tokenUnitId → /redemptions/:id/token-units/:tokenUnitId
217
- */
218
- async deleteRedemptionTokenUnit(redemptionId: string, redemptionTokenUnitId: string): Promise<RedemptionDTO> {
219
- return this.apiClient.delete<RedemptionDTO>(`${this.basePath}/${redemptionId}/token-units/${redemptionTokenUnitId}`);
220
- }
221
-
222
- // ==========================================
223
- // BACKWARD COMPATIBILITY METHODS
224
- // ==========================================
225
-
226
- /**
227
- * @deprecated Use getRedemptions() instead
228
- * Backward compatibility for old admin endpoint
229
- */
230
- async getRedemptionsAdmin(active?: boolean): Promise<RedemptionDTO[]> {
231
- return this.getRedemptionsAsAdmin(active);
232
- }
233
-
234
- /**
235
- * @deprecated Use redeemRedemption() instead
236
- * Backward compatibility for old redeem method
237
- */
238
- async redeem(redemptionId: string): Promise<RedemptionUserRedeemDetailedDTO> {
239
- return this.redeemRedemption(redemptionId);
240
- }
241
- }
@@ -1,60 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-redemption
3
- *
4
- * Platform-agnostic Redemption Domain SDK for PERS ecosystem
5
- * Handles redemption operations across different authorization levels
6
- */
7
-
8
- // API Layer
9
- export { RedemptionApi } from './api/redemption-api';
10
-
11
- // Service Layer
12
- export { RedemptionService } from './services/redemption-service';
13
-
14
- // Models & Types - re-export all centralized interfaces
15
- export * from '../shared/interfaces/pers-shared-lib.interfaces';
16
-
17
- // Models & Types - imported from centralized interfaces
18
-
19
- import { RedemptionCreateRequestDTO, TokenUnitCreateRequestDTO } from '../shared/interfaces/pers-shared-lib.interfaces';
20
- // Factory function for creating redemption SDK instance
21
- import { PersApiClient } from '../core/pers-api-client';
22
- import { RedemptionApi } from './api/redemption-api';
23
- import { RedemptionService } from './services/redemption-service';
24
-
25
- /**
26
- * Create a complete Redemption SDK instance
27
- *
28
- * @param apiClient - Configured PERS API client
29
- * @returns Redemption SDK with flattened structure for better DX
30
- */
31
- export function createRedemptionSDK(apiClient: PersApiClient) {
32
- const redemptionApi = new RedemptionApi(apiClient);
33
- const redemptionService = new RedemptionService(redemptionApi);
34
-
35
- return {
36
- // Direct access to service methods (primary interface)
37
-
38
- // Public methods
39
- getActiveRedemptions: () => redemptionService.getActiveRedemptions(),
40
- getRedemptionTypes: () => redemptionService.getRedemptionTypes(),
41
-
42
- // Auth methods
43
- redeemRedemption: (redemptionId: string) => redemptionService.redeemRedemption(redemptionId),
44
- getUserRedeems: () => redemptionService.getUserRedeems(),
45
-
46
- // Admin methods
47
- getRedemptionsAsAdmin: (active?: boolean) => redemptionService.getRedemptionsAsAdmin(active),
48
- createRedemption: (redemption: RedemptionCreateRequestDTO) => redemptionService.createRedemption(redemption),
49
- updateRedemption: (id: string, redemptionCreateRequest: RedemptionCreateRequestDTO) => redemptionService.updateRedemption(id, redemptionCreateRequest),
50
- toggleRedemptionActive: (redemptionId: string) => redemptionService.toggleRedemptionActive(redemptionId),
51
- createRedemptionTokenUnit: (redemptionId: string, redemptionTokenUnit: TokenUnitCreateRequestDTO) => redemptionService.createRedemptionTokenUnit(redemptionId, redemptionTokenUnit),
52
- deleteRedemptionTokenUnit: (redemptionId: string, redemptionTokenUnitId: string) => redemptionService.deleteRedemptionTokenUnit(redemptionId, redemptionTokenUnitId),
53
-
54
- // Advanced access for edge cases
55
- api: redemptionApi,
56
- service: redemptionService
57
- };
58
- }
59
-
60
- export type RedemptionSDK = ReturnType<typeof createRedemptionSDK>;
@@ -1,17 +0,0 @@
1
- /**
2
- * Redemption Domain Models
3
- *
4
- * Re-exports from centralized pers-shared interfaces for consistency with backend
5
- * and to provide a single import source for redemption-related types.
6
- */
7
-
8
- // Core redemption entities from centralized pers-shared interfaces
9
- export type {
10
- RedemptionDTO,
11
- RedemptionCreateRequestDTO,
12
- RedemptionRedeemRequestDTO,
13
- RedemptionTypeDTO,
14
- RedemptionTypeCreateRequestDTO,
15
- RedemptionUserRedeemDTO,
16
- RedemptionUserRedeemDetailedDTO
17
- } from '../../shared/interfaces/pers-shared-lib.interfaces';
@@ -1,103 +0,0 @@
1
- import { RedemptionApi } from '../api/redemption-api';
2
- import {
3
- RedemptionCreateRequestDTO,
4
- RedemptionDTO,
5
- RedemptionTypeDTO,
6
- RedemptionUserRedeemDetailedDTO,
7
- RedemptionUserRedeemDTO
8
- } from '@explorins/pers-shared';
9
- import { TokenUnitCreateRequestDTO } from '../../campaign'; // ✅ CORRECTED: Proper cross-domain import
10
-
11
- /**
12
- * Platform-Agnostic Redemption Service
13
- *
14
- * Contains redemption business logic and operations that work across platforms.
15
- * No framework dependencies - pure TypeScript business logic.
16
- *
17
- * Focuses only on actual backend capabilities.
18
- */
19
- export class RedemptionService {
20
- constructor(private redemptionApi: RedemptionApi) {}
21
-
22
- // ==========================================
23
- // PUBLIC OPERATIONS
24
- // ==========================================
25
-
26
- /**
27
- * PUBLIC: Get active redemptions
28
- */
29
- async getActiveRedemptions(): Promise<RedemptionDTO[]> {
30
- return this.redemptionApi.getActiveRedemptions();
31
- }
32
-
33
- /**
34
- * PUBLIC: Get redemption types
35
- */
36
- async getRedemptionTypes(): Promise<RedemptionTypeDTO[]> {
37
- return this.redemptionApi.getRedemptionTypes();
38
- }
39
-
40
- // ==========================================
41
- // AUTHENTICATED OPERATIONS
42
- // ==========================================
43
-
44
- /**
45
- * AUTH: Redeem a redemption
46
- */
47
- async redeemRedemption(redemptionId: string): Promise<RedemptionUserRedeemDetailedDTO> {
48
- return this.redemptionApi.redeemRedemption(redemptionId);
49
- }
50
-
51
- /**
52
- * AUTH: Get user redemptions
53
- */
54
- async getUserRedeems(): Promise<RedemptionUserRedeemDTO[]> {
55
- return this.redemptionApi.getUserRedeems();
56
- }
57
-
58
- // ==========================================
59
- // ADMIN OPERATIONS
60
- // ==========================================
61
-
62
- /**
63
- * ADMIN: Get redemptions with optional active filter
64
- */
65
- async getRedemptionsAsAdmin(active?: boolean): Promise<RedemptionDTO[]> {
66
- return this.redemptionApi.getRedemptionsAsAdmin(active);
67
- }
68
-
69
- /**
70
- * ADMIN: Create redemption
71
- */
72
- async createRedemption(redemption: RedemptionCreateRequestDTO): Promise<RedemptionDTO> {
73
- return this.redemptionApi.createRedemption(redemption);
74
- }
75
-
76
- /**
77
- * ADMIN: Update redemption
78
- */
79
- async updateRedemption(id: string, redemptionCreateRequest: RedemptionCreateRequestDTO): Promise<RedemptionDTO> {
80
- return this.redemptionApi.updateRedemption(id, redemptionCreateRequest); // ✅ CORRECTED: Fixed parameter
81
- }
82
-
83
- /**
84
- * ADMIN: Toggle redemption active status
85
- */
86
- async toggleRedemptionActive(redemptionId: string): Promise<RedemptionDTO> {
87
- return this.redemptionApi.toggleRedemptionActive(redemptionId);
88
- }
89
-
90
- /**
91
- * ADMIN: Create redemption token unit
92
- */
93
- async createRedemptionTokenUnit(redemptionId: string, redemptionTokenUnit: TokenUnitCreateRequestDTO): Promise<RedemptionDTO> {
94
- return this.redemptionApi.createRedemptionTokenUnit(redemptionId, redemptionTokenUnit);
95
- }
96
-
97
- /**
98
- * ADMIN: Delete redemption token unit
99
- */
100
- async deleteRedemptionTokenUnit(redemptionId: string, redemptionTokenUnitId: string): Promise<RedemptionDTO> {
101
- return this.redemptionApi.deleteRedemptionTokenUnit(redemptionId, redemptionTokenUnitId);
102
- }
103
- }
@@ -1,99 +0,0 @@
1
- /**
2
- * Centralized PERS Shared Library Interfaces
3
- *
4
- * Single source of truth for all @explorins/pers-shared type exports
5
- * used throughout the PERS SDK. This ensures consistent type usage
6
- * and makes it easier to manage dependencies.
7
- */
8
-
9
- // Auth Admin Domain
10
- export {
11
- type AdminDTO,
12
- type SessionAuthResponseDTO
13
- } from '@explorins/pers-shared';
14
-
15
- // Business Domain
16
- export {
17
- type BusinessDTO,
18
- type BusinessTypeDTO,
19
- type BusinessUpdateRequestDTO,
20
- type BusinessCreateRequestDTO,
21
- type BusinessToggleActiveRequestDTO,
22
- type BusinessApiKeyDTO,
23
- type BusinessTokenBalancesDTO,
24
- type BusinessTypeCreateRequestDTO
25
- } from '@explorins/pers-shared';
26
-
27
- // Campaign Domain
28
- export {
29
- type CampaignDTO,
30
- type CampaignCreateRequestDTO,
31
- type CampaignUserClaimDTO,
32
- type CampaignClaimRequestDTO,
33
- type CampaignTriggerDTO,
34
- type CampaignBusinessEngagementCreateRequestDTO,
35
- type TokenUnitCreateRequestDTO,
36
- type CampaignTriggerType
37
- } from '@explorins/pers-shared';
38
-
39
- // Donation Domain
40
- export {
41
- type DonationTypeDTO
42
- } from '@explorins/pers-shared';
43
-
44
- // Payment Domain
45
- export {
46
- type UserDTO,
47
- type PurchaseDTO,
48
- type PurchaseTokenDTO,
49
- type PurchaseTypeDTO,
50
- type PaymentIntentDTO,
51
- type PurchaseCreateRequestDTO,
52
- type PurchaseCreateResponseDTO,
53
- type PaymentIntentCreateDTO,
54
- type PurchaseCurrency
55
- } from '@explorins/pers-shared';
56
-
57
- // Redemption Domain
58
- export {
59
- type RedemptionDTO,
60
- type RedemptionCreateRequestDTO,
61
- type RedemptionRedeemRequestDTO,
62
- type RedemptionTypeDTO,
63
- type RedemptionTypeCreateRequestDTO,
64
- type RedemptionUserRedeemDTO,
65
- type RedemptionUserRedeemDetailedDTO
66
- } from '@explorins/pers-shared';
67
-
68
- // Tenant Domain
69
- export {
70
- type TenantClientConfigDTO,
71
- type TenantDTO,
72
- type TenantPublicDTO
73
- } from '@explorins/pers-shared';
74
-
75
- // Token Domain
76
- export {
77
- type TokenMetadataDTO,
78
- type TokenDTO,
79
- type TokenCreateRequestDTO,
80
- type TokenUpdateRequestDTO,
81
- type TokenStorageData,
82
- type TokenTypeDTO
83
- } from '@explorins/pers-shared';
84
-
85
- // Transaction Domain
86
- export {
87
- type TransactionDTO,
88
- type TransactionRequestDTO,
89
- type ClientTransactionRequestDTO,
90
- type ClientTransactionRequestResponseDto,
91
- type UserToBusinessTokenTransactionCreateRequestDTO,
92
- type AccountSelectorDTO
93
- } from '@explorins/pers-shared';
94
-
95
- // User Domain
96
- export {
97
- type UserCreateRequestDTO,
98
- type UserStatusTypeDTO
99
- } from '@explorins/pers-shared';
@@ -1,92 +0,0 @@
1
- import {
2
- AdminDTO,
3
- TenantPublicDTO,
4
- TenantClientConfigDTO
5
- } from '../../shared/interfaces/pers-shared-lib.interfaces';
6
- import { PersApiClient } from '../../core/pers-api-client';
7
-
8
- // Local interfaces
9
- interface AdminCreateRequestDTO {
10
- [key: string]: any;
11
- }
12
-
13
- /**
14
- * Platform-Agnostic Tenant API Client
15
- *
16
- * Handles tenant and admin operations using the PERS backend.
17
- * Matches framework TenantApiService methods exactly.
18
- *
19
- * Note: Special header handling (bypass-auth-interceptor) should be handled by PersApiClient internally
20
- * or through endpoint-specific configuration.
21
- */
22
- export class TenantApi {
23
- constructor(private apiClient: PersApiClient) {}
24
-
25
- private basePath = '/tenants';
26
- private adminPath = '/admins';
27
-
28
- // ==========================================
29
- // PUBLIC OPERATIONS
30
- // ==========================================
31
-
32
- /**
33
- * PUBLIC: Get tenant public information
34
- * ✅ FIXED: Matches framework cache busting pattern exactly
35
- */
36
- async getRemoteTenant(): Promise<TenantPublicDTO> {
37
- const timestamp = Date.now().toString();
38
- const url = `${this.basePath}/public?date=${timestamp}`;
39
- return this.apiClient.get<TenantPublicDTO>(url);
40
- }
41
-
42
- /**
43
- * PUBLIC: Get remote login token
44
- */
45
- async getRemoteLoginToken(): Promise<string> {
46
- return this.apiClient.get<string>(`${this.basePath}/login-token`);
47
- }
48
-
49
- /**
50
- * PUBLIC: Get remote client configuration
51
- * ✅ FIXED: Removed second parameter - PersApiClient handles bypass auth internally
52
- * Note: The /tenants/client-config endpoint should be configured to bypass auth at the API client level
53
- */
54
- async getRemoteClientConfig(): Promise<TenantClientConfigDTO> {
55
- return this.apiClient.get<TenantClientConfigDTO>(`${this.basePath}/client-config`);
56
- }
57
-
58
- // ==========================================
59
- // ADMIN OPERATIONS
60
- // ==========================================
61
-
62
- /**
63
- * ADMIN: Update tenant information
64
- * ✅ FIXED: Uses TenantPublicDTO directly like framework
65
- */
66
- async updateRemoteTenant(tenantData: TenantPublicDTO): Promise<TenantPublicDTO> {
67
- return this.apiClient.put<TenantPublicDTO>(`${this.basePath}`, tenantData);
68
- }
69
-
70
- /**
71
- * ADMIN: Get all tenant admins
72
- */
73
- async getAdmins(): Promise<AdminDTO[]> {
74
- return this.apiClient.get<AdminDTO[]>(`${this.adminPath}`);
75
- }
76
-
77
- /**
78
- * ADMIN: Create new admin
79
- * ✅ FIXED: Renamed to match framework postAdmin method
80
- */
81
- async postAdmin(adminData: AdminCreateRequestDTO): Promise<AdminDTO> {
82
- return this.apiClient.post<AdminDTO>(`${this.adminPath}`, adminData);
83
- }
84
-
85
- /**
86
- * ADMIN: Update admin (toggle tenant association)
87
- * ✅ FIXED: Renamed to match framework putAdmin method
88
- */
89
- async putAdmin(adminId: string, adminData: AdminCreateRequestDTO): Promise<AdminDTO> {
90
- return this.apiClient.put<AdminDTO>(`${this.adminPath}/${adminId}/tenant`, adminData);
91
- }
92
- }
@@ -1,61 +0,0 @@
1
- /**
2
- * @explorins/pers-sdk-tenant
3
- *
4
- * Platform-agnostic Tenant Domain SDK for PERS ecosystem
5
- * Handles tenant management and admin operations for multi-tenant architecture
6
- */
7
-
8
- // API Layer
9
- export { TenantApi } from './api/tenant-api';
10
-
11
- // Service Layer
12
- export { TenantService } from './services/tenant-service';
13
-
14
- // Models & Types
15
- export * from './models';
16
- export * from '../shared/interfaces/pers-shared-lib.interfaces';
17
-
18
- // Models & Types
19
- export * from './models';
20
-
21
- // Factory function for creating tenant SDK instance
22
- import { PersApiClient } from '../core/pers-api-client';
23
- import { TenantApi } from './api/tenant-api';
24
- import { TenantService } from './services/tenant-service';
25
- import { TenantPublicDTO, AdminCreateRequestDTO } from './models';
26
-
27
- /**
28
- * Create a complete Tenant SDK instance
29
- *
30
- * @param apiClient - Configured PERS API client
31
- * @returns Tenant SDK with flattened structure for better DX
32
- */
33
- export function createTenantSDK(apiClient: PersApiClient) {
34
- const tenantApi = new TenantApi(apiClient);
35
- const tenantService = new TenantService(tenantApi);
36
-
37
- return {
38
- // Direct access to service methods (primary interface)
39
- // ✅ FRAMEWORK ALIGNED: Only methods actually used by framework
40
-
41
- // Public methods
42
- getRemoteTenant: () => tenantService.getRemoteTenant(),
43
- getRemoteLoginToken: () => tenantService.getRemoteLoginToken(),
44
- getRemoteClientConfig: () => tenantService.getRemoteClientConfig(),
45
-
46
- // Admin methods - ✅ FIXED: Matches framework method names exactly
47
- updateRemoteTenant: (tenantData: TenantPublicDTO) =>
48
- tenantService.updateRemoteTenant(tenantData),
49
- getAdmins: () => tenantService.getAdmins(),
50
- postAdmin: (adminData: AdminCreateRequestDTO) =>
51
- tenantService.postAdmin(adminData),
52
- putAdmin: (adminId: string, adminData: AdminCreateRequestDTO) =>
53
- tenantService.putAdmin(adminId, adminData),
54
-
55
- // Advanced access for edge cases
56
- api: tenantApi,
57
- service: tenantService
58
- };
59
- }
60
-
61
- export type TenantSDK = ReturnType<typeof createTenantSDK>;
@@ -1,20 +0,0 @@
1
- /**
2
- * Tenant Domain Models
3
- *
4
- * Re-exports from centralized pers-shared interfaces for consistency with backend
5
- * and to provide a single import source for tenant-related types.
6
- */
7
-
8
- // Core tenant entities from centralized pers-shared interfaces
9
- export type {
10
- TenantClientConfigDTO,
11
- TenantDTO,
12
- TenantPublicDTO,
13
- AdminDTO
14
- } from '../../shared/interfaces/pers-shared-lib.interfaces';
15
-
16
- // Local tenant interfaces
17
- export interface AdminCreateRequestDTO {
18
- // Add properties as needed
19
- [key: string]: any;
20
- }