@stackbe/sdk 0.15.3 → 0.15.4
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/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +32 -3
- package/dist/index.mjs +32 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2415,6 +2415,15 @@ interface PartnerApplicationResponse {
|
|
|
2415
2415
|
status: 'pending';
|
|
2416
2416
|
message: string;
|
|
2417
2417
|
}
|
|
2418
|
+
interface ApplicationStatusResponse {
|
|
2419
|
+
applied: boolean;
|
|
2420
|
+
id?: string;
|
|
2421
|
+
status?: 'pending' | 'approved' | 'rejected';
|
|
2422
|
+
rejectionReason?: string | null;
|
|
2423
|
+
createdAt?: string;
|
|
2424
|
+
reviewedAt?: string | null;
|
|
2425
|
+
affiliateId?: string | null;
|
|
2426
|
+
}
|
|
2418
2427
|
interface EnrollOptions {
|
|
2419
2428
|
/** Preferred referral code (auto-generated if not provided) */
|
|
2420
2429
|
code?: string;
|
|
@@ -2445,10 +2454,21 @@ declare class AffiliatesClient {
|
|
|
2445
2454
|
private http;
|
|
2446
2455
|
constructor(http: HttpClient);
|
|
2447
2456
|
/**
|
|
2448
|
-
* Get
|
|
2449
|
-
*
|
|
2457
|
+
* Get affiliate info for a customer.
|
|
2458
|
+
*
|
|
2459
|
+
* - With customer session token: returns info for the authenticated customer.
|
|
2460
|
+
* - With API key + customerId: server-side lookup (no session token needed).
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* // Client-side (with session token)
|
|
2465
|
+
* const info = await stackbe.affiliates.get();
|
|
2466
|
+
*
|
|
2467
|
+
* // Server-side (with API key)
|
|
2468
|
+
* const info = await stackbe.affiliates.get('cust_123');
|
|
2469
|
+
* ```
|
|
2450
2470
|
*/
|
|
2451
|
-
get(): Promise<AffiliateInfo>;
|
|
2471
|
+
get(customerId?: string): Promise<AffiliateInfo>;
|
|
2452
2472
|
/**
|
|
2453
2473
|
* Enroll the current customer as an affiliate/partner.
|
|
2454
2474
|
* Requires customer session token.
|
|
@@ -2487,6 +2507,19 @@ declare class AffiliatesClient {
|
|
|
2487
2507
|
* ```
|
|
2488
2508
|
*/
|
|
2489
2509
|
apply(options: PartnerApplicationOptions): Promise<PartnerApplicationResponse>;
|
|
2510
|
+
/**
|
|
2511
|
+
* Check the status of a partner application by email.
|
|
2512
|
+
* Requires API key only (no account needed).
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* ```typescript
|
|
2516
|
+
* const status = await stackbe.affiliates.getApplicationStatus('partner@example.com');
|
|
2517
|
+
* if (status.applied && status.status === 'approved') {
|
|
2518
|
+
* console.log('Application approved!');
|
|
2519
|
+
* }
|
|
2520
|
+
* ```
|
|
2521
|
+
*/
|
|
2522
|
+
getApplicationStatus(email: string): Promise<ApplicationStatusResponse>;
|
|
2490
2523
|
/**
|
|
2491
2524
|
* Track a referral click (store token for attribution).
|
|
2492
2525
|
* Requires API key.
|
package/dist/index.d.ts
CHANGED
|
@@ -2415,6 +2415,15 @@ interface PartnerApplicationResponse {
|
|
|
2415
2415
|
status: 'pending';
|
|
2416
2416
|
message: string;
|
|
2417
2417
|
}
|
|
2418
|
+
interface ApplicationStatusResponse {
|
|
2419
|
+
applied: boolean;
|
|
2420
|
+
id?: string;
|
|
2421
|
+
status?: 'pending' | 'approved' | 'rejected';
|
|
2422
|
+
rejectionReason?: string | null;
|
|
2423
|
+
createdAt?: string;
|
|
2424
|
+
reviewedAt?: string | null;
|
|
2425
|
+
affiliateId?: string | null;
|
|
2426
|
+
}
|
|
2418
2427
|
interface EnrollOptions {
|
|
2419
2428
|
/** Preferred referral code (auto-generated if not provided) */
|
|
2420
2429
|
code?: string;
|
|
@@ -2445,10 +2454,21 @@ declare class AffiliatesClient {
|
|
|
2445
2454
|
private http;
|
|
2446
2455
|
constructor(http: HttpClient);
|
|
2447
2456
|
/**
|
|
2448
|
-
* Get
|
|
2449
|
-
*
|
|
2457
|
+
* Get affiliate info for a customer.
|
|
2458
|
+
*
|
|
2459
|
+
* - With customer session token: returns info for the authenticated customer.
|
|
2460
|
+
* - With API key + customerId: server-side lookup (no session token needed).
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* // Client-side (with session token)
|
|
2465
|
+
* const info = await stackbe.affiliates.get();
|
|
2466
|
+
*
|
|
2467
|
+
* // Server-side (with API key)
|
|
2468
|
+
* const info = await stackbe.affiliates.get('cust_123');
|
|
2469
|
+
* ```
|
|
2450
2470
|
*/
|
|
2451
|
-
get(): Promise<AffiliateInfo>;
|
|
2471
|
+
get(customerId?: string): Promise<AffiliateInfo>;
|
|
2452
2472
|
/**
|
|
2453
2473
|
* Enroll the current customer as an affiliate/partner.
|
|
2454
2474
|
* Requires customer session token.
|
|
@@ -2487,6 +2507,19 @@ declare class AffiliatesClient {
|
|
|
2487
2507
|
* ```
|
|
2488
2508
|
*/
|
|
2489
2509
|
apply(options: PartnerApplicationOptions): Promise<PartnerApplicationResponse>;
|
|
2510
|
+
/**
|
|
2511
|
+
* Check the status of a partner application by email.
|
|
2512
|
+
* Requires API key only (no account needed).
|
|
2513
|
+
*
|
|
2514
|
+
* @example
|
|
2515
|
+
* ```typescript
|
|
2516
|
+
* const status = await stackbe.affiliates.getApplicationStatus('partner@example.com');
|
|
2517
|
+
* if (status.applied && status.status === 'approved') {
|
|
2518
|
+
* console.log('Application approved!');
|
|
2519
|
+
* }
|
|
2520
|
+
* ```
|
|
2521
|
+
*/
|
|
2522
|
+
getApplicationStatus(email: string): Promise<ApplicationStatusResponse>;
|
|
2490
2523
|
/**
|
|
2491
2524
|
* Track a referral click (store token for attribution).
|
|
2492
2525
|
* Requires API key.
|
package/dist/index.js
CHANGED
|
@@ -2258,10 +2258,24 @@ var AffiliatesClient = class {
|
|
|
2258
2258
|
this.http = http;
|
|
2259
2259
|
}
|
|
2260
2260
|
/**
|
|
2261
|
-
* Get
|
|
2262
|
-
*
|
|
2261
|
+
* Get affiliate info for a customer.
|
|
2262
|
+
*
|
|
2263
|
+
* - With customer session token: returns info for the authenticated customer.
|
|
2264
|
+
* - With API key + customerId: server-side lookup (no session token needed).
|
|
2265
|
+
*
|
|
2266
|
+
* @example
|
|
2267
|
+
* ```typescript
|
|
2268
|
+
* // Client-side (with session token)
|
|
2269
|
+
* const info = await stackbe.affiliates.get();
|
|
2270
|
+
*
|
|
2271
|
+
* // Server-side (with API key)
|
|
2272
|
+
* const info = await stackbe.affiliates.get('cust_123');
|
|
2273
|
+
* ```
|
|
2263
2274
|
*/
|
|
2264
|
-
async get() {
|
|
2275
|
+
async get(customerId) {
|
|
2276
|
+
if (customerId) {
|
|
2277
|
+
return this.http.get(`/v1/affiliate/by-customer/${customerId}`);
|
|
2278
|
+
}
|
|
2265
2279
|
return this.http.get("/v1/affiliate");
|
|
2266
2280
|
}
|
|
2267
2281
|
/**
|
|
@@ -2310,6 +2324,21 @@ var AffiliatesClient = class {
|
|
|
2310
2324
|
async apply(options) {
|
|
2311
2325
|
return this.http.post("/v1/affiliate/apply", options);
|
|
2312
2326
|
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Check the status of a partner application by email.
|
|
2329
|
+
* Requires API key only (no account needed).
|
|
2330
|
+
*
|
|
2331
|
+
* @example
|
|
2332
|
+
* ```typescript
|
|
2333
|
+
* const status = await stackbe.affiliates.getApplicationStatus('partner@example.com');
|
|
2334
|
+
* if (status.applied && status.status === 'approved') {
|
|
2335
|
+
* console.log('Application approved!');
|
|
2336
|
+
* }
|
|
2337
|
+
* ```
|
|
2338
|
+
*/
|
|
2339
|
+
async getApplicationStatus(email) {
|
|
2340
|
+
return this.http.get("/v1/affiliate/apply/status", { email });
|
|
2341
|
+
}
|
|
2313
2342
|
/**
|
|
2314
2343
|
* Track a referral click (store token for attribution).
|
|
2315
2344
|
* Requires API key.
|
package/dist/index.mjs
CHANGED
|
@@ -2216,10 +2216,24 @@ var AffiliatesClient = class {
|
|
|
2216
2216
|
this.http = http;
|
|
2217
2217
|
}
|
|
2218
2218
|
/**
|
|
2219
|
-
* Get
|
|
2220
|
-
*
|
|
2219
|
+
* Get affiliate info for a customer.
|
|
2220
|
+
*
|
|
2221
|
+
* - With customer session token: returns info for the authenticated customer.
|
|
2222
|
+
* - With API key + customerId: server-side lookup (no session token needed).
|
|
2223
|
+
*
|
|
2224
|
+
* @example
|
|
2225
|
+
* ```typescript
|
|
2226
|
+
* // Client-side (with session token)
|
|
2227
|
+
* const info = await stackbe.affiliates.get();
|
|
2228
|
+
*
|
|
2229
|
+
* // Server-side (with API key)
|
|
2230
|
+
* const info = await stackbe.affiliates.get('cust_123');
|
|
2231
|
+
* ```
|
|
2221
2232
|
*/
|
|
2222
|
-
async get() {
|
|
2233
|
+
async get(customerId) {
|
|
2234
|
+
if (customerId) {
|
|
2235
|
+
return this.http.get(`/v1/affiliate/by-customer/${customerId}`);
|
|
2236
|
+
}
|
|
2223
2237
|
return this.http.get("/v1/affiliate");
|
|
2224
2238
|
}
|
|
2225
2239
|
/**
|
|
@@ -2268,6 +2282,21 @@ var AffiliatesClient = class {
|
|
|
2268
2282
|
async apply(options) {
|
|
2269
2283
|
return this.http.post("/v1/affiliate/apply", options);
|
|
2270
2284
|
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Check the status of a partner application by email.
|
|
2287
|
+
* Requires API key only (no account needed).
|
|
2288
|
+
*
|
|
2289
|
+
* @example
|
|
2290
|
+
* ```typescript
|
|
2291
|
+
* const status = await stackbe.affiliates.getApplicationStatus('partner@example.com');
|
|
2292
|
+
* if (status.applied && status.status === 'approved') {
|
|
2293
|
+
* console.log('Application approved!');
|
|
2294
|
+
* }
|
|
2295
|
+
* ```
|
|
2296
|
+
*/
|
|
2297
|
+
async getApplicationStatus(email) {
|
|
2298
|
+
return this.http.get("/v1/affiliate/apply/status", { email });
|
|
2299
|
+
}
|
|
2271
2300
|
/**
|
|
2272
2301
|
* Track a referral click (store token for attribution).
|
|
2273
2302
|
* Requires API key.
|
package/package.json
CHANGED