@explorins/pers-sdk 2.0.7 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -59
- package/dist/analytics/index.d.ts +0 -2
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/models/index.d.ts +1 -10
- package/dist/analytics/models/index.d.ts.map +1 -1
- package/dist/analytics.cjs +44 -29
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +45 -2
- package/dist/analytics.js.map +1 -1
- package/dist/business/index.d.ts +0 -1
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business.cjs +7 -774
- package/dist/business.cjs.map +1 -1
- package/dist/business.js +3 -751
- package/dist/business.js.map +1 -1
- package/dist/campaign/index.d.ts +0 -1
- package/dist/campaign/index.d.ts.map +1 -1
- package/dist/campaign.cjs +429 -29
- package/dist/campaign.cjs.map +1 -1
- package/dist/campaign.js +431 -3
- package/dist/campaign.js.map +1 -1
- package/dist/chunks/business-membership-service-8KC_qRj7.cjs +756 -0
- package/dist/chunks/business-membership-service-8KC_qRj7.cjs.map +1 -0
- package/dist/chunks/business-membership-service-D6vaVQTR.js +751 -0
- package/dist/chunks/business-membership-service-D6vaVQTR.js.map +1 -0
- package/dist/chunks/{web3-chain-service-BeBjALg2.cjs → index-B-g2JPVK.cjs} +1 -220
- package/dist/chunks/index-B-g2JPVK.cjs.map +1 -0
- package/dist/chunks/{web3-chain-service-DKHCnHQX.js → index-CKm_V5XE.js} +2 -219
- package/dist/chunks/index-CKm_V5XE.js.map +1 -0
- package/dist/chunks/payment-service-Bkw7ZXev.cjs +214 -0
- package/dist/chunks/payment-service-Bkw7ZXev.cjs.map +1 -0
- package/dist/chunks/payment-service-IvM6rryM.js +211 -0
- package/dist/chunks/payment-service-IvM6rryM.js.map +1 -0
- package/dist/chunks/{pers-sdk-JIExM712.js → pers-sdk-DYnIZvcx.js} +12 -291
- package/dist/chunks/pers-sdk-DYnIZvcx.js.map +1 -0
- package/dist/chunks/{pers-sdk-h-uoLpBx.cjs → pers-sdk-Dr9W8stD.cjs} +38 -318
- package/dist/chunks/pers-sdk-Dr9W8stD.cjs.map +1 -0
- package/dist/chunks/redemption-service-D-hBqh42.js +339 -0
- package/dist/chunks/redemption-service-D-hBqh42.js.map +1 -0
- package/dist/chunks/redemption-service-rMB6T2W5.cjs +342 -0
- package/dist/chunks/redemption-service-rMB6T2W5.cjs.map +1 -0
- package/dist/chunks/tenant-service-CsRA3O2V.js +163 -0
- package/dist/chunks/tenant-service-CsRA3O2V.js.map +1 -0
- package/dist/chunks/tenant-service-fj-pkXTw.cjs +166 -0
- package/dist/chunks/tenant-service-fj-pkXTw.cjs.map +1 -0
- package/dist/chunks/{transaction-request.builder-DrqTWcyC.cjs → transaction-request.builder-BwWmfHXm.cjs} +6 -6
- package/dist/chunks/{transaction-request.builder-DrqTWcyC.cjs.map → transaction-request.builder-BwWmfHXm.cjs.map} +1 -1
- package/dist/chunks/{transaction-request.builder-DltmruUC.js → transaction-request.builder-C1FPWmYN.js} +6 -6
- package/dist/chunks/{transaction-request.builder-DltmruUC.js.map → transaction-request.builder-C1FPWmYN.js.map} +1 -1
- package/dist/chunks/web3-chain-service-D68-0WaW.cjs +224 -0
- package/dist/chunks/web3-chain-service-D68-0WaW.cjs.map +1 -0
- package/dist/chunks/web3-chain-service-DuvxmKSj.js +221 -0
- package/dist/chunks/web3-chain-service-DuvxmKSj.js.map +1 -0
- package/dist/chunks/{explorer.utils-Cx3wrqAj.cjs → web3-manager-C_cFaMCm.cjs} +411 -144
- package/dist/chunks/web3-manager-C_cFaMCm.cjs.map +1 -0
- package/dist/chunks/{explorer.utils-BkS3k8hX.js → web3-manager-OExwBWB7.js} +412 -146
- package/dist/chunks/web3-manager-OExwBWB7.js.map +1 -0
- package/dist/core.cjs +18 -21
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +10 -12
- package/dist/core.js.map +1 -1
- package/dist/donation/index.d.ts +0 -1
- package/dist/donation/index.d.ts.map +1 -1
- package/dist/donation.cjs +48 -29
- package/dist/donation.cjs.map +1 -1
- package/dist/donation.js +50 -3
- package/dist/donation.js.map +1 -1
- package/dist/index.cjs +43 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -15
- package/dist/index.js.map +1 -1
- package/dist/managers/analytics-manager.d.ts +1 -1
- package/dist/managers/index.d.ts +0 -1
- package/dist/managers/index.d.ts.map +1 -1
- package/dist/managers/web3-manager.d.ts +1 -1
- package/dist/managers/web3-manager.d.ts.map +1 -1
- package/dist/node.cjs +10 -13
- package/dist/node.cjs.map +1 -1
- package/dist/node.js +10 -13
- package/dist/node.js.map +1 -1
- package/dist/package.json +4 -10
- package/dist/payment/index.d.ts +0 -1
- package/dist/payment/index.d.ts.map +1 -1
- package/dist/payment.cjs +5 -232
- package/dist/payment.cjs.map +1 -1
- package/dist/payment.js +3 -210
- package/dist/payment.js.map +1 -1
- package/dist/pers-sdk.d.ts +1 -13
- package/dist/pers-sdk.d.ts.map +1 -1
- package/dist/redemption/index.d.ts +0 -1
- package/dist/redemption/index.d.ts.map +1 -1
- package/dist/redemption/services/redemption-service.d.ts +1 -2
- package/dist/redemption/services/redemption-service.d.ts.map +1 -1
- package/dist/redemption.cjs +5 -360
- package/dist/redemption.cjs.map +1 -1
- package/dist/redemption.js +3 -338
- package/dist/redemption.js.map +1 -1
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts +15 -21
- package/dist/shared/interfaces/pers-shared-lib.interfaces.d.ts.map +1 -1
- package/dist/tenant/index.d.ts +0 -1
- package/dist/tenant/index.d.ts.map +1 -1
- package/dist/tenant.cjs +5 -184
- package/dist/tenant.cjs.map +1 -1
- package/dist/tenant.js +3 -162
- package/dist/tenant.js.map +1 -1
- package/dist/token/index.d.ts +0 -1
- package/dist/token/index.d.ts.map +1 -1
- package/dist/token.cjs +1 -25
- package/dist/token.cjs.map +1 -1
- package/dist/token.js +1 -1
- package/dist/transaction/models/transaction-request.builder.d.ts +4 -4
- package/dist/transaction/models/transaction-request.builder.d.ts.map +1 -1
- package/dist/transaction.cjs +1 -1
- package/dist/transaction.js +1 -1
- package/dist/user/index.d.ts +0 -1
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user-status/index.d.ts +0 -1
- package/dist/user-status/index.d.ts.map +1 -1
- package/dist/user-status.cjs +0 -25
- package/dist/user-status.cjs.map +1 -1
- package/dist/user-status.js +0 -1
- package/dist/user-status.js.map +1 -1
- package/dist/user.cjs +209 -29
- package/dist/user.cjs.map +1 -1
- package/dist/user.js +211 -3
- package/dist/user.js.map +1 -1
- package/dist/web3/index.d.ts +1 -0
- package/dist/web3/index.d.ts.map +1 -1
- package/dist/web3-chain/index.d.ts +0 -1
- package/dist/web3-chain/index.d.ts.map +1 -1
- package/dist/web3-chain.cjs +14 -29
- package/dist/web3-chain.cjs.map +1 -1
- package/dist/web3-chain.js +16 -3
- package/dist/web3-chain.js.map +1 -1
- package/dist/web3-manager.cjs +13 -0
- package/dist/web3-manager.cjs.map +1 -0
- package/dist/web3-manager.js +7 -0
- package/dist/web3-manager.js.map +1 -0
- package/dist/web3.cjs +10 -6
- package/dist/web3.cjs.map +1 -1
- package/dist/web3.js +4 -1
- package/dist/web3.js.map +1 -1
- package/package.json +4 -10
- package/dist/chunks/analytics-service-CitlimKJ.cjs +0 -49
- package/dist/chunks/analytics-service-CitlimKJ.cjs.map +0 -1
- package/dist/chunks/analytics-service-CxyrOwel.js +0 -46
- package/dist/chunks/analytics-service-CxyrOwel.js.map +0 -1
- package/dist/chunks/campaign-service-CdEz0jpP.cjs +0 -435
- package/dist/chunks/campaign-service-CdEz0jpP.cjs.map +0 -1
- package/dist/chunks/campaign-service-DrTAqFZM.js +0 -432
- package/dist/chunks/campaign-service-DrTAqFZM.js.map +0 -1
- package/dist/chunks/donation-service--6cnTvWq.cjs +0 -54
- package/dist/chunks/donation-service--6cnTvWq.cjs.map +0 -1
- package/dist/chunks/donation-service-xiXZ2Eto.js +0 -51
- package/dist/chunks/donation-service-xiXZ2Eto.js.map +0 -1
- package/dist/chunks/explorer.utils-BkS3k8hX.js.map +0 -1
- package/dist/chunks/explorer.utils-Cx3wrqAj.cjs.map +0 -1
- package/dist/chunks/index-BtDNXaFq.js +0 -13
- package/dist/chunks/index-BtDNXaFq.js.map +0 -1
- package/dist/chunks/index-CMk3Aqkk.cjs +0 -15
- package/dist/chunks/index-CMk3Aqkk.cjs.map +0 -1
- package/dist/chunks/pers-sdk-JIExM712.js.map +0 -1
- package/dist/chunks/pers-sdk-h-uoLpBx.cjs.map +0 -1
- package/dist/chunks/user-service-BGP3SZpk.js +0 -212
- package/dist/chunks/user-service-BGP3SZpk.js.map +0 -1
- package/dist/chunks/user-service-gITOx4qj.cjs +0 -215
- package/dist/chunks/user-service-gITOx4qj.cjs.map +0 -1
- package/dist/chunks/web3-chain-service-BeBjALg2.cjs.map +0 -1
- package/dist/chunks/web3-chain-service-DKHCnHQX.js.map +0 -1
package/dist/redemption.cjs
CHANGED
|
@@ -1,366 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
3
|
+
var redemptionService = require('./chunks/redemption-service-rMB6T2W5.cjs');
|
|
4
|
+
require('@explorins/pers-shared');
|
|
5
|
+
require('./chunks/pagination-utils-B2jRHMSO.cjs');
|
|
5
6
|
|
|
6
|
-
/**
|
|
7
|
-
* Platform-Agnostic Redemption API Client (UPDATED - RESTful Design)
|
|
8
|
-
*
|
|
9
|
-
* Updated to work with the new RESTful controller structure:
|
|
10
|
-
* - /redemptions (main redemption management)
|
|
11
|
-
* - /redemption-types (redemption type management)
|
|
12
|
-
* - /redemption-tokens (token unit management)
|
|
13
|
-
* - /redemption-redeems (redemption execution and history)
|
|
14
|
-
*
|
|
15
|
-
* Handles redemption operations using the PERS backend with intelligent access detection.
|
|
16
|
-
* Uses @explorins/pers-shared DTOs for consistency with backend.
|
|
17
|
-
*/
|
|
18
|
-
class RedemptionApi {
|
|
19
|
-
constructor(apiClient) {
|
|
20
|
-
this.apiClient = apiClient;
|
|
21
|
-
this.basePath = '/redemptions';
|
|
22
|
-
this.typesPath = '/redemptions/types';
|
|
23
|
-
}
|
|
24
|
-
// ==========================================
|
|
25
|
-
// PUBLIC OPERATIONS (Project Key)
|
|
26
|
-
// ==========================================
|
|
27
|
-
/**
|
|
28
|
-
* UNIFIED: Get redemptions with intelligent access control
|
|
29
|
-
*
|
|
30
|
-
* Intelligent endpoint that adapts based on authentication:
|
|
31
|
-
* - Public users: Get active redemptions only
|
|
32
|
-
* - Admin users: Get all redemptions with optional filtering
|
|
33
|
-
*
|
|
34
|
-
* @param options.active - Filter by active status (undefined = all for admins/active for public)
|
|
35
|
-
* @param options.adminAccess - Force admin access (requires admin auth)
|
|
36
|
-
* @param options.page - Page number (default: 1)
|
|
37
|
-
* @param options.limit - Items per page (default: 50)
|
|
38
|
-
* @param options.sortBy - Sort field
|
|
39
|
-
* @param options.sortOrder - Sort order (asc/desc)
|
|
40
|
-
* @returns Paginated response with redemptions
|
|
41
|
-
*/
|
|
42
|
-
async getRedemptions(options) {
|
|
43
|
-
const params = paginationUtils.buildPaginationParams(options);
|
|
44
|
-
if (options?.active !== undefined) {
|
|
45
|
-
params.append('active', String(options.active));
|
|
46
|
-
}
|
|
47
|
-
const response = await this.apiClient.get(`${this.basePath}?${params.toString()}`);
|
|
48
|
-
return paginationUtils.normalizeToPaginated(response);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* PUBLIC: Get redemption types
|
|
52
|
-
*
|
|
53
|
-
* Updated: /redemption/type → /redemption-types
|
|
54
|
-
* @param options Pagination options (page, limit, sortBy, sortOrder)
|
|
55
|
-
* @returns Paginated response with redemption types
|
|
56
|
-
*/
|
|
57
|
-
async getRedemptionTypes(options) {
|
|
58
|
-
const params = paginationUtils.buildPaginationParams(options);
|
|
59
|
-
const response = await this.apiClient.get(`${this.typesPath}?${params.toString()}`);
|
|
60
|
-
return paginationUtils.normalizeToPaginated(response);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* PUBLIC: Get redemption by ID
|
|
64
|
-
*
|
|
65
|
-
* Updated: /redemption/:id → /redemptions/:id
|
|
66
|
-
*/
|
|
67
|
-
async getRedemptionById(id) {
|
|
68
|
-
return this.apiClient.get(`${this.basePath}/${id}`);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* PUBLIC: Get available supply for redemption
|
|
72
|
-
*
|
|
73
|
-
* Updated: /redemption/:id/available-supply → /redemptions/:id/supply
|
|
74
|
-
*/
|
|
75
|
-
async getRedemptionAvailableSupply(id) {
|
|
76
|
-
const result = await this.apiClient.get(`${this.basePath}/${id}/supply`);
|
|
77
|
-
return result.available;
|
|
78
|
-
}
|
|
79
|
-
// ==========================================
|
|
80
|
-
// REDEMPTION EXECUTION (UNIFIED ENDPOINT)
|
|
81
|
-
// ==========================================
|
|
82
|
-
/**
|
|
83
|
-
* Execute redemption (unified endpoint)
|
|
84
|
-
*
|
|
85
|
-
* NEW: POST /redemption-redeems - Role-based processing
|
|
86
|
-
* - USER: Direct user redemption processing
|
|
87
|
-
* - ADMIN: Can process redemptions for any account type
|
|
88
|
-
* - BUSINESS: Process redemptions for customers
|
|
89
|
-
*/
|
|
90
|
-
async redeemRedemption(redemptionId) {
|
|
91
|
-
const body = {
|
|
92
|
-
redemptionId: redemptionId,
|
|
93
|
-
};
|
|
94
|
-
return this.apiClient.post(this.basePath + '/redeems', body);
|
|
95
|
-
}
|
|
96
|
-
// ==========================================
|
|
97
|
-
// REDEMPTION REDEEMS QUERIES (NEW ENDPOINTS)
|
|
98
|
-
// ==========================================
|
|
99
|
-
/**
|
|
100
|
-
* UNIFIED: Get redemption redeems with filtering and intelligent access
|
|
101
|
-
*
|
|
102
|
-
* Role-based access with unified filtering:
|
|
103
|
-
* - Users: See only their own redeems (userId/businessId filters ignored)
|
|
104
|
-
* - Admins: Can filter by userId, businessId, or redemptionId
|
|
105
|
-
*
|
|
106
|
-
* @param filters.redemptionId - Filter by specific redemption
|
|
107
|
-
* @param filters.userId - Admin only: Filter by user ID
|
|
108
|
-
* @param filters.businessId - Admin only: Filter by business ID
|
|
109
|
-
* @param filters.myRedeems - Force user's own redeems (uses /me endpoint)
|
|
110
|
-
* @param filters.page - Page number (default: 1)
|
|
111
|
-
* @param filters.limit - Items per page (default: 50)
|
|
112
|
-
* @param filters.sortBy - Sort field
|
|
113
|
-
* @param filters.sortOrder - Sort order (asc/desc)
|
|
114
|
-
* @returns Paginated response with redemption redeems
|
|
115
|
-
*/
|
|
116
|
-
async getRedemptionRedeems(filters) {
|
|
117
|
-
let url = `${this.basePath}/redeems`;
|
|
118
|
-
const params = paginationUtils.buildPaginationParams(filters);
|
|
119
|
-
// Use convenience endpoint for user's own redeems
|
|
120
|
-
if (filters?.myRedeems) {
|
|
121
|
-
url = `${this.basePath}/redeems/me`;
|
|
122
|
-
if (filters?.redemptionId) {
|
|
123
|
-
params.append('redemptionId', filters.redemptionId);
|
|
124
|
-
}
|
|
125
|
-
const response = await this.apiClient.get(`${url}?${params.toString()}`);
|
|
126
|
-
return paginationUtils.normalizeToPaginated(response);
|
|
127
|
-
}
|
|
128
|
-
// Use admin endpoint with filtering
|
|
129
|
-
if (filters?.redemptionId)
|
|
130
|
-
params.append('redemptionId', filters.redemptionId);
|
|
131
|
-
if (filters?.userId)
|
|
132
|
-
params.append('userId', filters.userId);
|
|
133
|
-
if (filters?.businessId)
|
|
134
|
-
params.append('businessId', filters.businessId);
|
|
135
|
-
const response = await this.apiClient.get(`${url}?${params.toString()}`);
|
|
136
|
-
return paginationUtils.normalizeToPaginated(response);
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* UNIFIED: Get specific redemption redeem by ID
|
|
140
|
-
*/
|
|
141
|
-
async getRedemptionRedeemById(id) {
|
|
142
|
-
return this.apiClient.get(`${this.basePath}/redeems/${id}`);
|
|
143
|
-
}
|
|
144
|
-
// ==========================================
|
|
145
|
-
// USER OPERATIONS (JWT + Project Key)
|
|
146
|
-
// ==========================================
|
|
147
|
-
/**
|
|
148
|
-
* UNIFIED: Get user redemption history
|
|
149
|
-
*
|
|
150
|
-
* Uses convenience endpoint /redemption-redeems/me with optional filtering
|
|
151
|
-
* @param redemptionId - Optional filter by specific redemption
|
|
152
|
-
* @param options - Pagination options (page, limit, sortBy, sortOrder)
|
|
153
|
-
* @returns Paginated response with user's redemption redeems
|
|
154
|
-
*/
|
|
155
|
-
async getUserRedeems(redemptionId, options) {
|
|
156
|
-
return this.getRedemptionRedeems({ myRedeems: true, redemptionId, ...options });
|
|
157
|
-
}
|
|
158
|
-
// ==========================================
|
|
159
|
-
// ADMIN OPERATIONS (Tenant Admin JWT)
|
|
160
|
-
// ==========================================
|
|
161
|
-
/**
|
|
162
|
-
* ADMIN: Create redemption
|
|
163
|
-
*
|
|
164
|
-
* Updated: /redemption/admin → /redemptions
|
|
165
|
-
*/
|
|
166
|
-
async createRedemption(redemption) {
|
|
167
|
-
return this.apiClient.post(`${this.basePath}`, redemption);
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* ADMIN: Update redemption
|
|
171
|
-
*
|
|
172
|
-
* Updated: /redemption/admin/:id → /redemptions/:id
|
|
173
|
-
*/
|
|
174
|
-
async updateRedemption(id, redemptionCreateRequest) {
|
|
175
|
-
return this.apiClient.put(`${this.basePath}/${id}`, redemptionCreateRequest);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* UNIFIED: Toggle redemption active status
|
|
179
|
-
*
|
|
180
|
-
* Updated: /redemption/admin/:id/toggle-active → /redemptions/:id/status
|
|
181
|
-
* Following standard /status pattern used across domains
|
|
182
|
-
*/
|
|
183
|
-
async toggleRedemptionActive(redemptionId) {
|
|
184
|
-
return this.apiClient.put(`${this.basePath}/${redemptionId}/status`, {});
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* ADMIN: Delete redemption
|
|
188
|
-
*
|
|
189
|
-
* Updated: /redemption/admin/:id → /redemptions/:id
|
|
190
|
-
*/
|
|
191
|
-
async deleteRedemption(id) {
|
|
192
|
-
return this.apiClient.delete(`${this.basePath}/${id}`);
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* ADMIN: Create redemption type
|
|
196
|
-
*
|
|
197
|
-
* Updated: /redemption/admin/type → /redemption-types
|
|
198
|
-
*/
|
|
199
|
-
async createRedemptionType(redemptionType) {
|
|
200
|
-
return this.apiClient.post(this.typesPath, redemptionType);
|
|
201
|
-
}
|
|
202
|
-
// ==========================================
|
|
203
|
-
// TOKEN UNIT MANAGEMENT (Admin)
|
|
204
|
-
// ==========================================
|
|
205
|
-
/**
|
|
206
|
-
* ADMIN: Create redemption token unit
|
|
207
|
-
*
|
|
208
|
-
* Updated: /redemption/admin/:id/token-units → /redemption-tokens/:id/
|
|
209
|
-
*/
|
|
210
|
-
async createRedemptionTokenUnit(redemptionId, redemptionTokenUnit) {
|
|
211
|
-
return this.apiClient.post(`${this.basePath}/${redemptionId}/tokens`, redemptionTokenUnit);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* ADMIN: Update redemption token unit
|
|
215
|
-
*
|
|
216
|
-
* Updated: /redemption/admin/:id/token-units/:tokenUnitId → /redemption-tokens/:id/:tokenUnitId
|
|
217
|
-
*/
|
|
218
|
-
async updateRedemptionTokenUnit(redemptionId, tokenUnitId, redemptionTokenUnit) {
|
|
219
|
-
return this.apiClient.put(`${this.basePath}/${redemptionId}/tokens/${tokenUnitId}`, redemptionTokenUnit);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* ADMIN: Delete redemption token unit
|
|
223
|
-
*
|
|
224
|
-
* Updated: /redemption/admin/:id/token-units/:tokenUnitId → /redemption-tokens/:id/:tokenUnitId
|
|
225
|
-
*/
|
|
226
|
-
async deleteRedemptionTokenUnit(redemptionId, redemptionTokenUnitId) {
|
|
227
|
-
return this.apiClient.delete(`${this.basePath}/${redemptionId}/tokens/${redemptionTokenUnitId}`);
|
|
228
|
-
}
|
|
229
|
-
// ==========================================
|
|
230
|
-
// CONVENIENCE METHODS (Legacy Support)
|
|
231
|
-
// ==========================================
|
|
232
|
-
/**
|
|
233
|
-
* Convenience: Get active redemptions (public access)
|
|
234
|
-
*
|
|
235
|
-
* @deprecated Use getRedemptions({ active: true }) instead for paginated results
|
|
236
|
-
*/
|
|
237
|
-
async getActiveRedemptions() {
|
|
238
|
-
const result = await this.getRedemptions({ active: true });
|
|
239
|
-
return [...result.data];
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
7
|
|
|
243
|
-
/**
|
|
244
|
-
* Platform-Agnostic Redemption Service
|
|
245
|
-
*
|
|
246
|
-
* Contains redemption business logic and operations that work across platforms.
|
|
247
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
248
|
-
*
|
|
249
|
-
* Focuses only on actual backend capabilities.
|
|
250
|
-
*/
|
|
251
|
-
class RedemptionService {
|
|
252
|
-
constructor(redemptionApi) {
|
|
253
|
-
this.redemptionApi = redemptionApi;
|
|
254
|
-
}
|
|
255
|
-
// ==========================================
|
|
256
|
-
// PUBLIC OPERATIONS
|
|
257
|
-
// ==========================================
|
|
258
|
-
/**
|
|
259
|
-
* UNIFIED: Get redemptions with intelligent access control and pagination
|
|
260
|
-
* @param options.active - Filter by active status
|
|
261
|
-
* @param options.adminAccess - Force admin access
|
|
262
|
-
*/
|
|
263
|
-
async getRedemptions(options) {
|
|
264
|
-
return this.redemptionApi.getRedemptions(options);
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Convenience: Get active redemptions (public)
|
|
268
|
-
*/
|
|
269
|
-
async getActiveRedemptions() {
|
|
270
|
-
return this.redemptionApi.getActiveRedemptions();
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Get all redemption types with pagination
|
|
274
|
-
*/
|
|
275
|
-
async getRedemptionTypes(options) {
|
|
276
|
-
return this.redemptionApi.getRedemptionTypes(options);
|
|
277
|
-
}
|
|
278
|
-
// ==========================================
|
|
279
|
-
// AUTHENTICATED OPERATIONS
|
|
280
|
-
// ==========================================
|
|
281
|
-
/**
|
|
282
|
-
* AUTH: Redeem a redemption
|
|
283
|
-
*/
|
|
284
|
-
async redeemRedemption(redemptionId) {
|
|
285
|
-
return this.redemptionApi.redeemRedemption(redemptionId);
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* UNIFIED: Get redemption redeems with filtering and pagination
|
|
289
|
-
*/
|
|
290
|
-
async getRedemptionRedeems(filters) {
|
|
291
|
-
return this.redemptionApi.getRedemptionRedeems(filters);
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Convenience: Get user redemptions with pagination
|
|
295
|
-
*/
|
|
296
|
-
async getUserRedeems(options) {
|
|
297
|
-
return this.redemptionApi.getUserRedeems(undefined, options);
|
|
298
|
-
}
|
|
299
|
-
// ==========================================
|
|
300
|
-
// ADMIN OPERATIONS
|
|
301
|
-
// ==========================================
|
|
302
|
-
/**
|
|
303
|
-
* Convenience: Get redemptions as admin
|
|
304
|
-
*/
|
|
305
|
-
async getRedemptionsAsAdmin(active, options) {
|
|
306
|
-
return this.redemptionApi.getRedemptions({ active, adminAccess: true, ...options });
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* ADMIN: Create redemption
|
|
310
|
-
*/
|
|
311
|
-
async createRedemption(redemption) {
|
|
312
|
-
return this.redemptionApi.createRedemption(redemption);
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* ADMIN: Update redemption
|
|
316
|
-
*/
|
|
317
|
-
async updateRedemption(id, redemptionCreateRequest) {
|
|
318
|
-
return this.redemptionApi.updateRedemption(id, redemptionCreateRequest); // ✅ CORRECTED: Fixed parameter
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* ADMIN: Toggle redemption active status
|
|
322
|
-
*/
|
|
323
|
-
async toggleRedemptionActive(redemptionId) {
|
|
324
|
-
return this.redemptionApi.toggleRedemptionActive(redemptionId);
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* ADMIN: Create redemption token unit
|
|
328
|
-
*/
|
|
329
|
-
async createRedemptionTokenUnit(redemptionId, redemptionTokenUnit) {
|
|
330
|
-
return this.redemptionApi.createRedemptionTokenUnit(redemptionId, redemptionTokenUnit);
|
|
331
|
-
}
|
|
332
|
-
/**
|
|
333
|
-
* ADMIN: Delete redemption token unit
|
|
334
|
-
*/
|
|
335
|
-
async deleteRedemptionTokenUnit(redemptionId, redemptionTokenUnitId) {
|
|
336
|
-
return this.redemptionApi.deleteRedemptionTokenUnit(redemptionId, redemptionTokenUnitId);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
8
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
get: function () { return persShared.AccountOwnerType; }
|
|
343
|
-
});
|
|
344
|
-
Object.defineProperty(exports, "ApiKeyType", {
|
|
345
|
-
enumerable: true,
|
|
346
|
-
get: function () { return persShared.ApiKeyType; }
|
|
347
|
-
});
|
|
348
|
-
Object.defineProperty(exports, "MEMBERSHIP_ROLE_HIERARCHY", {
|
|
349
|
-
enumerable: true,
|
|
350
|
-
get: function () { return persShared.MEMBERSHIP_ROLE_HIERARCHY; }
|
|
351
|
-
});
|
|
352
|
-
Object.defineProperty(exports, "MembershipRole", {
|
|
353
|
-
enumerable: true,
|
|
354
|
-
get: function () { return persShared.MembershipRole; }
|
|
355
|
-
});
|
|
356
|
-
Object.defineProperty(exports, "NativeTokenTypes", {
|
|
357
|
-
enumerable: true,
|
|
358
|
-
get: function () { return persShared.NativeTokenTypes; }
|
|
359
|
-
});
|
|
360
|
-
Object.defineProperty(exports, "hasMinimumRole", {
|
|
361
|
-
enumerable: true,
|
|
362
|
-
get: function () { return persShared.hasMinimumRole; }
|
|
363
|
-
});
|
|
364
|
-
exports.RedemptionApi = RedemptionApi;
|
|
365
|
-
exports.RedemptionService = RedemptionService;
|
|
9
|
+
exports.RedemptionApi = redemptionService.RedemptionApi;
|
|
10
|
+
exports.RedemptionService = redemptionService.RedemptionService;
|
|
366
11
|
//# sourceMappingURL=redemption.cjs.map
|
package/dist/redemption.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redemption.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"redemption.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|