@explorins/pers-sdk 1.6.4 → 1.6.9
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 +86 -342
- package/dist/analytics/index.d.ts +0 -16
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics.cjs +5 -73
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +1 -72
- package/dist/analytics.js.map +1 -1
- package/dist/business/index.d.ts +0 -24
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business.cjs +5 -273
- package/dist/business.cjs.map +1 -1
- package/dist/business.js +1 -272
- package/dist/business.js.map +1 -1
- package/dist/campaign/api/campaign-api.d.ts +3 -3
- package/dist/campaign/api/campaign-api.d.ts.map +1 -1
- package/dist/campaign/index.d.ts +0 -34
- package/dist/campaign/index.d.ts.map +1 -1
- package/dist/campaign.cjs +5 -447
- package/dist/campaign.cjs.map +1 -1
- package/dist/campaign.js +1 -446
- package/dist/campaign.js.map +1 -1
- package/dist/chunks/analytics-service-CitlimKJ.cjs +49 -0
- package/dist/chunks/analytics-service-CitlimKJ.cjs.map +1 -0
- package/dist/chunks/analytics-service-CxyrOwel.js +46 -0
- package/dist/chunks/analytics-service-CxyrOwel.js.map +1 -0
- package/dist/chunks/{token-sdk-BW4kkJb3.js → base-token-service-BSXDwrcq.js} +138 -204
- package/dist/chunks/base-token-service-BSXDwrcq.js.map +1 -0
- package/dist/chunks/{token-sdk-CiAbOb6c.cjs → base-token-service-CYuqPPs0.cjs} +140 -207
- package/dist/chunks/base-token-service-CYuqPPs0.cjs.map +1 -0
- package/dist/chunks/business-service-Cq3-oksM.cjs +241 -0
- package/dist/chunks/business-service-Cq3-oksM.cjs.map +1 -0
- package/dist/chunks/business-service-DrC-TNGa.js +238 -0
- package/dist/chunks/business-service-DrC-TNGa.js.map +1 -0
- package/dist/chunks/campaign-service-CWK9I388.cjs +403 -0
- package/dist/chunks/campaign-service-CWK9I388.cjs.map +1 -0
- package/dist/chunks/campaign-service-Dd7gMjC9.js +400 -0
- package/dist/chunks/campaign-service-Dd7gMjC9.js.map +1 -0
- package/dist/chunks/donation-service-CyJS4DIZ.js +47 -0
- package/dist/chunks/donation-service-CyJS4DIZ.js.map +1 -0
- package/dist/chunks/donation-service-D-xFrONi.cjs +50 -0
- package/dist/chunks/donation-service-D-xFrONi.cjs.map +1 -0
- package/dist/chunks/{index-CJ9Jfa4A.js → explorer.utils-Ckll15ja.js} +108 -172
- package/dist/chunks/explorer.utils-Ckll15ja.js.map +1 -0
- package/dist/chunks/{index-CzEluQmf.cjs → explorer.utils-GpskbLl1.cjs} +106 -174
- package/dist/chunks/explorer.utils-GpskbLl1.cjs.map +1 -0
- package/dist/chunks/index-BtDNXaFq.js +13 -0
- package/dist/chunks/index-BtDNXaFq.js.map +1 -0
- package/dist/chunks/index-CMk3Aqkk.cjs +15 -0
- package/dist/chunks/index-CMk3Aqkk.cjs.map +1 -0
- package/dist/chunks/payment-service-B4qx0qiE.cjs +220 -0
- package/dist/chunks/payment-service-B4qx0qiE.cjs.map +1 -0
- package/dist/chunks/payment-service-DfCBFosx.js +217 -0
- package/dist/chunks/payment-service-DfCBFosx.js.map +1 -0
- package/dist/chunks/pers-sdk-Bd6BZHgt.js +5672 -0
- package/dist/chunks/pers-sdk-Bd6BZHgt.js.map +1 -0
- package/dist/chunks/pers-sdk-CmyPEhy7.cjs +5705 -0
- package/dist/chunks/pers-sdk-CmyPEhy7.cjs.map +1 -0
- package/dist/chunks/redemption-service-7qbeQxEM.cjs +330 -0
- package/dist/chunks/redemption-service-7qbeQxEM.cjs.map +1 -0
- package/dist/chunks/redemption-service-BT0J5Iy7.js +327 -0
- package/dist/chunks/redemption-service-BT0J5Iy7.js.map +1 -0
- package/dist/chunks/tenant-service-Ba7xrWED.cjs +171 -0
- package/dist/chunks/tenant-service-Ba7xrWED.cjs.map +1 -0
- package/dist/chunks/tenant-service-DELk412y.js +168 -0
- package/dist/chunks/tenant-service-DELk412y.js.map +1 -0
- package/dist/chunks/token-service-BWScn8Qa.cjs +208 -0
- package/dist/chunks/token-service-BWScn8Qa.cjs.map +1 -0
- package/dist/chunks/token-service-CpVwC5Eb.js +205 -0
- package/dist/chunks/token-service-CpVwC5Eb.js.map +1 -0
- package/dist/chunks/user-service-D1Rn4U8u.cjs +153 -0
- package/dist/chunks/user-service-D1Rn4U8u.cjs.map +1 -0
- package/dist/chunks/user-service-D6mTa_WZ.js +150 -0
- package/dist/chunks/user-service-D6mTa_WZ.js.map +1 -0
- package/dist/chunks/{index-BfOoX87y.cjs → web3-chain-service-D75TcHkh.cjs} +28 -53
- package/dist/chunks/web3-chain-service-D75TcHkh.cjs.map +1 -0
- package/dist/chunks/{index-CM21r58m.js → web3-chain-service-Dp5Z8p9I.js} +28 -51
- package/dist/chunks/web3-chain-service-Dp5Z8p9I.js.map +1 -0
- package/dist/core/auth/api/auth-api.d.ts +11 -14
- package/dist/core/auth/api/auth-api.d.ts.map +1 -1
- package/dist/core/auth/auth-provider.interface.d.ts +36 -68
- package/dist/core/auth/auth-provider.interface.d.ts.map +1 -1
- package/dist/core/auth/default-auth-provider.d.ts +13 -59
- package/dist/core/auth/default-auth-provider.d.ts.map +1 -1
- package/dist/core/auth/index.d.ts +8 -14
- package/dist/core/auth/index.d.ts.map +1 -1
- package/dist/core/auth/refresh-manager.d.ts +15 -0
- package/dist/core/auth/refresh-manager.d.ts.map +1 -0
- package/dist/core/auth/services/auth-service.d.ts +15 -21
- package/dist/core/auth/services/auth-service.d.ts.map +1 -1
- package/dist/core/auth/token-storage.d.ts +26 -48
- package/dist/core/auth/token-storage.d.ts.map +1 -1
- package/dist/core/environment.d.ts +2 -4
- package/dist/core/environment.d.ts.map +1 -1
- package/dist/core/errors/index.d.ts +1 -5
- package/dist/core/errors/index.d.ts.map +1 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/pers-api-client.d.ts +14 -156
- package/dist/core/pers-api-client.d.ts.map +1 -1
- package/dist/core/pers-config.d.ts +13 -12
- package/dist/core/pers-config.d.ts.map +1 -1
- package/dist/core/utils/jwt.function.d.ts +9 -0
- package/dist/core/utils/jwt.function.d.ts.map +1 -1
- package/dist/core.cjs +22 -18
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +13 -14
- package/dist/core.js.map +1 -1
- package/dist/donation/index.d.ts +0 -15
- package/dist/donation/index.d.ts.map +1 -1
- package/dist/donation.cjs +5 -75
- package/dist/donation.cjs.map +1 -1
- package/dist/donation.js +1 -74
- package/dist/donation.js.map +1 -1
- package/dist/index.cjs +50 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -15
- package/dist/managers/analytics-manager.d.ts +290 -10
- package/dist/managers/analytics-manager.d.ts.map +1 -1
- package/dist/managers/auth-manager.d.ts +123 -23
- package/dist/managers/auth-manager.d.ts.map +1 -1
- package/dist/managers/business-manager.d.ts +273 -18
- package/dist/managers/business-manager.d.ts.map +1 -1
- package/dist/managers/campaign-manager.d.ts +585 -46
- package/dist/managers/campaign-manager.d.ts.map +1 -1
- package/dist/managers/donation-manager.d.ts +5 -5
- package/dist/managers/donation-manager.d.ts.map +1 -1
- package/dist/managers/file-manager.d.ts +430 -13
- package/dist/managers/file-manager.d.ts.map +1 -1
- package/dist/managers/purchase-manager.d.ts +340 -15
- package/dist/managers/purchase-manager.d.ts.map +1 -1
- package/dist/managers/redemption-manager.d.ts +450 -27
- package/dist/managers/redemption-manager.d.ts.map +1 -1
- package/dist/managers/tenant-manager.d.ts +5 -5
- package/dist/managers/tenant-manager.d.ts.map +1 -1
- package/dist/managers/token-manager.d.ts +245 -21
- package/dist/managers/token-manager.d.ts.map +1 -1
- package/dist/managers/transaction-manager.d.ts +447 -18
- package/dist/managers/transaction-manager.d.ts.map +1 -1
- package/dist/managers/user-manager.d.ts +216 -14
- package/dist/managers/user-manager.d.ts.map +1 -1
- package/dist/managers/web3-manager.d.ts +4 -4
- package/dist/managers/web3-manager.d.ts.map +1 -1
- package/dist/package.json +10 -4
- package/dist/payment/index.d.ts +0 -21
- package/dist/payment/index.d.ts.map +1 -1
- package/dist/payment.cjs +5 -255
- package/dist/payment.cjs.map +1 -1
- package/dist/payment.js +1 -254
- package/dist/payment.js.map +1 -1
- package/dist/pers-sdk.d.ts +141 -34
- package/dist/pers-sdk.d.ts.map +1 -1
- package/dist/redemption/index.d.ts +0 -25
- package/dist/redemption/index.d.ts.map +1 -1
- package/dist/redemption.cjs +5 -365
- package/dist/redemption.cjs.map +1 -1
- package/dist/redemption.js +1 -364
- package/dist/redemption.js.map +1 -1
- package/dist/tenant/index.d.ts +0 -22
- package/dist/tenant/index.d.ts.map +1 -1
- package/dist/tenant.cjs +5 -203
- package/dist/tenant.cjs.map +1 -1
- package/dist/tenant.js +1 -202
- package/dist/tenant.js.map +1 -1
- package/dist/token.cjs +6 -6
- package/dist/token.js +2 -2
- package/dist/transaction/index.d.ts +0 -22
- package/dist/transaction/index.d.ts.map +1 -1
- package/dist/transaction.cjs +0 -40
- package/dist/transaction.cjs.map +1 -1
- package/dist/transaction.js +1 -40
- package/dist/transaction.js.map +1 -1
- package/dist/user/index.d.ts +0 -25
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user.cjs +5 -185
- package/dist/user.cjs.map +1 -1
- package/dist/user.js +1 -184
- package/dist/user.js.map +1 -1
- package/dist/web3/index.d.ts +0 -11
- package/dist/web3/index.d.ts.map +1 -1
- package/dist/web3-chain/index.d.ts +0 -9
- package/dist/web3-chain/index.d.ts.map +1 -1
- package/dist/web3-chain/services/getWeb3FCD.service.d.ts.map +1 -1
- package/dist/web3-chain.cjs +5 -6
- package/dist/web3-chain.cjs.map +1 -1
- package/dist/web3-chain.js +2 -2
- package/dist/web3.cjs +6 -10
- package/dist/web3.cjs.map +1 -1
- package/dist/web3.js +1 -4
- package/dist/web3.js.map +1 -1
- package/package.json +10 -4
- package/dist/chunks/base-token-service-D0KANDgM.js +0 -139
- package/dist/chunks/base-token-service-D0KANDgM.js.map +0 -1
- package/dist/chunks/base-token-service-zNfPjHRx.cjs +0 -141
- package/dist/chunks/base-token-service-zNfPjHRx.cjs.map +0 -1
- package/dist/chunks/index-BfOoX87y.cjs.map +0 -1
- package/dist/chunks/index-CJ9Jfa4A.js.map +0 -1
- package/dist/chunks/index-CM21r58m.js.map +0 -1
- package/dist/chunks/index-CzEluQmf.cjs.map +0 -1
- package/dist/chunks/pers-sdk-DbPwFKrf.cjs +0 -3378
- package/dist/chunks/pers-sdk-DbPwFKrf.cjs.map +0 -1
- package/dist/chunks/pers-sdk-Z6MKeFBX.js +0 -3353
- package/dist/chunks/pers-sdk-Z6MKeFBX.js.map +0 -1
- package/dist/chunks/token-sdk-BW4kkJb3.js.map +0 -1
- package/dist/chunks/token-sdk-CiAbOb6c.cjs.map +0 -1
- package/dist/core/auth/auth-constants.d.ts +0 -33
- package/dist/core/auth/auth-constants.d.ts.map +0 -1
- package/dist/core/auth/auth-errors.d.ts +0 -8
- package/dist/core/auth/auth-errors.d.ts.map +0 -1
- package/dist/core/auth/create-auth-provider.d.ts +0 -27
- package/dist/core/auth/create-auth-provider.d.ts.map +0 -1
- package/dist/core/auth/token-refresh.d.ts +0 -91
- package/dist/core/auth/token-refresh.d.ts.map +0 -1
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PERS API Client -
|
|
2
|
+
* PERS API Client - Platform-agnostic HTTP client with authentication
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* proactive refresh, and comprehensive error handling.
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Automatic token refresh before expiry
|
|
9
|
-
* - Background refresh for optimal performance
|
|
10
|
-
* - Provider token fallback for seamless authentication
|
|
11
|
-
* - Configurable retry and timeout settings
|
|
12
|
-
* - Platform-agnostic design
|
|
4
|
+
* Features: automatic token refresh, background validation, configurable settings
|
|
13
5
|
*
|
|
14
6
|
* @example
|
|
15
7
|
* ```typescript
|
|
16
8
|
* const client = new PersApiClient(httpClient, {
|
|
17
9
|
* environment: 'production',
|
|
18
10
|
* apiProjectKey: 'your-project-key',
|
|
19
|
-
* authProvider:
|
|
20
|
-
* tokenProvider: () => getFirebaseToken()
|
|
21
|
-
* })
|
|
11
|
+
* authProvider: new DefaultAuthProvider()
|
|
22
12
|
* });
|
|
23
13
|
*
|
|
24
|
-
* // Make authenticated requests
|
|
25
14
|
* const data = await client.get('/users/me');
|
|
26
15
|
* ```
|
|
27
16
|
*/
|
|
28
17
|
import { HttpClient } from './abstractions/http-client';
|
|
29
18
|
import { PersConfig, mergeWithDefaults } from './pers-config';
|
|
30
|
-
import {
|
|
19
|
+
import { AuthService } from './auth/services/auth-service';
|
|
31
20
|
export declare class PersApiClient {
|
|
32
21
|
private httpClient;
|
|
33
22
|
private config;
|
|
@@ -35,6 +24,7 @@ export declare class PersApiClient {
|
|
|
35
24
|
private readonly mergedConfig;
|
|
36
25
|
private readonly authApi;
|
|
37
26
|
private readonly authService;
|
|
27
|
+
private readonly refreshManager;
|
|
38
28
|
/**
|
|
39
29
|
* Creates a new PERS API Client instance
|
|
40
30
|
*
|
|
@@ -45,26 +35,19 @@ export declare class PersApiClient {
|
|
|
45
35
|
/**
|
|
46
36
|
* Ensures valid authentication token before making requests
|
|
47
37
|
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
38
|
+
* Delegates to TokenRefreshManager for centralized token logic.
|
|
39
|
+
* Called without await for optimal performance - requests proceed immediately
|
|
40
|
+
* while token validation/refresh happens in background.
|
|
51
41
|
*
|
|
52
42
|
* @private
|
|
53
43
|
* @returns Promise that resolves when token validation is complete
|
|
54
44
|
*/
|
|
55
45
|
private ensureValidToken;
|
|
56
|
-
|
|
57
|
-
* Get request headers including auth token and project key
|
|
58
|
-
*/
|
|
59
|
-
private getHeaders;
|
|
46
|
+
private attemptInternalRefresh;
|
|
60
47
|
/**
|
|
61
48
|
* Make a request with proper headers, auth, and error handling
|
|
62
49
|
*/
|
|
63
50
|
private request;
|
|
64
|
-
/**
|
|
65
|
-
* Delegate token refresh to auth provider and handle the results
|
|
66
|
-
*/
|
|
67
|
-
private handleTokenRefreshDelegation;
|
|
68
51
|
/**
|
|
69
52
|
* Performs an authenticated GET request
|
|
70
53
|
*
|
|
@@ -82,18 +65,6 @@ export declare class PersApiClient {
|
|
|
82
65
|
get<T>(endpoint: string, responseType?: 'json' | 'blob' | 'text' | 'arraybuffer'): Promise<T>;
|
|
83
66
|
/**
|
|
84
67
|
* Performs an authenticated POST request
|
|
85
|
-
*
|
|
86
|
-
* @template T - Expected response type
|
|
87
|
-
* @param endpoint - API endpoint path (without base URL)
|
|
88
|
-
* @param body - Request payload data
|
|
89
|
-
* @param options - Request options including auth bypass
|
|
90
|
-
* @returns Promise resolving to typed response data
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* const user = await client.post<User>('/users', userData);
|
|
95
|
-
* const publicData = await client.post('/public/contact', formData, { bypassAuth: true });
|
|
96
|
-
* ```
|
|
97
68
|
*/
|
|
98
69
|
post<T>(endpoint: string, body?: unknown, options?: {
|
|
99
70
|
bypassAuth?: boolean;
|
|
@@ -107,128 +78,15 @@ export declare class PersApiClient {
|
|
|
107
78
|
*/
|
|
108
79
|
delete<T>(endpoint: string): Promise<T>;
|
|
109
80
|
/**
|
|
110
|
-
|
|
111
|
-
*/
|
|
112
|
-
private getHeadersWithoutAuth;
|
|
113
|
-
/**
|
|
114
|
-
* Authenticates an admin user using external JWT token
|
|
115
|
-
*
|
|
116
|
-
* Exchanges external provider token (Firebase, Auth0, etc.) for PERS access tokens.
|
|
117
|
-
* Automatically stores received tokens for subsequent requests.
|
|
81
|
+
* Get request headers with optional auth token and project key
|
|
118
82
|
*
|
|
119
|
-
* @param
|
|
120
|
-
* @returns Promise resolving to session context with admin permissions
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```typescript
|
|
124
|
-
* const firebaseToken = await getIdToken();
|
|
125
|
-
* const session = await client.loginAdmin(firebaseToken);
|
|
126
|
-
* console.log('Admin authenticated:', session.user.email);
|
|
127
|
-
* ```
|
|
83
|
+
* @param includeAuth - Whether to include the Authorization header (default: true)
|
|
128
84
|
*/
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Authenticates a regular user using external JWT token
|
|
132
|
-
*
|
|
133
|
-
* Exchanges external provider token for PERS access tokens with user-level permissions.
|
|
134
|
-
* Automatically stores received tokens for subsequent requests.
|
|
135
|
-
*
|
|
136
|
-
* @param externalJwt - JWT token from external authentication provider
|
|
137
|
-
* @returns Promise resolving to session context with user permissions
|
|
138
|
-
*
|
|
139
|
-
* @example
|
|
140
|
-
* ```typescript
|
|
141
|
-
* const firebaseToken = await getIdToken();
|
|
142
|
-
* const session = await client.loginUser(firebaseToken);
|
|
143
|
-
* console.log('User authenticated:', session.user.email);
|
|
144
|
-
* ```
|
|
145
|
-
*/
|
|
146
|
-
loginUser(externalJwt: string): Promise<SessionAuthContextResponseDTO>;
|
|
147
|
-
/**
|
|
148
|
-
* Authenticates a user using raw login data (no external JWT)
|
|
149
|
-
*
|
|
150
|
-
* Useful for custom authentication flows where user data is provided directly.
|
|
151
|
-
* Automatically stores received tokens for subsequent requests.
|
|
152
|
-
*
|
|
153
|
-
* @param rawLoginData - Object containing user login data (email, name, etc.)
|
|
154
|
-
* @return Promise resolving to session context with user permissions
|
|
155
|
-
*/
|
|
156
|
-
loginUserWithRawData(rawLoginData: {
|
|
157
|
-
externalId?: string | undefined;
|
|
158
|
-
email?: string | undefined;
|
|
159
|
-
firstName?: string | undefined;
|
|
160
|
-
lastName?: string | undefined;
|
|
161
|
-
customData?: Record<string, any> | undefined;
|
|
162
|
-
}): Promise<SessionAuthContextResponseDTO>;
|
|
163
|
-
/**
|
|
164
|
-
* Checks if current user has a valid authentication token
|
|
165
|
-
*
|
|
166
|
-
* Performs basic token availability check without network requests.
|
|
167
|
-
* For comprehensive validation including expiry, use isTokenExpired().
|
|
168
|
-
*
|
|
169
|
-
* @returns True if valid token exists, false otherwise
|
|
170
|
-
*
|
|
171
|
-
* @example
|
|
172
|
-
* ```typescript
|
|
173
|
-
* if (client.hasValidAuth()) {
|
|
174
|
-
* // User is authenticated, proceed with API calls
|
|
175
|
-
* const data = await client.get('/protected-data');
|
|
176
|
-
* } else {
|
|
177
|
-
* // Redirect to login
|
|
178
|
-
* redirectToLogin();
|
|
179
|
-
* }
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
hasValidAuth(): boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Checks if current access token is expired or expiring soon
|
|
185
|
-
*
|
|
186
|
-
* @param marginSeconds - Seconds before expiry to consider token as expired (default: 60)
|
|
187
|
-
* @returns Promise resolving to true if token is expired/expiring, false if valid
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* ```typescript
|
|
191
|
-
* if (await client.isTokenExpired(120)) {
|
|
192
|
-
* console.log('Token expires within 2 minutes');
|
|
193
|
-
* // Optionally trigger manual refresh
|
|
194
|
-
* }
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
isTokenExpired(marginSeconds?: number): Promise<boolean>;
|
|
198
|
-
/**
|
|
199
|
-
* Checks if both access and refresh tokens are expired
|
|
200
|
-
*
|
|
201
|
-
* Useful for determining if full re-authentication is required.
|
|
202
|
-
*
|
|
203
|
-
* @param marginSeconds - Seconds before expiry to consider tokens as expired (default: 60)
|
|
204
|
-
* @returns Promise resolving to true if both tokens expired, false otherwise
|
|
205
|
-
*
|
|
206
|
-
* @example
|
|
207
|
-
* ```typescript
|
|
208
|
-
* if (await client.areAllTokensExpired()) {
|
|
209
|
-
* // Full re-authentication required
|
|
210
|
-
* await redirectToLogin();
|
|
211
|
-
* }
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
areAllTokensExpired(marginSeconds?: number): Promise<boolean>;
|
|
85
|
+
private getHeaders;
|
|
215
86
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
* @param refreshToken - Optional refresh token, uses stored token if not provided
|
|
219
|
-
* @returns Promise resolving to new auth tokens
|
|
220
|
-
*
|
|
221
|
-
* @example
|
|
222
|
-
* ```typescript
|
|
223
|
-
* try {
|
|
224
|
-
* const tokens = await client.refreshTokens();
|
|
225
|
-
* console.log('Tokens refreshed successfully');
|
|
226
|
-
* } catch (error) {
|
|
227
|
-
* console.error('Token refresh failed:', error);
|
|
228
|
-
* }
|
|
229
|
-
* ```
|
|
87
|
+
* @internal - For AuthManager use only
|
|
230
88
|
*/
|
|
231
|
-
|
|
89
|
+
getAuthService(): AuthService;
|
|
232
90
|
/**
|
|
233
91
|
* Get current configuration (returns merged config)
|
|
234
92
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pers-api-client.d.ts","sourceRoot":"","sources":["../../src/core/pers-api-client.ts"],"names":[],"mappings":"AACA
|
|
1
|
+
{"version":3,"file":"pers-api-client.d.ts","sourceRoot":"","sources":["../../src/core/pers-api-client.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAkB,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,UAAU,EAAgB,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE5E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAY3D,qBAAa,aAAa;IActB,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IAdhB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAuC;IACpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAErD;;;;;OAKG;gBAEO,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,UAAU;IA6B5B;;;;;;;;;OASG;YACW,gBAAgB;YAKhB,sBAAsB;IAIpC;;OAEG;YACW,OAAO;IA8FrB;;;;;;;;;;;;;OAaG;IACG,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;IAInG;;OAEG;IACG,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAI/F;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D;;OAEG;IACG,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAI7C;;;;OAIG;YACW,UAAU;IAqCxB;;OAEG;IACH,cAAc,IAAI,WAAW;IAI7B;;OAEG;IACH,SAAS,IAAI,UAAU,CAAC,OAAO,iBAAiB,CAAC;IAIjD;;OAEG;IACH,iBAAiB,IAAI,UAAU;CAGhC"}
|
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
* Provides type-safe configuration options for the PERS SDK
|
|
5
5
|
* with sensible defaults for production environments.
|
|
6
6
|
*/
|
|
7
|
-
import { PersAuthProvider } from './auth/auth-provider.interface';
|
|
8
|
-
|
|
9
|
-
export type PersEnvironment = 'development' | 'staging' | 'production';
|
|
10
|
-
/** Supported PERS API versions */
|
|
11
|
-
export type PersApiVersion = 'v1' | 'v1.8' | 'v1.9' | 'v2';
|
|
7
|
+
import { PersAuthProvider, AuthType } from './auth/auth-provider.interface';
|
|
8
|
+
import type { TokenStorage } from './auth/token-storage';
|
|
12
9
|
/**
|
|
13
10
|
* PERS SDK Configuration
|
|
14
11
|
*
|
|
@@ -18,7 +15,7 @@ export type PersApiVersion = 'v1' | 'v1.8' | 'v1.9' | 'v2';
|
|
|
18
15
|
* environment: 'production',
|
|
19
16
|
* apiProjectKey: 'your-project-key',
|
|
20
17
|
* apiVersion: 'v2',
|
|
21
|
-
* authProvider:
|
|
18
|
+
* authProvider: new DefaultAuthProvider({
|
|
22
19
|
* tokenProvider: () => getFirebaseToken()
|
|
23
20
|
* }),
|
|
24
21
|
* tokenRefreshMargin: 120,
|
|
@@ -28,16 +25,20 @@ export type PersApiVersion = 'v1' | 'v1.8' | 'v1.9' | 'v2';
|
|
|
28
25
|
*/
|
|
29
26
|
export interface PersConfig {
|
|
30
27
|
/** Target environment (default: 'production') */
|
|
31
|
-
environment?:
|
|
28
|
+
environment?: 'development' | 'staging' | 'production';
|
|
32
29
|
/** Project key for API authentication */
|
|
33
30
|
apiProjectKey?: string;
|
|
34
31
|
/** API version to use (default: 'v2') */
|
|
35
|
-
apiVersion?:
|
|
32
|
+
apiVersion?: 'v2';
|
|
36
33
|
/** Request timeout in milliseconds (default: 30000) */
|
|
37
34
|
timeout?: number;
|
|
38
35
|
/** Number of retry attempts (default: 3) */
|
|
39
36
|
retries?: number;
|
|
40
|
-
/** Authentication provider
|
|
37
|
+
/** Authentication type for auto-created provider (default: 'user') */
|
|
38
|
+
authType?: AuthType;
|
|
39
|
+
/** Custom token storage for auto-created provider */
|
|
40
|
+
authStorage?: TokenStorage;
|
|
41
|
+
/** Authentication provider instance (overrides authType if provided) */
|
|
41
42
|
authProvider?: PersAuthProvider;
|
|
42
43
|
/** Seconds before expiry to refresh token proactively (default: 60) */
|
|
43
44
|
tokenRefreshMargin?: number;
|
|
@@ -54,8 +55,8 @@ export interface PersAuthConfig {
|
|
|
54
55
|
* Default configuration values
|
|
55
56
|
*/
|
|
56
57
|
export declare const DEFAULT_PERS_CONFIG: {
|
|
57
|
-
readonly environment:
|
|
58
|
-
readonly apiVersion:
|
|
58
|
+
readonly environment: "production";
|
|
59
|
+
readonly apiVersion: "v2";
|
|
59
60
|
readonly timeout: 30000;
|
|
60
61
|
readonly retries: 3;
|
|
61
62
|
readonly tokenRefreshMargin: 60;
|
|
@@ -65,7 +66,7 @@ export declare const DEFAULT_PERS_CONFIG: {
|
|
|
65
66
|
* Internal function to construct API root from environment
|
|
66
67
|
* Now defaults to production and v2
|
|
67
68
|
*/
|
|
68
|
-
export declare function buildApiRoot(environment?:
|
|
69
|
+
export declare function buildApiRoot(environment?: 'development' | 'staging' | 'production', version?: 'v2'): string;
|
|
69
70
|
/**
|
|
70
71
|
* Merge user config with defaults
|
|
71
72
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pers-config.d.ts","sourceRoot":"","sources":["../../src/core/pers-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"pers-config.d.ts","sourceRoot":"","sources":["../../src/core/pers-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQzD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,WAAW,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC;IAEvD,yCAAyC;IACzC,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,yCAAyC;IACzC,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,qDAAqD;IACrD,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B,wEAAwE;IACxE,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAEhC,uEAAuE;IACvE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,yEAAyE;IACzE,0BAA0B,CAAC,EAAE,MAAM,CAAC;IAEpC,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,UAAU,GAAG,KAAK,GAAG,MAAM,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;CAOtB,CAAC;AAEX;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,WAAW,GAAE,aAAa,GAAG,SAAS,GAAG,YAA2B,EACpE,OAAO,GAAE,IAAW,GACnB,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC,CAAC,CASnJ"}
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JWT token expiration utilities
|
|
3
|
+
* Native implementation without external dependencies for optimal performance
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Check if JWT token is expired or expiring within margin
|
|
7
|
+
* @param token JWT token (with or without Bearer prefix)
|
|
8
|
+
* @param margin Safety margin in seconds before expiry (default: 60)
|
|
9
|
+
*/
|
|
1
10
|
export declare const isTokenExpired: (token: string, margin?: number) => boolean;
|
|
2
11
|
//# sourceMappingURL=jwt.function.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.function.d.ts","sourceRoot":"","sources":["../../../src/core/utils/jwt.function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt.function.d.ts","sourceRoot":"","sources":["../../../src/core/utils/jwt.function.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,WAAU,MAAM,KAAQ,OAgBnE,CAAC"}
|
package/dist/core.cjs
CHANGED
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persSdk = require('./chunks/pers-sdk-
|
|
4
|
-
var web3 = require('./chunks/index-CzEluQmf.cjs');
|
|
3
|
+
var persSdk = require('./chunks/pers-sdk-CmyPEhy7.cjs');
|
|
5
4
|
require('@explorins/pers-shared');
|
|
6
|
-
require('./
|
|
5
|
+
require('./chunks/web3-chain-service-D75TcHkh.cjs');
|
|
6
|
+
require('@explorins/web3-ts/ethers');
|
|
7
|
+
require('./chunks/user-service-D1Rn4U8u.cjs');
|
|
7
8
|
require('./user-status.cjs');
|
|
8
|
-
require('./chunks/token-
|
|
9
|
-
require('./business.cjs');
|
|
10
|
-
require('./campaign.cjs');
|
|
11
|
-
require('./redemption.cjs');
|
|
9
|
+
require('./chunks/token-service-BWScn8Qa.cjs');
|
|
10
|
+
require('./chunks/business-service-Cq3-oksM.cjs');
|
|
11
|
+
require('./chunks/campaign-service-CWK9I388.cjs');
|
|
12
|
+
require('./chunks/redemption-service-7qbeQxEM.cjs');
|
|
12
13
|
require('./transaction.cjs');
|
|
13
|
-
require('./payment.cjs');
|
|
14
|
-
require('./tenant.cjs');
|
|
15
|
-
require('./analytics.cjs');
|
|
16
|
-
require('./donation.cjs');
|
|
17
|
-
require('./chunks/
|
|
18
|
-
require('jwt-decode');
|
|
19
|
-
require('@explorins/web3-ts/ethers');
|
|
14
|
+
require('./chunks/payment-service-B4qx0qiE.cjs');
|
|
15
|
+
require('./chunks/tenant-service-Ba7xrWED.cjs');
|
|
16
|
+
require('./chunks/analytics-service-CitlimKJ.cjs');
|
|
17
|
+
require('./chunks/donation-service-D-xFrONi.cjs');
|
|
18
|
+
require('./chunks/explorer.utils-GpskbLl1.cjs');
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
exports.AnalyticsManager = persSdk.AnalyticsManager;
|
|
23
|
+
exports.AuthApi = persSdk.AuthApi;
|
|
24
24
|
exports.AuthManager = persSdk.AuthManager;
|
|
25
|
+
exports.AuthService = persSdk.AuthService;
|
|
26
|
+
exports.AuthTokenManager = persSdk.AuthTokenManager;
|
|
25
27
|
exports.BusinessManager = persSdk.BusinessManager;
|
|
26
28
|
exports.CampaignManager = persSdk.CampaignManager;
|
|
27
29
|
exports.DEFAULT_PERS_CONFIG = persSdk.DEFAULT_PERS_CONFIG;
|
|
30
|
+
exports.DefaultAuthProvider = persSdk.DefaultAuthProvider;
|
|
28
31
|
exports.DonationManager = persSdk.DonationManager;
|
|
29
32
|
exports.FileManager = persSdk.FileManager;
|
|
33
|
+
exports.LocalStorageTokenStorage = persSdk.LocalStorageTokenStorage;
|
|
34
|
+
exports.MemoryTokenStorage = persSdk.MemoryTokenStorage;
|
|
30
35
|
exports.PersApiClient = persSdk.PersApiClient;
|
|
31
36
|
exports.PersSDK = persSdk.PersSDK;
|
|
32
37
|
exports.PurchaseManager = persSdk.PurchaseManager;
|
|
@@ -38,10 +43,9 @@ exports.UserManager = persSdk.UserManager;
|
|
|
38
43
|
exports.UserStatusManager = persSdk.UserStatusManager;
|
|
39
44
|
exports.Web3Manager = persSdk.Web3Manager;
|
|
40
45
|
exports.buildApiRoot = persSdk.buildApiRoot;
|
|
41
|
-
exports.createAuthProvider = persSdk.createAuthProvider;
|
|
42
46
|
exports.createPersSDK = persSdk.createPersSDK;
|
|
47
|
+
exports.detectEnvironment = persSdk.detectEnvironment;
|
|
48
|
+
exports.environment = persSdk.environment;
|
|
43
49
|
exports.mergeWithDefaults = persSdk.mergeWithDefaults;
|
|
44
|
-
exports.
|
|
45
|
-
exports.environment = web3.environment;
|
|
46
|
-
exports.warnIfProblematicEnvironment = web3.warnIfProblematicEnvironment;
|
|
50
|
+
exports.warnIfProblematicEnvironment = persSdk.warnIfProblematicEnvironment;
|
|
47
51
|
//# sourceMappingURL=core.cjs.map
|
package/dist/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/core.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { d as detectEnvironment, e as environment, w as warnIfProblematicEnvironment } from './chunks/index-CJ9Jfa4A.js';
|
|
1
|
+
export { o as AnalyticsManager, g as AuthApi, i as AuthManager, h as AuthService, A as AuthTokenManager, B as BusinessManager, C as CampaignManager, b as DEFAULT_PERS_CONFIG, D as DefaultAuthProvider, p as DonationManager, F as FileManager, L as LocalStorageTokenStorage, M as MemoryTokenStorage, a as PersApiClient, P as PersSDK, l as PurchaseManager, R as RedemptionManager, n as TenantManager, T as TokenManager, k as TransactionManager, U as UserManager, j as UserStatusManager, W as Web3Manager, d as buildApiRoot, c as createPersSDK, e as detectEnvironment, f as environment, m as mergeWithDefaults, w as warnIfProblematicEnvironment } from './chunks/pers-sdk-Bd6BZHgt.js';
|
|
3
2
|
import '@explorins/pers-shared';
|
|
4
|
-
import './
|
|
3
|
+
import './chunks/web3-chain-service-Dp5Z8p9I.js';
|
|
4
|
+
import '@explorins/web3-ts/ethers';
|
|
5
|
+
import './chunks/user-service-D6mTa_WZ.js';
|
|
5
6
|
import './user-status.js';
|
|
6
|
-
import './chunks/token-
|
|
7
|
-
import './business.js';
|
|
8
|
-
import './campaign.js';
|
|
9
|
-
import './redemption.js';
|
|
7
|
+
import './chunks/token-service-CpVwC5Eb.js';
|
|
8
|
+
import './chunks/business-service-DrC-TNGa.js';
|
|
9
|
+
import './chunks/campaign-service-Dd7gMjC9.js';
|
|
10
|
+
import './chunks/redemption-service-BT0J5Iy7.js';
|
|
10
11
|
import './transaction.js';
|
|
11
|
-
import './payment.js';
|
|
12
|
-
import './tenant.js';
|
|
13
|
-
import './analytics.js';
|
|
14
|
-
import './donation.js';
|
|
15
|
-
import './chunks/
|
|
16
|
-
import 'jwt-decode';
|
|
17
|
-
import '@explorins/web3-ts/ethers';
|
|
12
|
+
import './chunks/payment-service-DfCBFosx.js';
|
|
13
|
+
import './chunks/tenant-service-DELk412y.js';
|
|
14
|
+
import './chunks/analytics-service-CxyrOwel.js';
|
|
15
|
+
import './chunks/donation-service-CyJS4DIZ.js';
|
|
16
|
+
import './chunks/explorer.utils-Ckll15ja.js';
|
|
18
17
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/dist/donation/index.d.ts
CHANGED
|
@@ -7,19 +7,4 @@
|
|
|
7
7
|
export { DonationApi } from './api/donation-api';
|
|
8
8
|
export { DonationService } from './services/donation-service';
|
|
9
9
|
export * from '../shared/interfaces/pers-shared-lib.interfaces';
|
|
10
|
-
import { PersApiClient } from '../core/pers-api-client';
|
|
11
|
-
import { DonationApi } from './api/donation-api';
|
|
12
|
-
import { DonationService } from './services/donation-service';
|
|
13
|
-
/**
|
|
14
|
-
* Create a complete Donation SDK instance
|
|
15
|
-
*
|
|
16
|
-
* @param apiClient - Configured PERS API client
|
|
17
|
-
* @returns Donation SDK with flattened structure for better DX
|
|
18
|
-
*/
|
|
19
|
-
export declare function createDonationSDK(apiClient: PersApiClient): {
|
|
20
|
-
getAllDonationTypes: () => Promise<import("@explorins/pers-shared").DonationTypeDTO[]>;
|
|
21
|
-
api: DonationApi;
|
|
22
|
-
service: DonationService;
|
|
23
|
-
};
|
|
24
|
-
export type DonationSDK = ReturnType<typeof createDonationSDK>;
|
|
25
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/donation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,cAAc,iDAAiD,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/donation/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,cAAc,iDAAiD,CAAC"}
|
package/dist/donation.cjs
CHANGED
|
@@ -1,84 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var donationService = require('./chunks/donation-service-D-xFrONi.cjs');
|
|
3
4
|
var persShared = require('@explorins/pers-shared');
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Platform-Agnostic Donation API Client
|
|
7
|
-
*
|
|
8
|
-
* Handles donation operations using the PERS backend.
|
|
9
|
-
* Matches framework DonationApiService methods exactly.
|
|
10
|
-
*/
|
|
11
|
-
class DonationApi {
|
|
12
|
-
constructor(apiClient) {
|
|
13
|
-
this.apiClient = apiClient;
|
|
14
|
-
}
|
|
15
|
-
// ==========================================
|
|
16
|
-
// PUBLIC OPERATIONS
|
|
17
|
-
// ==========================================
|
|
18
|
-
/**
|
|
19
|
-
* PUBLIC: Get all donation types
|
|
20
|
-
* ✅ ONLY method actually used by framework
|
|
21
|
-
*/
|
|
22
|
-
async getAllDonationTypes() {
|
|
23
|
-
return this.apiClient.get('/purchases/donation-types');
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
6
|
|
|
27
|
-
/**
|
|
28
|
-
* Platform-Agnostic Donation Service
|
|
29
|
-
*
|
|
30
|
-
* Contains donation business logic and operations that work across platforms.
|
|
31
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
32
|
-
* Matches framework DonationApiService capabilities exactly.
|
|
33
|
-
*/
|
|
34
|
-
class DonationService {
|
|
35
|
-
constructor(donationApi) {
|
|
36
|
-
this.donationApi = donationApi;
|
|
37
|
-
}
|
|
38
|
-
// ==========================================
|
|
39
|
-
// PUBLIC OPERATIONS
|
|
40
|
-
// ==========================================
|
|
41
|
-
/**
|
|
42
|
-
* PUBLIC: Get all donation types
|
|
43
|
-
* ✅ ONLY method actually used by framework
|
|
44
|
-
*/
|
|
45
|
-
async getAllDonationTypes() {
|
|
46
|
-
return this.donationApi.getAllDonationTypes();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @explorins/pers-sdk-donation
|
|
52
|
-
*
|
|
53
|
-
* Platform-agnostic Donation Domain SDK for PERS ecosystem
|
|
54
|
-
* Handles donation type retrieval for purchase flow integration
|
|
55
|
-
*/
|
|
56
|
-
// API Layer
|
|
57
|
-
/**
|
|
58
|
-
* Create a complete Donation SDK instance
|
|
59
|
-
*
|
|
60
|
-
* @param apiClient - Configured PERS API client
|
|
61
|
-
* @returns Donation SDK with flattened structure for better DX
|
|
62
|
-
*/
|
|
63
|
-
function createDonationSDK(apiClient) {
|
|
64
|
-
const donationApi = new DonationApi(apiClient);
|
|
65
|
-
const donationService = new DonationService(donationApi);
|
|
66
|
-
return {
|
|
67
|
-
// Direct access to service methods (primary interface)
|
|
68
|
-
// ✅ FRAMEWORK ALIGNED: Only method actually used by framework
|
|
69
|
-
// Public methods
|
|
70
|
-
getAllDonationTypes: () => donationService.getAllDonationTypes(),
|
|
71
|
-
// Advanced access for edge cases
|
|
72
|
-
api: donationApi,
|
|
73
|
-
service: donationService
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
7
|
|
|
8
|
+
exports.DonationApi = donationService.DonationApi;
|
|
9
|
+
exports.DonationService = donationService.DonationService;
|
|
77
10
|
Object.defineProperty(exports, "AccountOwnerType", {
|
|
78
|
-
|
|
79
|
-
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return persShared.AccountOwnerType; }
|
|
80
13
|
});
|
|
81
|
-
exports.DonationApi = DonationApi;
|
|
82
|
-
exports.DonationService = DonationService;
|
|
83
|
-
exports.createDonationSDK = createDonationSDK;
|
|
84
14
|
//# sourceMappingURL=donation.cjs.map
|
package/dist/donation.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donation.cjs","sources":[
|
|
1
|
+
{"version":3,"file":"donation.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
package/dist/donation.js
CHANGED
|
@@ -1,76 +1,3 @@
|
|
|
1
|
+
export { D as DonationApi, a as DonationService } from './chunks/donation-service-CyJS4DIZ.js';
|
|
1
2
|
export { AccountOwnerType } from '@explorins/pers-shared';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Platform-Agnostic Donation API Client
|
|
5
|
-
*
|
|
6
|
-
* Handles donation operations using the PERS backend.
|
|
7
|
-
* Matches framework DonationApiService methods exactly.
|
|
8
|
-
*/
|
|
9
|
-
class DonationApi {
|
|
10
|
-
constructor(apiClient) {
|
|
11
|
-
this.apiClient = apiClient;
|
|
12
|
-
}
|
|
13
|
-
// ==========================================
|
|
14
|
-
// PUBLIC OPERATIONS
|
|
15
|
-
// ==========================================
|
|
16
|
-
/**
|
|
17
|
-
* PUBLIC: Get all donation types
|
|
18
|
-
* ✅ ONLY method actually used by framework
|
|
19
|
-
*/
|
|
20
|
-
async getAllDonationTypes() {
|
|
21
|
-
return this.apiClient.get('/purchases/donation-types');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Platform-Agnostic Donation Service
|
|
27
|
-
*
|
|
28
|
-
* Contains donation business logic and operations that work across platforms.
|
|
29
|
-
* No framework dependencies - pure TypeScript business logic.
|
|
30
|
-
* Matches framework DonationApiService capabilities exactly.
|
|
31
|
-
*/
|
|
32
|
-
class DonationService {
|
|
33
|
-
constructor(donationApi) {
|
|
34
|
-
this.donationApi = donationApi;
|
|
35
|
-
}
|
|
36
|
-
// ==========================================
|
|
37
|
-
// PUBLIC OPERATIONS
|
|
38
|
-
// ==========================================
|
|
39
|
-
/**
|
|
40
|
-
* PUBLIC: Get all donation types
|
|
41
|
-
* ✅ ONLY method actually used by framework
|
|
42
|
-
*/
|
|
43
|
-
async getAllDonationTypes() {
|
|
44
|
-
return this.donationApi.getAllDonationTypes();
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @explorins/pers-sdk-donation
|
|
50
|
-
*
|
|
51
|
-
* Platform-agnostic Donation Domain SDK for PERS ecosystem
|
|
52
|
-
* Handles donation type retrieval for purchase flow integration
|
|
53
|
-
*/
|
|
54
|
-
// API Layer
|
|
55
|
-
/**
|
|
56
|
-
* Create a complete Donation SDK instance
|
|
57
|
-
*
|
|
58
|
-
* @param apiClient - Configured PERS API client
|
|
59
|
-
* @returns Donation SDK with flattened structure for better DX
|
|
60
|
-
*/
|
|
61
|
-
function createDonationSDK(apiClient) {
|
|
62
|
-
const donationApi = new DonationApi(apiClient);
|
|
63
|
-
const donationService = new DonationService(donationApi);
|
|
64
|
-
return {
|
|
65
|
-
// Direct access to service methods (primary interface)
|
|
66
|
-
// ✅ FRAMEWORK ALIGNED: Only method actually used by framework
|
|
67
|
-
// Public methods
|
|
68
|
-
getAllDonationTypes: () => donationService.getAllDonationTypes(),
|
|
69
|
-
// Advanced access for edge cases
|
|
70
|
-
api: donationApi,
|
|
71
|
-
service: donationService
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { DonationApi, DonationService, createDonationSDK };
|
|
76
3
|
//# sourceMappingURL=donation.js.map
|
package/dist/donation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"donation.js","sources":[
|
|
1
|
+
{"version":3,"file":"donation.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|